@query-farm/vgi 0.42.0 → 0.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -2
- package/dist/attach-ticket.d.ts +18 -7
- package/dist/client-entry.js +215 -91
- package/dist/client-entry.js.map +10 -9
- package/dist/codec/asd.d.ts +3 -1
- package/dist/codec/conform.d.ts +51 -0
- package/dist/errors.d.ts +5 -1
- package/dist/generated/vgi-service.d.ts +1315 -0
- package/dist/index.core.d.ts +1 -1
- package/dist/index.js +2143 -932
- package/dist/index.js.map +29 -28
- package/dist/protocol/dispatch.d.ts +14 -5
- package/dist/protocol/handlers/aggregate.d.ts +3 -2
- package/dist/protocol/handlers/catalog/admin.d.ts +2 -2
- package/dist/protocol/handlers/catalog/index.d.ts +3 -2
- package/dist/protocol/handlers/catalog/index_methods.d.ts +2 -2
- package/dist/protocol/handlers/catalog/macro.d.ts +2 -2
- package/dist/protocol/handlers/catalog/shared.d.ts +7 -14
- package/dist/protocol/handlers/catalog/table.d.ts +2 -2
- package/dist/protocol/handlers/catalog/view.d.ts +2 -2
- package/dist/protocol/handlers/function.d.ts +3 -2
- package/dist/protocol/handlers/shared.d.ts +2 -2
- package/dist/protocol/handlers/table-buffering.d.ts +3 -2
- package/dist/protocol/handlers/unimplemented.d.ts +4 -17
- package/dist/protocol/serializers/shared.d.ts +2 -1
- package/dist/rpc-server.d.ts +2 -2
- package/dist/serve-entry.js +2104 -903
- package/dist/serve-entry.js.map +25 -24
- package/dist/worker-cf-entry.js +2045 -842
- package/dist/worker-cf-entry.js.map +29 -28
- package/package.json +3 -3
- package/src/attach-ticket.ts +41 -13
- package/src/catalog/composite.ts +2 -1
- package/src/catalog/interface.ts +5 -4
- package/src/catalog/read-only.ts +8 -6
- package/src/client/client.ts +13 -5
- package/src/codec/asd.ts +5 -2
- package/src/codec/conform.ts +193 -0
- package/src/errors.ts +27 -7
- package/src/functions/registry.ts +3 -2
- package/src/generated/vgi-service.ts +2678 -0
- package/src/http/fetch.ts +1 -1
- package/src/index.core.ts +3 -1
- package/src/protocol/dispatch.ts +40 -29
- package/src/protocol/handlers/aggregate.ts +205 -232
- package/src/protocol/handlers/catalog/admin.ts +228 -299
- package/src/protocol/handlers/catalog/index.ts +17 -16
- package/src/protocol/handlers/catalog/index_methods.ts +26 -36
- package/src/protocol/handlers/catalog/macro.ts +54 -77
- package/src/protocol/handlers/catalog/shared.ts +30 -47
- package/src/protocol/handlers/catalog/table.ts +205 -270
- package/src/protocol/handlers/catalog/view.ts +59 -85
- package/src/protocol/handlers/function.ts +127 -156
- package/src/protocol/handlers/shared.ts +8 -6
- package/src/protocol/handlers/table-buffering.ts +53 -71
- package/src/protocol/handlers/unimplemented.ts +18 -62
- package/src/protocol/serializers/bind.ts +3 -1
- package/src/protocol/serializers/shared.ts +5 -2
- package/src/rpc-server.ts +7 -7
package/dist/serve-entry.js
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
function __accessProp(key) {
|
|
7
|
+
return this[key];
|
|
8
|
+
}
|
|
9
|
+
var __toCommonJS = (from) => {
|
|
10
|
+
var entry = (__moduleCache ??= new WeakMap).get(from), desc;
|
|
11
|
+
if (entry)
|
|
12
|
+
return entry;
|
|
13
|
+
entry = __defProp({}, "__esModule", { value: true });
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (var key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(entry, key))
|
|
17
|
+
__defProp(entry, key, {
|
|
18
|
+
get: __accessProp.bind(from, key),
|
|
19
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
__moduleCache.set(from, entry);
|
|
23
|
+
return entry;
|
|
24
|
+
};
|
|
25
|
+
var __moduleCache;
|
|
3
26
|
var __returnValue = (v) => v;
|
|
4
27
|
function __exportSetter(name, newValue) {
|
|
5
28
|
this[name] = __returnValue.bind(null, newValue);
|
|
@@ -26,6 +49,11 @@ var __esm = (fn, res, err) => () => {
|
|
|
26
49
|
};
|
|
27
50
|
|
|
28
51
|
// src/functions/storage-cf-do.ts
|
|
52
|
+
var exports_storage_cf_do = {};
|
|
53
|
+
__export(exports_storage_cf_do, {
|
|
54
|
+
FunctionStorageCfDo: () => FunctionStorageCfDo
|
|
55
|
+
});
|
|
56
|
+
|
|
29
57
|
class FunctionStorageCfDo {
|
|
30
58
|
_baseUrl;
|
|
31
59
|
_token;
|
|
@@ -471,7 +499,7 @@ function resolveStorageFromEnv() {
|
|
|
471
499
|
return new FunctionStorageSqlite;
|
|
472
500
|
}
|
|
473
501
|
if (backend === "cloudflare-do") {
|
|
474
|
-
init_storage_cf_do();
|
|
502
|
+
const { FunctionStorageCfDo } = (init_storage_cf_do(), __toCommonJS(exports_storage_cf_do));
|
|
475
503
|
return FunctionStorageCfDo.fromEnv();
|
|
476
504
|
}
|
|
477
505
|
throw new Error(`Unknown VGI_WORKER_SHARED_STORAGE backend: '${backend}'. Supported: 'memory', 'sqlite', 'cloudflare-do'.`);
|
|
@@ -512,6 +540,79 @@ var init_storage = __esm(() => {
|
|
|
512
540
|
});
|
|
513
541
|
});
|
|
514
542
|
|
|
543
|
+
// src/arrow/impl-arrowjs/index.ts
|
|
544
|
+
var exports_impl_arrowjs = {};
|
|
545
|
+
__export(exports_impl_arrowjs, {
|
|
546
|
+
DateUnit: () => DateUnit,
|
|
547
|
+
IntervalUnit: () => IntervalUnit,
|
|
548
|
+
TimeUnit: () => TimeUnit,
|
|
549
|
+
UnionMode: () => UnionMode,
|
|
550
|
+
adoptArrowJsShape: () => adoptArrowJsShape,
|
|
551
|
+
backend: () => backend,
|
|
552
|
+
batchFromColumns: () => batchFromColumns,
|
|
553
|
+
batchFromRows: () => batchFromRows,
|
|
554
|
+
batchToScalarDict: () => batchToScalarDict,
|
|
555
|
+
batchToSecretDict: () => batchToSecretDict,
|
|
556
|
+
binary: () => binary,
|
|
557
|
+
bool: () => bool,
|
|
558
|
+
buildStatisticsBatch: () => buildStatisticsBatch,
|
|
559
|
+
columnFromArray: () => columnFromArray,
|
|
560
|
+
date: () => date,
|
|
561
|
+
dateDay: () => dateDay,
|
|
562
|
+
dateMillisecond: () => dateMillisecond,
|
|
563
|
+
decimal: () => decimal,
|
|
564
|
+
decimal128: () => decimal128,
|
|
565
|
+
decimal256: () => decimal256,
|
|
566
|
+
decodeDictValue: () => decodeDictValue,
|
|
567
|
+
denseUnion: () => denseUnion,
|
|
568
|
+
deserializeBatch: () => deserializeBatch,
|
|
569
|
+
deserializeSchema: () => deserializeSchema,
|
|
570
|
+
dictionary: () => dictionary,
|
|
571
|
+
duration: () => duration,
|
|
572
|
+
emptyBatch: () => emptyBatch,
|
|
573
|
+
field: () => field,
|
|
574
|
+
filterBatch: () => filterBatch,
|
|
575
|
+
fixedSizeBinary: () => fixedSizeBinary,
|
|
576
|
+
fixedSizeList: () => fixedSizeList,
|
|
577
|
+
float16: () => float16,
|
|
578
|
+
float32: () => float32,
|
|
579
|
+
float64: () => float64,
|
|
580
|
+
int: () => int,
|
|
581
|
+
int16: () => int16,
|
|
582
|
+
int32: () => int32,
|
|
583
|
+
int64: () => int64,
|
|
584
|
+
int8: () => int8,
|
|
585
|
+
interval: () => interval,
|
|
586
|
+
iterRows: () => iterRows,
|
|
587
|
+
largeBinary: () => largeBinary,
|
|
588
|
+
largeUtf8: () => largeUtf8,
|
|
589
|
+
list: () => list,
|
|
590
|
+
map: () => map,
|
|
591
|
+
nullType: () => nullType,
|
|
592
|
+
projectBatch: () => projectBatch,
|
|
593
|
+
projectSchema: () => projectSchema,
|
|
594
|
+
readCanonicalValue: () => readCanonicalValue,
|
|
595
|
+
safeNumber: () => safeNumber,
|
|
596
|
+
schema: () => schema,
|
|
597
|
+
serializeBatch: () => serializeBatch,
|
|
598
|
+
serializeSchema: () => serializeSchema,
|
|
599
|
+
sparseUnion: () => sparseUnion,
|
|
600
|
+
struct: () => struct,
|
|
601
|
+
time: () => time,
|
|
602
|
+
timeMicrosecond: () => timeMicrosecond,
|
|
603
|
+
timeMillisecond: () => timeMillisecond,
|
|
604
|
+
timeNanosecond: () => timeNanosecond,
|
|
605
|
+
timeSecond: () => timeSecond,
|
|
606
|
+
timestamp: () => timestamp,
|
|
607
|
+
uint16: () => uint16,
|
|
608
|
+
uint32: () => uint32,
|
|
609
|
+
uint64: () => uint64,
|
|
610
|
+
uint8: () => uint8,
|
|
611
|
+
union: () => union,
|
|
612
|
+
utf8: () => utf8,
|
|
613
|
+
withBatchMetadata: () => withBatchMetadata
|
|
614
|
+
});
|
|
615
|
+
|
|
515
616
|
// src/serve-entry.ts
|
|
516
617
|
import {
|
|
517
618
|
irohForwardedHeaderIdentityProvider,
|
|
@@ -551,6 +652,21 @@ var TypeId = {
|
|
|
551
652
|
LargeUtf8: 20,
|
|
552
653
|
Dictionary: -1
|
|
553
654
|
};
|
|
655
|
+
function isInt(t) {
|
|
656
|
+
return t.typeId === TypeId.Int;
|
|
657
|
+
}
|
|
658
|
+
function isFloat(t) {
|
|
659
|
+
return t.typeId === TypeId.Float;
|
|
660
|
+
}
|
|
661
|
+
function isBinary(t) {
|
|
662
|
+
return t.typeId === TypeId.Binary || t.typeId === TypeId.LargeBinary;
|
|
663
|
+
}
|
|
664
|
+
function isUtf8(t) {
|
|
665
|
+
return t.typeId === TypeId.Utf8 || t.typeId === TypeId.LargeUtf8;
|
|
666
|
+
}
|
|
667
|
+
function isBool(t) {
|
|
668
|
+
return t.typeId === TypeId.Bool;
|
|
669
|
+
}
|
|
554
670
|
function isDecimal(t) {
|
|
555
671
|
return t.typeId === TypeId.Decimal;
|
|
556
672
|
}
|
|
@@ -563,6 +679,9 @@ function isStruct(t) {
|
|
|
563
679
|
function isMap(t) {
|
|
564
680
|
return t.typeId === TypeId.Map;
|
|
565
681
|
}
|
|
682
|
+
function isDictionary(t) {
|
|
683
|
+
return t.typeId === TypeId.Dictionary;
|
|
684
|
+
}
|
|
566
685
|
function typeSignature(t) {
|
|
567
686
|
if (t == null)
|
|
568
687
|
return "null";
|
|
@@ -599,79 +718,6 @@ function typeSignature(t) {
|
|
|
599
718
|
return Array.isArray(a.children) ? `${t.typeId}<${kids()}>` : String(t.typeId);
|
|
600
719
|
}
|
|
601
720
|
}
|
|
602
|
-
// src/arrow/impl-arrowjs/index.ts
|
|
603
|
-
var exports_impl_arrowjs = {};
|
|
604
|
-
__export(exports_impl_arrowjs, {
|
|
605
|
-
DateUnit: () => DateUnit,
|
|
606
|
-
IntervalUnit: () => IntervalUnit,
|
|
607
|
-
TimeUnit: () => TimeUnit,
|
|
608
|
-
UnionMode: () => UnionMode,
|
|
609
|
-
adoptArrowJsShape: () => adoptArrowJsShape,
|
|
610
|
-
backend: () => backend,
|
|
611
|
-
batchFromColumns: () => batchFromColumns,
|
|
612
|
-
batchFromRows: () => batchFromRows,
|
|
613
|
-
batchToScalarDict: () => batchToScalarDict,
|
|
614
|
-
batchToSecretDict: () => batchToSecretDict,
|
|
615
|
-
binary: () => binary,
|
|
616
|
-
bool: () => bool,
|
|
617
|
-
buildStatisticsBatch: () => buildStatisticsBatch,
|
|
618
|
-
columnFromArray: () => columnFromArray,
|
|
619
|
-
date: () => date,
|
|
620
|
-
dateDay: () => dateDay,
|
|
621
|
-
dateMillisecond: () => dateMillisecond,
|
|
622
|
-
decimal: () => decimal,
|
|
623
|
-
decimal128: () => decimal128,
|
|
624
|
-
decimal256: () => decimal256,
|
|
625
|
-
decodeDictValue: () => decodeDictValue,
|
|
626
|
-
denseUnion: () => denseUnion,
|
|
627
|
-
deserializeBatch: () => deserializeBatch,
|
|
628
|
-
deserializeSchema: () => deserializeSchema,
|
|
629
|
-
dictionary: () => dictionary,
|
|
630
|
-
duration: () => duration,
|
|
631
|
-
emptyBatch: () => emptyBatch,
|
|
632
|
-
field: () => field,
|
|
633
|
-
filterBatch: () => filterBatch,
|
|
634
|
-
fixedSizeBinary: () => fixedSizeBinary,
|
|
635
|
-
fixedSizeList: () => fixedSizeList,
|
|
636
|
-
float16: () => float16,
|
|
637
|
-
float32: () => float32,
|
|
638
|
-
float64: () => float64,
|
|
639
|
-
int: () => int,
|
|
640
|
-
int16: () => int16,
|
|
641
|
-
int32: () => int32,
|
|
642
|
-
int64: () => int64,
|
|
643
|
-
int8: () => int8,
|
|
644
|
-
interval: () => interval,
|
|
645
|
-
iterRows: () => iterRows,
|
|
646
|
-
largeBinary: () => largeBinary,
|
|
647
|
-
largeUtf8: () => largeUtf8,
|
|
648
|
-
list: () => list,
|
|
649
|
-
map: () => map,
|
|
650
|
-
nullType: () => nullType,
|
|
651
|
-
projectBatch: () => projectBatch,
|
|
652
|
-
projectSchema: () => projectSchema,
|
|
653
|
-
readCanonicalValue: () => readCanonicalValue,
|
|
654
|
-
safeNumber: () => safeNumber,
|
|
655
|
-
schema: () => schema,
|
|
656
|
-
serializeBatch: () => serializeBatch,
|
|
657
|
-
serializeSchema: () => serializeSchema,
|
|
658
|
-
sparseUnion: () => sparseUnion,
|
|
659
|
-
struct: () => struct,
|
|
660
|
-
time: () => time,
|
|
661
|
-
timeMicrosecond: () => timeMicrosecond,
|
|
662
|
-
timeMillisecond: () => timeMillisecond,
|
|
663
|
-
timeNanosecond: () => timeNanosecond,
|
|
664
|
-
timeSecond: () => timeSecond,
|
|
665
|
-
timestamp: () => timestamp,
|
|
666
|
-
uint16: () => uint16,
|
|
667
|
-
uint32: () => uint32,
|
|
668
|
-
uint64: () => uint64,
|
|
669
|
-
uint8: () => uint8,
|
|
670
|
-
union: () => union,
|
|
671
|
-
utf8: () => utf8,
|
|
672
|
-
withBatchMetadata: () => withBatchMetadata
|
|
673
|
-
});
|
|
674
|
-
|
|
675
721
|
// src/arrow/impl-arrowjs/schema.ts
|
|
676
722
|
import {
|
|
677
723
|
Schema as A_Schema,
|
|
@@ -2638,6 +2684,116 @@ function deserializeArguments(bytes) {
|
|
|
2638
2684
|
}
|
|
2639
2685
|
return new Arguments(positional, named, sch);
|
|
2640
2686
|
}
|
|
2687
|
+
// src/codec/conform.ts
|
|
2688
|
+
var OPTIONAL_ITEM_FIELDS = new Set(["argument_names"]);
|
|
2689
|
+
function children(type) {
|
|
2690
|
+
return type.children ?? [];
|
|
2691
|
+
}
|
|
2692
|
+
function mapValueType(type) {
|
|
2693
|
+
const entries = children(type)[0].type;
|
|
2694
|
+
return children(entries)[1].type;
|
|
2695
|
+
}
|
|
2696
|
+
function mapPairs(raw) {
|
|
2697
|
+
if (Array.isArray(raw))
|
|
2698
|
+
return raw.map((e) => Array.isArray(e) ? [e[0], e[1]] : [e?.key, e?.value]);
|
|
2699
|
+
if (raw instanceof Map)
|
|
2700
|
+
return Array.from(raw.entries());
|
|
2701
|
+
if (typeof raw[Symbol.iterator] === "function")
|
|
2702
|
+
return Array.from(raw);
|
|
2703
|
+
return Object.entries(raw);
|
|
2704
|
+
}
|
|
2705
|
+
function zeroValue(type) {
|
|
2706
|
+
if (isUtf8(type) || isDictionary(type))
|
|
2707
|
+
return "";
|
|
2708
|
+
if (isBinary(type))
|
|
2709
|
+
return new Uint8Array(0);
|
|
2710
|
+
if (isBool(type))
|
|
2711
|
+
return false;
|
|
2712
|
+
if (isInt(type))
|
|
2713
|
+
return type.bitWidth === 64 ? 0n : 0;
|
|
2714
|
+
if (isFloat(type))
|
|
2715
|
+
return 0;
|
|
2716
|
+
if (isList(type) || isMap(type))
|
|
2717
|
+
return [];
|
|
2718
|
+
if (isStruct(type)) {
|
|
2719
|
+
const out = {};
|
|
2720
|
+
for (const c of children(type))
|
|
2721
|
+
out[c.name] = c.nullable ? null : conformValue(c.type, undefined, false, c.name);
|
|
2722
|
+
return out;
|
|
2723
|
+
}
|
|
2724
|
+
return null;
|
|
2725
|
+
}
|
|
2726
|
+
var HAS_CONTAINER = new WeakMap;
|
|
2727
|
+
function hasContainer(type) {
|
|
2728
|
+
const cached = HAS_CONTAINER.get(type);
|
|
2729
|
+
if (cached !== undefined)
|
|
2730
|
+
return cached;
|
|
2731
|
+
let has = isList(type) || isMap(type);
|
|
2732
|
+
if (!has && isStruct(type))
|
|
2733
|
+
has = children(type).some((c) => hasContainer(c.type));
|
|
2734
|
+
HAS_CONTAINER.set(type, has);
|
|
2735
|
+
return has;
|
|
2736
|
+
}
|
|
2737
|
+
function conformValue(type, value, nullable, name) {
|
|
2738
|
+
if (value == null) {
|
|
2739
|
+
if (nullable)
|
|
2740
|
+
return value ?? null;
|
|
2741
|
+
if (isList(type) || isMap(type))
|
|
2742
|
+
return [];
|
|
2743
|
+
return value;
|
|
2744
|
+
}
|
|
2745
|
+
if (!hasContainer(type))
|
|
2746
|
+
return value;
|
|
2747
|
+
if (isList(type)) {
|
|
2748
|
+
const itemType = children(type)[0].type;
|
|
2749
|
+
const itemsNullable = OPTIONAL_ITEM_FIELDS.has(name);
|
|
2750
|
+
const items = Array.isArray(value) ? value : Array.from(value);
|
|
2751
|
+
let changed = !Array.isArray(value);
|
|
2752
|
+
const out = items.map((item) => {
|
|
2753
|
+
const next = item == null && !itemsNullable ? zeroValue(itemType) : conformValue(itemType, item, true, name);
|
|
2754
|
+
if (next !== item)
|
|
2755
|
+
changed = true;
|
|
2756
|
+
return next;
|
|
2757
|
+
});
|
|
2758
|
+
return changed ? out : value;
|
|
2759
|
+
}
|
|
2760
|
+
if (isMap(type)) {
|
|
2761
|
+
const valueType = mapValueType(type);
|
|
2762
|
+
const pairs = mapPairs(value);
|
|
2763
|
+
let changed = false;
|
|
2764
|
+
const out = pairs.map(([k, v]) => {
|
|
2765
|
+
const next = v == null ? zeroValue(valueType) : conformValue(valueType, v, true, name);
|
|
2766
|
+
if (next !== v)
|
|
2767
|
+
changed = true;
|
|
2768
|
+
return [k, next];
|
|
2769
|
+
});
|
|
2770
|
+
return changed ? out : value;
|
|
2771
|
+
}
|
|
2772
|
+
if (isStruct(type)) {
|
|
2773
|
+
let out = null;
|
|
2774
|
+
for (const c of children(type)) {
|
|
2775
|
+
const v = value[c.name];
|
|
2776
|
+
const next = conformValue(c.type, v, c.nullable, c.name);
|
|
2777
|
+
if (next !== v) {
|
|
2778
|
+
(out ??= { ...value })[c.name] = next;
|
|
2779
|
+
}
|
|
2780
|
+
}
|
|
2781
|
+
return out ?? value;
|
|
2782
|
+
}
|
|
2783
|
+
return value;
|
|
2784
|
+
}
|
|
2785
|
+
function conformRecord(schema, obj) {
|
|
2786
|
+
let out = null;
|
|
2787
|
+
for (const f of schema.fields) {
|
|
2788
|
+
const v = obj[f.name];
|
|
2789
|
+
const next = conformValue(f.type, v, f.nullable, f.name);
|
|
2790
|
+
if (next !== v) {
|
|
2791
|
+
(out ??= { ...obj })[f.name] = next;
|
|
2792
|
+
}
|
|
2793
|
+
}
|
|
2794
|
+
return out ?? obj;
|
|
2795
|
+
}
|
|
2796
|
+
|
|
2641
2797
|
// src/protocol/serializers/shared.ts
|
|
2642
2798
|
function toUint8Array2(val) {
|
|
2643
2799
|
if (typeof val === "string")
|
|
@@ -3171,10 +3327,1261 @@ var arrowStateSerializer = {
|
|
|
3171
3327
|
filterHistory: decodeFilterHistory(filterHistoryBytes)
|
|
3172
3328
|
};
|
|
3173
3329
|
}
|
|
3174
|
-
};
|
|
3175
|
-
|
|
3176
|
-
// src/
|
|
3177
|
-
import {
|
|
3330
|
+
};
|
|
3331
|
+
|
|
3332
|
+
// src/generated/vgi-service.ts
|
|
3333
|
+
import {
|
|
3334
|
+
MethodNotImplementedError,
|
|
3335
|
+
Protocol
|
|
3336
|
+
} from "@query-farm/vgi-rpc";
|
|
3337
|
+
var VGI_PROTOCOL_NAME = "vgi.v2";
|
|
3338
|
+
var VGI_PROTOCOL_VERSION = "2.1.0";
|
|
3339
|
+
function exchangeStream(callbacks) {
|
|
3340
|
+
return { kind: "exchange", ...callbacks };
|
|
3341
|
+
}
|
|
3342
|
+
function producerStream(callbacks) {
|
|
3343
|
+
return { kind: "producer", ...callbacks };
|
|
3344
|
+
}
|
|
3345
|
+
var VGI_V2_METHODS = [
|
|
3346
|
+
{
|
|
3347
|
+
name: "aggregate_bind",
|
|
3348
|
+
key: "aggregateBind",
|
|
3349
|
+
type: "unary",
|
|
3350
|
+
params: schema2([
|
|
3351
|
+
field2("request", binary2(), false)
|
|
3352
|
+
]),
|
|
3353
|
+
result: schema2([
|
|
3354
|
+
field2("result", binary2(), false)
|
|
3355
|
+
]),
|
|
3356
|
+
doc: "Bind an aggregate function, return output schema and execution_id."
|
|
3357
|
+
},
|
|
3358
|
+
{
|
|
3359
|
+
name: "aggregate_combine",
|
|
3360
|
+
key: "aggregateCombine",
|
|
3361
|
+
type: "unary",
|
|
3362
|
+
params: schema2([
|
|
3363
|
+
field2("request", binary2(), false)
|
|
3364
|
+
]),
|
|
3365
|
+
result: schema2([
|
|
3366
|
+
field2("result", binary2(), false)
|
|
3367
|
+
]),
|
|
3368
|
+
doc: "Merge source states into target states."
|
|
3369
|
+
},
|
|
3370
|
+
{
|
|
3371
|
+
name: "aggregate_destructor",
|
|
3372
|
+
key: "aggregateDestructor",
|
|
3373
|
+
type: "unary",
|
|
3374
|
+
params: schema2([
|
|
3375
|
+
field2("request", binary2(), false)
|
|
3376
|
+
]),
|
|
3377
|
+
result: schema2([
|
|
3378
|
+
field2("result", binary2(), false)
|
|
3379
|
+
]),
|
|
3380
|
+
doc: "Best-effort cleanup of aggregate states. Must not raise."
|
|
3381
|
+
},
|
|
3382
|
+
{
|
|
3383
|
+
name: "aggregate_finalize",
|
|
3384
|
+
key: "aggregateFinalize",
|
|
3385
|
+
type: "unary",
|
|
3386
|
+
params: schema2([
|
|
3387
|
+
field2("request", binary2(), false)
|
|
3388
|
+
]),
|
|
3389
|
+
result: schema2([
|
|
3390
|
+
field2("result", binary2(), false)
|
|
3391
|
+
]),
|
|
3392
|
+
doc: "Produce results for a chunk of group_ids."
|
|
3393
|
+
},
|
|
3394
|
+
{
|
|
3395
|
+
name: "aggregate_streaming_chunk",
|
|
3396
|
+
key: "aggregateStreamingChunk",
|
|
3397
|
+
type: "unary",
|
|
3398
|
+
params: schema2([
|
|
3399
|
+
field2("request", binary2(), false)
|
|
3400
|
+
]),
|
|
3401
|
+
result: schema2([
|
|
3402
|
+
field2("result", binary2(), false)
|
|
3403
|
+
]),
|
|
3404
|
+
doc: "Process one input chunk; returns one output row per input row."
|
|
3405
|
+
},
|
|
3406
|
+
{
|
|
3407
|
+
name: "aggregate_streaming_close",
|
|
3408
|
+
key: "aggregateStreamingClose",
|
|
3409
|
+
type: "unary",
|
|
3410
|
+
params: schema2([
|
|
3411
|
+
field2("request", binary2(), false)
|
|
3412
|
+
]),
|
|
3413
|
+
result: schema2([
|
|
3414
|
+
field2("result", binary2(), false)
|
|
3415
|
+
]),
|
|
3416
|
+
doc: "End the streaming session, free per-session state."
|
|
3417
|
+
},
|
|
3418
|
+
{
|
|
3419
|
+
name: "aggregate_streaming_open",
|
|
3420
|
+
key: "aggregateStreamingOpen",
|
|
3421
|
+
type: "unary",
|
|
3422
|
+
params: schema2([
|
|
3423
|
+
field2("request", binary2(), false)
|
|
3424
|
+
]),
|
|
3425
|
+
result: schema2([
|
|
3426
|
+
field2("result", binary2(), false)
|
|
3427
|
+
]),
|
|
3428
|
+
doc: "Start a streaming-partitioned aggregate session."
|
|
3429
|
+
},
|
|
3430
|
+
{
|
|
3431
|
+
name: "aggregate_update",
|
|
3432
|
+
key: "aggregateUpdate",
|
|
3433
|
+
type: "unary",
|
|
3434
|
+
params: schema2([
|
|
3435
|
+
field2("request", binary2(), false)
|
|
3436
|
+
]),
|
|
3437
|
+
result: schema2([
|
|
3438
|
+
field2("result", binary2(), false)
|
|
3439
|
+
]),
|
|
3440
|
+
doc: "Accumulate rows from a `DataChunk` into per-group state."
|
|
3441
|
+
},
|
|
3442
|
+
{
|
|
3443
|
+
name: "aggregate_window",
|
|
3444
|
+
key: "aggregateWindow",
|
|
3445
|
+
type: "unary",
|
|
3446
|
+
params: schema2([
|
|
3447
|
+
field2("request", binary2(), false)
|
|
3448
|
+
]),
|
|
3449
|
+
result: schema2([
|
|
3450
|
+
field2("result", binary2(), false)
|
|
3451
|
+
]),
|
|
3452
|
+
doc: "Compute an aggregate value for one output row of the window."
|
|
3453
|
+
},
|
|
3454
|
+
{
|
|
3455
|
+
name: "aggregate_window_batch",
|
|
3456
|
+
key: "aggregateWindowBatch",
|
|
3457
|
+
type: "unary",
|
|
3458
|
+
params: schema2([
|
|
3459
|
+
field2("request", binary2(), false)
|
|
3460
|
+
]),
|
|
3461
|
+
result: schema2([
|
|
3462
|
+
field2("result", binary2(), false)
|
|
3463
|
+
]),
|
|
3464
|
+
doc: "Compute ``count`` window output rows in one batched RPC."
|
|
3465
|
+
},
|
|
3466
|
+
{
|
|
3467
|
+
name: "aggregate_window_destructor",
|
|
3468
|
+
key: "aggregateWindowDestructor",
|
|
3469
|
+
type: "unary",
|
|
3470
|
+
params: schema2([
|
|
3471
|
+
field2("request", binary2(), false)
|
|
3472
|
+
]),
|
|
3473
|
+
result: schema2([
|
|
3474
|
+
field2("result", binary2(), false)
|
|
3475
|
+
]),
|
|
3476
|
+
doc: "Evict a cached partition from storage."
|
|
3477
|
+
},
|
|
3478
|
+
{
|
|
3479
|
+
name: "aggregate_window_init",
|
|
3480
|
+
key: "aggregateWindowInit",
|
|
3481
|
+
type: "unary",
|
|
3482
|
+
params: schema2([
|
|
3483
|
+
field2("request", binary2(), false)
|
|
3484
|
+
]),
|
|
3485
|
+
result: schema2([
|
|
3486
|
+
field2("result", binary2(), false)
|
|
3487
|
+
]),
|
|
3488
|
+
doc: "Ship a partition to the worker for windowed aggregation."
|
|
3489
|
+
},
|
|
3490
|
+
{
|
|
3491
|
+
name: "bind",
|
|
3492
|
+
key: "bind",
|
|
3493
|
+
type: "unary",
|
|
3494
|
+
params: schema2([
|
|
3495
|
+
field2("request", binary2(), false)
|
|
3496
|
+
]),
|
|
3497
|
+
result: schema2([
|
|
3498
|
+
field2("result", binary2(), false)
|
|
3499
|
+
]),
|
|
3500
|
+
doc: "Resolve output schema and validate arguments."
|
|
3501
|
+
},
|
|
3502
|
+
{
|
|
3503
|
+
name: "catalog_attach",
|
|
3504
|
+
key: "catalogAttach",
|
|
3505
|
+
type: "unary",
|
|
3506
|
+
params: schema2([
|
|
3507
|
+
field2("request", binary2(), false)
|
|
3508
|
+
]),
|
|
3509
|
+
result: schema2([
|
|
3510
|
+
field2("result", binary2(), false)
|
|
3511
|
+
]),
|
|
3512
|
+
doc: "Attach to a catalog with options."
|
|
3513
|
+
},
|
|
3514
|
+
{
|
|
3515
|
+
name: "catalog_catalogs",
|
|
3516
|
+
key: "catalogCatalogs",
|
|
3517
|
+
type: "unary",
|
|
3518
|
+
params: schema2([]),
|
|
3519
|
+
result: schema2([
|
|
3520
|
+
field2("result", binary2(), false)
|
|
3521
|
+
]),
|
|
3522
|
+
doc: "List available catalog names."
|
|
3523
|
+
},
|
|
3524
|
+
{
|
|
3525
|
+
name: "catalog_contents",
|
|
3526
|
+
key: "catalogContents",
|
|
3527
|
+
type: "unary",
|
|
3528
|
+
params: schema2([
|
|
3529
|
+
field2("attach_opaque_data", binary2(), false),
|
|
3530
|
+
field2("if_none_match", utf82(), true)
|
|
3531
|
+
]),
|
|
3532
|
+
result: schema2([
|
|
3533
|
+
field2("result", binary2(), false)
|
|
3534
|
+
]),
|
|
3535
|
+
doc: "Return every schema and all of its contents in one result."
|
|
3536
|
+
},
|
|
3537
|
+
{
|
|
3538
|
+
name: "catalog_copy_from_formats",
|
|
3539
|
+
key: "catalogCopyFromFormats",
|
|
3540
|
+
type: "unary",
|
|
3541
|
+
params: schema2([
|
|
3542
|
+
field2("attach_opaque_data", binary2(), false),
|
|
3543
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
3544
|
+
]),
|
|
3545
|
+
result: schema2([
|
|
3546
|
+
field2("result", binary2(), false)
|
|
3547
|
+
]),
|
|
3548
|
+
doc: "List custom ``COPY ... FROM`` formats advertised by this catalog."
|
|
3549
|
+
},
|
|
3550
|
+
{
|
|
3551
|
+
name: "catalog_create",
|
|
3552
|
+
key: "catalogCreate",
|
|
3553
|
+
type: "unary",
|
|
3554
|
+
params: schema2([
|
|
3555
|
+
field2("request", binary2(), false)
|
|
3556
|
+
]),
|
|
3557
|
+
result: schema2([]),
|
|
3558
|
+
doc: "Create a new catalog."
|
|
3559
|
+
},
|
|
3560
|
+
{
|
|
3561
|
+
name: "catalog_detach",
|
|
3562
|
+
key: "catalogDetach",
|
|
3563
|
+
type: "unary",
|
|
3564
|
+
params: schema2([
|
|
3565
|
+
field2("attach_opaque_data", binary2(), false)
|
|
3566
|
+
]),
|
|
3567
|
+
result: schema2([]),
|
|
3568
|
+
doc: "Detach from a catalog."
|
|
3569
|
+
},
|
|
3570
|
+
{
|
|
3571
|
+
name: "catalog_drop",
|
|
3572
|
+
key: "catalogDrop",
|
|
3573
|
+
type: "unary",
|
|
3574
|
+
params: schema2([
|
|
3575
|
+
field2("name", utf82(), false)
|
|
3576
|
+
]),
|
|
3577
|
+
result: schema2([]),
|
|
3578
|
+
doc: "Drop a catalog."
|
|
3579
|
+
},
|
|
3580
|
+
{
|
|
3581
|
+
name: "catalog_index_create",
|
|
3582
|
+
key: "catalogIndexCreate",
|
|
3583
|
+
type: "unary",
|
|
3584
|
+
params: schema2([
|
|
3585
|
+
field2("request", binary2(), false)
|
|
3586
|
+
]),
|
|
3587
|
+
result: schema2([]),
|
|
3588
|
+
doc: "Create a new index."
|
|
3589
|
+
},
|
|
3590
|
+
{
|
|
3591
|
+
name: "catalog_index_drop",
|
|
3592
|
+
key: "catalogIndexDrop",
|
|
3593
|
+
type: "unary",
|
|
3594
|
+
params: schema2([
|
|
3595
|
+
field2("attach_opaque_data", binary2(), false),
|
|
3596
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3597
|
+
field2("name", utf82(), false),
|
|
3598
|
+
field2("ignore_not_found", bool2(), false),
|
|
3599
|
+
field2("cascade", bool2(), false),
|
|
3600
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
3601
|
+
]),
|
|
3602
|
+
result: schema2([]),
|
|
3603
|
+
doc: "Drop an index."
|
|
3604
|
+
},
|
|
3605
|
+
{
|
|
3606
|
+
name: "catalog_index_get",
|
|
3607
|
+
key: "catalogIndexGet",
|
|
3608
|
+
type: "unary",
|
|
3609
|
+
params: schema2([
|
|
3610
|
+
field2("attach_opaque_data", binary2(), false),
|
|
3611
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3612
|
+
field2("name", utf82(), false),
|
|
3613
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
3614
|
+
]),
|
|
3615
|
+
result: schema2([
|
|
3616
|
+
field2("result", binary2(), false)
|
|
3617
|
+
]),
|
|
3618
|
+
doc: "Get information about an index. Returns 0 or 1 items."
|
|
3619
|
+
},
|
|
3620
|
+
{
|
|
3621
|
+
name: "catalog_macro_create",
|
|
3622
|
+
key: "catalogMacroCreate",
|
|
3623
|
+
type: "unary",
|
|
3624
|
+
params: schema2([
|
|
3625
|
+
field2("request", binary2(), false)
|
|
3626
|
+
]),
|
|
3627
|
+
result: schema2([]),
|
|
3628
|
+
doc: "Create a new macro."
|
|
3629
|
+
},
|
|
3630
|
+
{
|
|
3631
|
+
name: "catalog_macro_drop",
|
|
3632
|
+
key: "catalogMacroDrop",
|
|
3633
|
+
type: "unary",
|
|
3634
|
+
params: schema2([
|
|
3635
|
+
field2("attach_opaque_data", binary2(), false),
|
|
3636
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3637
|
+
field2("name", utf82(), false),
|
|
3638
|
+
field2("ignore_not_found", bool2(), false),
|
|
3639
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
3640
|
+
]),
|
|
3641
|
+
result: schema2([]),
|
|
3642
|
+
doc: "Drop a macro."
|
|
3643
|
+
},
|
|
3644
|
+
{
|
|
3645
|
+
name: "catalog_macro_get",
|
|
3646
|
+
key: "catalogMacroGet",
|
|
3647
|
+
type: "unary",
|
|
3648
|
+
params: schema2([
|
|
3649
|
+
field2("attach_opaque_data", binary2(), false),
|
|
3650
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3651
|
+
field2("name", utf82(), false),
|
|
3652
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
3653
|
+
]),
|
|
3654
|
+
result: schema2([
|
|
3655
|
+
field2("result", binary2(), false)
|
|
3656
|
+
]),
|
|
3657
|
+
doc: "Get information about a macro. Returns 0 or 1 items."
|
|
3658
|
+
},
|
|
3659
|
+
{
|
|
3660
|
+
name: "catalog_schema_contents_functions",
|
|
3661
|
+
key: "catalogSchemaContentsFunctions",
|
|
3662
|
+
type: "unary",
|
|
3663
|
+
params: schema2([
|
|
3664
|
+
field2("attach_opaque_data", binary2(), false),
|
|
3665
|
+
field2("path", list2(field2("item", utf82(), true)), false),
|
|
3666
|
+
field2("type", dictionary2(utf82(), int162()), false),
|
|
3667
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
3668
|
+
]),
|
|
3669
|
+
result: schema2([
|
|
3670
|
+
field2("result", binary2(), false)
|
|
3671
|
+
]),
|
|
3672
|
+
doc: "List functions in a schema (scalar or table)."
|
|
3673
|
+
},
|
|
3674
|
+
{
|
|
3675
|
+
name: "catalog_schema_contents_indexes",
|
|
3676
|
+
key: "catalogSchemaContentsIndexes",
|
|
3677
|
+
type: "unary",
|
|
3678
|
+
params: schema2([
|
|
3679
|
+
field2("attach_opaque_data", binary2(), false),
|
|
3680
|
+
field2("path", list2(field2("item", utf82(), true)), false),
|
|
3681
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
3682
|
+
]),
|
|
3683
|
+
result: schema2([
|
|
3684
|
+
field2("result", binary2(), false)
|
|
3685
|
+
]),
|
|
3686
|
+
doc: "List indexes in a schema."
|
|
3687
|
+
},
|
|
3688
|
+
{
|
|
3689
|
+
name: "catalog_schema_contents_macros",
|
|
3690
|
+
key: "catalogSchemaContentsMacros",
|
|
3691
|
+
type: "unary",
|
|
3692
|
+
params: schema2([
|
|
3693
|
+
field2("attach_opaque_data", binary2(), false),
|
|
3694
|
+
field2("path", list2(field2("item", utf82(), true)), false),
|
|
3695
|
+
field2("type", dictionary2(utf82(), int162()), false),
|
|
3696
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
3697
|
+
]),
|
|
3698
|
+
result: schema2([
|
|
3699
|
+
field2("result", binary2(), false)
|
|
3700
|
+
]),
|
|
3701
|
+
doc: "List macros in a schema (scalar or table)."
|
|
3702
|
+
},
|
|
3703
|
+
{
|
|
3704
|
+
name: "catalog_schema_contents_tables",
|
|
3705
|
+
key: "catalogSchemaContentsTables",
|
|
3706
|
+
type: "unary",
|
|
3707
|
+
params: schema2([
|
|
3708
|
+
field2("attach_opaque_data", binary2(), false),
|
|
3709
|
+
field2("path", list2(field2("item", utf82(), true)), false),
|
|
3710
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
3711
|
+
]),
|
|
3712
|
+
result: schema2([
|
|
3713
|
+
field2("result", binary2(), false)
|
|
3714
|
+
]),
|
|
3715
|
+
doc: "List tables in a schema."
|
|
3716
|
+
},
|
|
3717
|
+
{
|
|
3718
|
+
name: "catalog_schema_contents_views",
|
|
3719
|
+
key: "catalogSchemaContentsViews",
|
|
3720
|
+
type: "unary",
|
|
3721
|
+
params: schema2([
|
|
3722
|
+
field2("attach_opaque_data", binary2(), false),
|
|
3723
|
+
field2("path", list2(field2("item", utf82(), true)), false),
|
|
3724
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
3725
|
+
]),
|
|
3726
|
+
result: schema2([
|
|
3727
|
+
field2("result", binary2(), false)
|
|
3728
|
+
]),
|
|
3729
|
+
doc: "List views in a schema."
|
|
3730
|
+
},
|
|
3731
|
+
{
|
|
3732
|
+
name: "catalog_schema_create",
|
|
3733
|
+
key: "catalogSchemaCreate",
|
|
3734
|
+
type: "unary",
|
|
3735
|
+
params: schema2([
|
|
3736
|
+
field2("attach_opaque_data", binary2(), false),
|
|
3737
|
+
field2("path", list2(field2("item", utf82(), true)), false),
|
|
3738
|
+
field2("on_conflict", dictionary2(utf82(), int162()), false),
|
|
3739
|
+
field2("comment", utf82(), true),
|
|
3740
|
+
field2("tags", map2(field2("key", utf82(), false), field2("value", utf82(), true), false), true),
|
|
3741
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
3742
|
+
]),
|
|
3743
|
+
result: schema2([]),
|
|
3744
|
+
doc: "Create a new schema."
|
|
3745
|
+
},
|
|
3746
|
+
{
|
|
3747
|
+
name: "catalog_schema_drop",
|
|
3748
|
+
key: "catalogSchemaDrop",
|
|
3749
|
+
type: "unary",
|
|
3750
|
+
params: schema2([
|
|
3751
|
+
field2("attach_opaque_data", binary2(), false),
|
|
3752
|
+
field2("path", list2(field2("item", utf82(), true)), false),
|
|
3753
|
+
field2("ignore_not_found", bool2(), false),
|
|
3754
|
+
field2("cascade", bool2(), false),
|
|
3755
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
3756
|
+
]),
|
|
3757
|
+
result: schema2([]),
|
|
3758
|
+
doc: "Drop a schema."
|
|
3759
|
+
},
|
|
3760
|
+
{
|
|
3761
|
+
name: "catalog_schema_get",
|
|
3762
|
+
key: "catalogSchemaGet",
|
|
3763
|
+
type: "unary",
|
|
3764
|
+
params: schema2([
|
|
3765
|
+
field2("attach_opaque_data", binary2(), false),
|
|
3766
|
+
field2("path", list2(field2("item", utf82(), true)), false),
|
|
3767
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
3768
|
+
]),
|
|
3769
|
+
result: schema2([
|
|
3770
|
+
field2("result", binary2(), false)
|
|
3771
|
+
]),
|
|
3772
|
+
doc: "Get information about a schema. Returns 0 or 1 items."
|
|
3773
|
+
},
|
|
3774
|
+
{
|
|
3775
|
+
name: "catalog_schemas",
|
|
3776
|
+
key: "catalogSchemas",
|
|
3777
|
+
type: "unary",
|
|
3778
|
+
params: schema2([
|
|
3779
|
+
field2("attach_opaque_data", binary2(), false),
|
|
3780
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
3781
|
+
]),
|
|
3782
|
+
result: schema2([
|
|
3783
|
+
field2("result", binary2(), false)
|
|
3784
|
+
]),
|
|
3785
|
+
doc: "List schemas in the catalog."
|
|
3786
|
+
},
|
|
3787
|
+
{
|
|
3788
|
+
name: "catalog_table_column_add",
|
|
3789
|
+
key: "catalogTableColumnAdd",
|
|
3790
|
+
type: "unary",
|
|
3791
|
+
params: schema2([
|
|
3792
|
+
field2("attach_opaque_data", binary2(), false),
|
|
3793
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3794
|
+
field2("name", utf82(), false),
|
|
3795
|
+
field2("column_definition", binary2(), false),
|
|
3796
|
+
field2("ignore_not_found", bool2(), false),
|
|
3797
|
+
field2("if_column_not_exists", bool2(), false),
|
|
3798
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
3799
|
+
]),
|
|
3800
|
+
result: schema2([]),
|
|
3801
|
+
doc: "Add a new column to a table."
|
|
3802
|
+
},
|
|
3803
|
+
{
|
|
3804
|
+
name: "catalog_table_column_comment_set",
|
|
3805
|
+
key: "catalogTableColumnCommentSet",
|
|
3806
|
+
type: "unary",
|
|
3807
|
+
params: schema2([
|
|
3808
|
+
field2("attach_opaque_data", binary2(), false),
|
|
3809
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3810
|
+
field2("name", utf82(), false),
|
|
3811
|
+
field2("column_name", utf82(), false),
|
|
3812
|
+
field2("comment", utf82(), true),
|
|
3813
|
+
field2("ignore_not_found", bool2(), false),
|
|
3814
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
3815
|
+
]),
|
|
3816
|
+
result: schema2([]),
|
|
3817
|
+
doc: "Set or clear the comment on a table column."
|
|
3818
|
+
},
|
|
3819
|
+
{
|
|
3820
|
+
name: "catalog_table_column_default_drop",
|
|
3821
|
+
key: "catalogTableColumnDefaultDrop",
|
|
3822
|
+
type: "unary",
|
|
3823
|
+
params: schema2([
|
|
3824
|
+
field2("attach_opaque_data", binary2(), false),
|
|
3825
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3826
|
+
field2("name", utf82(), false),
|
|
3827
|
+
field2("column_name", utf82(), false),
|
|
3828
|
+
field2("ignore_not_found", bool2(), false),
|
|
3829
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
3830
|
+
]),
|
|
3831
|
+
result: schema2([]),
|
|
3832
|
+
doc: "Remove the default value from a column."
|
|
3833
|
+
},
|
|
3834
|
+
{
|
|
3835
|
+
name: "catalog_table_column_default_set",
|
|
3836
|
+
key: "catalogTableColumnDefaultSet",
|
|
3837
|
+
type: "unary",
|
|
3838
|
+
params: schema2([
|
|
3839
|
+
field2("attach_opaque_data", binary2(), false),
|
|
3840
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3841
|
+
field2("name", utf82(), false),
|
|
3842
|
+
field2("column_name", utf82(), false),
|
|
3843
|
+
field2("expression", utf82(), false),
|
|
3844
|
+
field2("ignore_not_found", bool2(), false),
|
|
3845
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
3846
|
+
]),
|
|
3847
|
+
result: schema2([]),
|
|
3848
|
+
doc: "Set the default value expression for a column."
|
|
3849
|
+
},
|
|
3850
|
+
{
|
|
3851
|
+
name: "catalog_table_column_drop",
|
|
3852
|
+
key: "catalogTableColumnDrop",
|
|
3853
|
+
type: "unary",
|
|
3854
|
+
params: schema2([
|
|
3855
|
+
field2("attach_opaque_data", binary2(), false),
|
|
3856
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3857
|
+
field2("name", utf82(), false),
|
|
3858
|
+
field2("column_name", utf82(), false),
|
|
3859
|
+
field2("ignore_not_found", bool2(), false),
|
|
3860
|
+
field2("if_column_exists", bool2(), false),
|
|
3861
|
+
field2("cascade", bool2(), false),
|
|
3862
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
3863
|
+
]),
|
|
3864
|
+
result: schema2([]),
|
|
3865
|
+
doc: "Drop a column from a table."
|
|
3866
|
+
},
|
|
3867
|
+
{
|
|
3868
|
+
name: "catalog_table_column_rename",
|
|
3869
|
+
key: "catalogTableColumnRename",
|
|
3870
|
+
type: "unary",
|
|
3871
|
+
params: schema2([
|
|
3872
|
+
field2("attach_opaque_data", binary2(), false),
|
|
3873
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3874
|
+
field2("name", utf82(), false),
|
|
3875
|
+
field2("column_name", utf82(), false),
|
|
3876
|
+
field2("new_column_name", utf82(), false),
|
|
3877
|
+
field2("ignore_not_found", bool2(), false),
|
|
3878
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
3879
|
+
]),
|
|
3880
|
+
result: schema2([]),
|
|
3881
|
+
doc: "Rename a column."
|
|
3882
|
+
},
|
|
3883
|
+
{
|
|
3884
|
+
name: "catalog_table_column_statistics_get",
|
|
3885
|
+
key: "catalogTableColumnStatisticsGet",
|
|
3886
|
+
type: "unary",
|
|
3887
|
+
params: schema2([
|
|
3888
|
+
field2("attach_opaque_data", binary2(), false),
|
|
3889
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3890
|
+
field2("name", utf82(), false),
|
|
3891
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
3892
|
+
]),
|
|
3893
|
+
result: schema2([
|
|
3894
|
+
field2("result", binary2(), true)
|
|
3895
|
+
]),
|
|
3896
|
+
doc: "Get column statistics for a table."
|
|
3897
|
+
},
|
|
3898
|
+
{
|
|
3899
|
+
name: "catalog_table_column_type_change",
|
|
3900
|
+
key: "catalogTableColumnTypeChange",
|
|
3901
|
+
type: "unary",
|
|
3902
|
+
params: schema2([
|
|
3903
|
+
field2("attach_opaque_data", binary2(), false),
|
|
3904
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3905
|
+
field2("name", utf82(), false),
|
|
3906
|
+
field2("column_definition", binary2(), false),
|
|
3907
|
+
field2("expression", utf82(), true),
|
|
3908
|
+
field2("ignore_not_found", bool2(), false),
|
|
3909
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
3910
|
+
]),
|
|
3911
|
+
result: schema2([]),
|
|
3912
|
+
doc: "Change the type of a column."
|
|
3913
|
+
},
|
|
3914
|
+
{
|
|
3915
|
+
name: "catalog_table_comment_set",
|
|
3916
|
+
key: "catalogTableCommentSet",
|
|
3917
|
+
type: "unary",
|
|
3918
|
+
params: schema2([
|
|
3919
|
+
field2("attach_opaque_data", binary2(), false),
|
|
3920
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3921
|
+
field2("name", utf82(), false),
|
|
3922
|
+
field2("comment", utf82(), true),
|
|
3923
|
+
field2("ignore_not_found", bool2(), false),
|
|
3924
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
3925
|
+
]),
|
|
3926
|
+
result: schema2([]),
|
|
3927
|
+
doc: "Set or clear the comment on a table."
|
|
3928
|
+
},
|
|
3929
|
+
{
|
|
3930
|
+
name: "catalog_table_create",
|
|
3931
|
+
key: "catalogTableCreate",
|
|
3932
|
+
type: "unary",
|
|
3933
|
+
params: schema2([
|
|
3934
|
+
field2("request", binary2(), false)
|
|
3935
|
+
]),
|
|
3936
|
+
result: schema2([]),
|
|
3937
|
+
doc: "Create a new table."
|
|
3938
|
+
},
|
|
3939
|
+
{
|
|
3940
|
+
name: "catalog_table_delete_function_get",
|
|
3941
|
+
key: "catalogTableDeleteFunctionGet",
|
|
3942
|
+
type: "unary",
|
|
3943
|
+
params: schema2([
|
|
3944
|
+
field2("attach_opaque_data", binary2(), false),
|
|
3945
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3946
|
+
field2("name", utf82(), false),
|
|
3947
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
3948
|
+
]),
|
|
3949
|
+
result: schema2([
|
|
3950
|
+
field2("result", binary2(), false)
|
|
3951
|
+
]),
|
|
3952
|
+
doc: "Get the delete function for a table. Returns `WriteFunctionResult` as IPC bytes."
|
|
3953
|
+
},
|
|
3954
|
+
{
|
|
3955
|
+
name: "catalog_table_drop",
|
|
3956
|
+
key: "catalogTableDrop",
|
|
3957
|
+
type: "unary",
|
|
3958
|
+
params: schema2([
|
|
3959
|
+
field2("attach_opaque_data", binary2(), false),
|
|
3960
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3961
|
+
field2("name", utf82(), false),
|
|
3962
|
+
field2("ignore_not_found", bool2(), false),
|
|
3963
|
+
field2("cascade", bool2(), false),
|
|
3964
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
3965
|
+
]),
|
|
3966
|
+
result: schema2([]),
|
|
3967
|
+
doc: "Drop a table."
|
|
3968
|
+
},
|
|
3969
|
+
{
|
|
3970
|
+
name: "catalog_table_get",
|
|
3971
|
+
key: "catalogTableGet",
|
|
3972
|
+
type: "unary",
|
|
3973
|
+
params: schema2([
|
|
3974
|
+
field2("attach_opaque_data", binary2(), false),
|
|
3975
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3976
|
+
field2("name", utf82(), false),
|
|
3977
|
+
field2("at_unit", utf82(), true),
|
|
3978
|
+
field2("at_value", utf82(), true),
|
|
3979
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
3980
|
+
]),
|
|
3981
|
+
result: schema2([
|
|
3982
|
+
field2("result", binary2(), false)
|
|
3983
|
+
]),
|
|
3984
|
+
doc: "Get information about a table. Returns 0 or 1 items."
|
|
3985
|
+
},
|
|
3986
|
+
{
|
|
3987
|
+
name: "catalog_table_insert_function_get",
|
|
3988
|
+
key: "catalogTableInsertFunctionGet",
|
|
3989
|
+
type: "unary",
|
|
3990
|
+
params: schema2([
|
|
3991
|
+
field2("attach_opaque_data", binary2(), false),
|
|
3992
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3993
|
+
field2("name", utf82(), false),
|
|
3994
|
+
field2("transaction_opaque_data", binary2(), true),
|
|
3995
|
+
field2("writable_branch_function_name", utf82(), true)
|
|
3996
|
+
]),
|
|
3997
|
+
result: schema2([
|
|
3998
|
+
field2("result", binary2(), false)
|
|
3999
|
+
]),
|
|
4000
|
+
doc: "Get the insert function for a table. Returns `WriteFunctionResult` as IPC bytes."
|
|
4001
|
+
},
|
|
4002
|
+
{
|
|
4003
|
+
name: "catalog_table_not_null_drop",
|
|
4004
|
+
key: "catalogTableNotNullDrop",
|
|
4005
|
+
type: "unary",
|
|
4006
|
+
params: schema2([
|
|
4007
|
+
field2("attach_opaque_data", binary2(), false),
|
|
4008
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
4009
|
+
field2("name", utf82(), false),
|
|
4010
|
+
field2("column_name", utf82(), false),
|
|
4011
|
+
field2("ignore_not_found", bool2(), false),
|
|
4012
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
4013
|
+
]),
|
|
4014
|
+
result: schema2([]),
|
|
4015
|
+
doc: "Remove NOT NULL constraint from a column."
|
|
4016
|
+
},
|
|
4017
|
+
{
|
|
4018
|
+
name: "catalog_table_not_null_set",
|
|
4019
|
+
key: "catalogTableNotNullSet",
|
|
4020
|
+
type: "unary",
|
|
4021
|
+
params: schema2([
|
|
4022
|
+
field2("attach_opaque_data", binary2(), false),
|
|
4023
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
4024
|
+
field2("name", utf82(), false),
|
|
4025
|
+
field2("column_name", utf82(), false),
|
|
4026
|
+
field2("ignore_not_found", bool2(), false),
|
|
4027
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
4028
|
+
]),
|
|
4029
|
+
result: schema2([]),
|
|
4030
|
+
doc: "Add NOT NULL constraint to a column."
|
|
4031
|
+
},
|
|
4032
|
+
{
|
|
4033
|
+
name: "catalog_table_rename",
|
|
4034
|
+
key: "catalogTableRename",
|
|
4035
|
+
type: "unary",
|
|
4036
|
+
params: schema2([
|
|
4037
|
+
field2("attach_opaque_data", binary2(), false),
|
|
4038
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
4039
|
+
field2("name", utf82(), false),
|
|
4040
|
+
field2("new_name", utf82(), false),
|
|
4041
|
+
field2("ignore_not_found", bool2(), false),
|
|
4042
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
4043
|
+
]),
|
|
4044
|
+
result: schema2([]),
|
|
4045
|
+
doc: "Rename a table."
|
|
4046
|
+
},
|
|
4047
|
+
{
|
|
4048
|
+
name: "catalog_table_scan_branches_get",
|
|
4049
|
+
key: "catalogTableScanBranchesGet",
|
|
4050
|
+
type: "unary",
|
|
4051
|
+
params: schema2([
|
|
4052
|
+
field2("attach_opaque_data", binary2(), false),
|
|
4053
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
4054
|
+
field2("name", utf82(), false),
|
|
4055
|
+
field2("at_unit", utf82(), true),
|
|
4056
|
+
field2("at_value", utf82(), true),
|
|
4057
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
4058
|
+
]),
|
|
4059
|
+
result: schema2([
|
|
4060
|
+
field2("result", binary2(), false)
|
|
4061
|
+
]),
|
|
4062
|
+
doc: "Get the list of scan branches for a multi-branch table. Returns `ScanBranchesResult` as IPC bytes."
|
|
4063
|
+
},
|
|
4064
|
+
{
|
|
4065
|
+
name: "catalog_table_scan_function_get",
|
|
4066
|
+
key: "catalogTableScanFunctionGet",
|
|
4067
|
+
type: "unary",
|
|
4068
|
+
params: schema2([
|
|
4069
|
+
field2("attach_opaque_data", binary2(), false),
|
|
4070
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
4071
|
+
field2("name", utf82(), false),
|
|
4072
|
+
field2("at_unit", utf82(), true),
|
|
4073
|
+
field2("at_value", utf82(), true),
|
|
4074
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
4075
|
+
]),
|
|
4076
|
+
result: schema2([
|
|
4077
|
+
field2("result", binary2(), false)
|
|
4078
|
+
]),
|
|
4079
|
+
doc: "Get the scan function for a table. Returns `ScanFunctionResult` as IPC bytes."
|
|
4080
|
+
},
|
|
4081
|
+
{
|
|
4082
|
+
name: "catalog_table_update_function_get",
|
|
4083
|
+
key: "catalogTableUpdateFunctionGet",
|
|
4084
|
+
type: "unary",
|
|
4085
|
+
params: schema2([
|
|
4086
|
+
field2("attach_opaque_data", binary2(), false),
|
|
4087
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
4088
|
+
field2("name", utf82(), false),
|
|
4089
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
4090
|
+
]),
|
|
4091
|
+
result: schema2([
|
|
4092
|
+
field2("result", binary2(), false)
|
|
4093
|
+
]),
|
|
4094
|
+
doc: "Get the update function for a table. Returns `WriteFunctionResult` as IPC bytes."
|
|
4095
|
+
},
|
|
4096
|
+
{
|
|
4097
|
+
name: "catalog_transaction_begin",
|
|
4098
|
+
key: "catalogTransactionBegin",
|
|
4099
|
+
type: "unary",
|
|
4100
|
+
params: schema2([
|
|
4101
|
+
field2("attach_opaque_data", binary2(), false)
|
|
4102
|
+
]),
|
|
4103
|
+
result: schema2([
|
|
4104
|
+
field2("result", binary2(), false)
|
|
4105
|
+
]),
|
|
4106
|
+
doc: "Begin a new transaction."
|
|
4107
|
+
},
|
|
4108
|
+
{
|
|
4109
|
+
name: "catalog_transaction_commit",
|
|
4110
|
+
key: "catalogTransactionCommit",
|
|
4111
|
+
type: "unary",
|
|
4112
|
+
params: schema2([
|
|
4113
|
+
field2("attach_opaque_data", binary2(), false),
|
|
4114
|
+
field2("transaction_opaque_data", binary2(), false)
|
|
4115
|
+
]),
|
|
4116
|
+
result: schema2([]),
|
|
4117
|
+
doc: "Commit a transaction."
|
|
4118
|
+
},
|
|
4119
|
+
{
|
|
4120
|
+
name: "catalog_transaction_rollback",
|
|
4121
|
+
key: "catalogTransactionRollback",
|
|
4122
|
+
type: "unary",
|
|
4123
|
+
params: schema2([
|
|
4124
|
+
field2("attach_opaque_data", binary2(), false),
|
|
4125
|
+
field2("transaction_opaque_data", binary2(), false)
|
|
4126
|
+
]),
|
|
4127
|
+
result: schema2([]),
|
|
4128
|
+
doc: "Rollback a transaction."
|
|
4129
|
+
},
|
|
4130
|
+
{
|
|
4131
|
+
name: "catalog_version",
|
|
4132
|
+
key: "catalogVersion",
|
|
4133
|
+
type: "unary",
|
|
4134
|
+
params: schema2([
|
|
4135
|
+
field2("attach_opaque_data", binary2(), false),
|
|
4136
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
4137
|
+
]),
|
|
4138
|
+
result: schema2([
|
|
4139
|
+
field2("result", binary2(), false)
|
|
4140
|
+
]),
|
|
4141
|
+
doc: "Get the current catalog version."
|
|
4142
|
+
},
|
|
4143
|
+
{
|
|
4144
|
+
name: "catalog_view_comment_set",
|
|
4145
|
+
key: "catalogViewCommentSet",
|
|
4146
|
+
type: "unary",
|
|
4147
|
+
params: schema2([
|
|
4148
|
+
field2("attach_opaque_data", binary2(), false),
|
|
4149
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
4150
|
+
field2("name", utf82(), false),
|
|
4151
|
+
field2("comment", utf82(), true),
|
|
4152
|
+
field2("ignore_not_found", bool2(), false),
|
|
4153
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
4154
|
+
]),
|
|
4155
|
+
result: schema2([]),
|
|
4156
|
+
doc: "Set or clear the comment on a view."
|
|
4157
|
+
},
|
|
4158
|
+
{
|
|
4159
|
+
name: "catalog_view_create",
|
|
4160
|
+
key: "catalogViewCreate",
|
|
4161
|
+
type: "unary",
|
|
4162
|
+
params: schema2([
|
|
4163
|
+
field2("attach_opaque_data", binary2(), false),
|
|
4164
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
4165
|
+
field2("name", utf82(), false),
|
|
4166
|
+
field2("definition", utf82(), false),
|
|
4167
|
+
field2("on_conflict", dictionary2(utf82(), int162()), false),
|
|
4168
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
4169
|
+
]),
|
|
4170
|
+
result: schema2([]),
|
|
4171
|
+
doc: "Create a new view."
|
|
4172
|
+
},
|
|
4173
|
+
{
|
|
4174
|
+
name: "catalog_view_drop",
|
|
4175
|
+
key: "catalogViewDrop",
|
|
4176
|
+
type: "unary",
|
|
4177
|
+
params: schema2([
|
|
4178
|
+
field2("attach_opaque_data", binary2(), false),
|
|
4179
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
4180
|
+
field2("name", utf82(), false),
|
|
4181
|
+
field2("ignore_not_found", bool2(), false),
|
|
4182
|
+
field2("cascade", bool2(), false),
|
|
4183
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
4184
|
+
]),
|
|
4185
|
+
result: schema2([]),
|
|
4186
|
+
doc: "Drop a view."
|
|
4187
|
+
},
|
|
4188
|
+
{
|
|
4189
|
+
name: "catalog_view_get",
|
|
4190
|
+
key: "catalogViewGet",
|
|
4191
|
+
type: "unary",
|
|
4192
|
+
params: schema2([
|
|
4193
|
+
field2("attach_opaque_data", binary2(), false),
|
|
4194
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
4195
|
+
field2("name", utf82(), false),
|
|
4196
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
4197
|
+
]),
|
|
4198
|
+
result: schema2([
|
|
4199
|
+
field2("result", binary2(), false)
|
|
4200
|
+
]),
|
|
4201
|
+
doc: "Get information about a view. Returns 0 or 1 items."
|
|
4202
|
+
},
|
|
4203
|
+
{
|
|
4204
|
+
name: "catalog_view_rename",
|
|
4205
|
+
key: "catalogViewRename",
|
|
4206
|
+
type: "unary",
|
|
4207
|
+
params: schema2([
|
|
4208
|
+
field2("attach_opaque_data", binary2(), false),
|
|
4209
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
4210
|
+
field2("name", utf82(), false),
|
|
4211
|
+
field2("new_name", utf82(), false),
|
|
4212
|
+
field2("ignore_not_found", bool2(), false),
|
|
4213
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
4214
|
+
]),
|
|
4215
|
+
result: schema2([]),
|
|
4216
|
+
doc: "Rename a view."
|
|
4217
|
+
},
|
|
4218
|
+
{
|
|
4219
|
+
name: "init",
|
|
4220
|
+
key: "init",
|
|
4221
|
+
type: "stream",
|
|
4222
|
+
params: schema2([
|
|
4223
|
+
field2("request", binary2(), false)
|
|
4224
|
+
]),
|
|
4225
|
+
header: schema2([
|
|
4226
|
+
field2("execution_id", binary2(), false),
|
|
4227
|
+
field2("opaque_data", binary2(), true),
|
|
4228
|
+
field2("max_workers", int642(), false)
|
|
4229
|
+
]),
|
|
4230
|
+
doc: "Initialize a function execution and return a processing stream."
|
|
4231
|
+
},
|
|
4232
|
+
{
|
|
4233
|
+
name: "table_buffering_combine",
|
|
4234
|
+
key: "tableBufferingCombine",
|
|
4235
|
+
type: "unary",
|
|
4236
|
+
params: schema2([
|
|
4237
|
+
field2("request", binary2(), false)
|
|
4238
|
+
]),
|
|
4239
|
+
result: schema2([
|
|
4240
|
+
field2("result", binary2(), false)
|
|
4241
|
+
]),
|
|
4242
|
+
doc: "Once-per-query end-of-input signal. Returns finalize_state_ids."
|
|
4243
|
+
},
|
|
4244
|
+
{
|
|
4245
|
+
name: "table_buffering_destructor",
|
|
4246
|
+
key: "tableBufferingDestructor",
|
|
4247
|
+
type: "unary",
|
|
4248
|
+
params: schema2([
|
|
4249
|
+
field2("request", binary2(), false)
|
|
4250
|
+
]),
|
|
4251
|
+
result: schema2([
|
|
4252
|
+
field2("result", binary2(), false)
|
|
4253
|
+
]),
|
|
4254
|
+
doc: "Best-effort end-of-query cleanup. Must not raise."
|
|
4255
|
+
},
|
|
4256
|
+
{
|
|
4257
|
+
name: "table_buffering_process",
|
|
4258
|
+
key: "tableBufferingProcess",
|
|
4259
|
+
type: "unary",
|
|
4260
|
+
params: schema2([
|
|
4261
|
+
field2("request", binary2(), false)
|
|
4262
|
+
]),
|
|
4263
|
+
result: schema2([
|
|
4264
|
+
field2("result", binary2(), false)
|
|
4265
|
+
]),
|
|
4266
|
+
doc: "Sink one input batch; return the worker-chosen state_id."
|
|
4267
|
+
},
|
|
4268
|
+
{
|
|
4269
|
+
name: "table_function_cardinality",
|
|
4270
|
+
key: "tableFunctionCardinality",
|
|
4271
|
+
type: "unary",
|
|
4272
|
+
params: schema2([
|
|
4273
|
+
field2("request", binary2(), false)
|
|
4274
|
+
]),
|
|
4275
|
+
result: schema2([
|
|
4276
|
+
field2("result", binary2(), false)
|
|
4277
|
+
]),
|
|
4278
|
+
doc: "Estimate the cardinality of a table function's output."
|
|
4279
|
+
},
|
|
4280
|
+
{
|
|
4281
|
+
name: "table_function_dynamic_to_string",
|
|
4282
|
+
key: "tableFunctionDynamicToString",
|
|
4283
|
+
type: "unary",
|
|
4284
|
+
params: schema2([
|
|
4285
|
+
field2("request", binary2(), false)
|
|
4286
|
+
]),
|
|
4287
|
+
result: schema2([
|
|
4288
|
+
field2("result", binary2(), false)
|
|
4289
|
+
]),
|
|
4290
|
+
doc: "Return user-defined diagnostics for EXPLAIN ANALYZE Extra Info."
|
|
4291
|
+
},
|
|
4292
|
+
{
|
|
4293
|
+
name: "table_function_plan",
|
|
4294
|
+
key: "tableFunctionPlan",
|
|
4295
|
+
type: "unary",
|
|
4296
|
+
params: schema2([
|
|
4297
|
+
field2("request", binary2(), false)
|
|
4298
|
+
]),
|
|
4299
|
+
result: schema2([
|
|
4300
|
+
field2("result", binary2(), false)
|
|
4301
|
+
]),
|
|
4302
|
+
doc: "Plan a table-function scan into named, independently redeemable splits."
|
|
4303
|
+
},
|
|
4304
|
+
{
|
|
4305
|
+
name: "table_function_statistics",
|
|
4306
|
+
key: "tableFunctionStatistics",
|
|
4307
|
+
type: "unary",
|
|
4308
|
+
params: schema2([
|
|
4309
|
+
field2("request", binary2(), false)
|
|
4310
|
+
]),
|
|
4311
|
+
result: schema2([
|
|
4312
|
+
field2("result", binary2(), true)
|
|
4313
|
+
]),
|
|
4314
|
+
doc: "Return per-column statistics for a table function's output."
|
|
4315
|
+
}
|
|
4316
|
+
];
|
|
4317
|
+
var UNIMPLEMENTED_VGI_SERVICE = Object.freeze({
|
|
4318
|
+
aggregateBind: async () => {
|
|
4319
|
+
throw notImplemented("aggregate_bind");
|
|
4320
|
+
},
|
|
4321
|
+
aggregateCombine: async () => {
|
|
4322
|
+
throw notImplemented("aggregate_combine");
|
|
4323
|
+
},
|
|
4324
|
+
aggregateDestructor: async () => {
|
|
4325
|
+
throw notImplemented("aggregate_destructor");
|
|
4326
|
+
},
|
|
4327
|
+
aggregateFinalize: async () => {
|
|
4328
|
+
throw notImplemented("aggregate_finalize");
|
|
4329
|
+
},
|
|
4330
|
+
aggregateStreamingChunk: async () => {
|
|
4331
|
+
throw notImplemented("aggregate_streaming_chunk");
|
|
4332
|
+
},
|
|
4333
|
+
aggregateStreamingClose: async () => {
|
|
4334
|
+
throw notImplemented("aggregate_streaming_close");
|
|
4335
|
+
},
|
|
4336
|
+
aggregateStreamingOpen: async () => {
|
|
4337
|
+
throw notImplemented("aggregate_streaming_open");
|
|
4338
|
+
},
|
|
4339
|
+
aggregateUpdate: async () => {
|
|
4340
|
+
throw notImplemented("aggregate_update");
|
|
4341
|
+
},
|
|
4342
|
+
aggregateWindow: async () => {
|
|
4343
|
+
throw notImplemented("aggregate_window");
|
|
4344
|
+
},
|
|
4345
|
+
aggregateWindowBatch: async () => {
|
|
4346
|
+
throw notImplemented("aggregate_window_batch");
|
|
4347
|
+
},
|
|
4348
|
+
aggregateWindowDestructor: async () => {
|
|
4349
|
+
throw notImplemented("aggregate_window_destructor");
|
|
4350
|
+
},
|
|
4351
|
+
aggregateWindowInit: async () => {
|
|
4352
|
+
throw notImplemented("aggregate_window_init");
|
|
4353
|
+
},
|
|
4354
|
+
bind: async () => {
|
|
4355
|
+
throw notImplemented("bind");
|
|
4356
|
+
},
|
|
4357
|
+
catalogAttach: async () => {
|
|
4358
|
+
throw notImplemented("catalog_attach");
|
|
4359
|
+
},
|
|
4360
|
+
catalogCatalogs: async () => {
|
|
4361
|
+
throw notImplemented("catalog_catalogs");
|
|
4362
|
+
},
|
|
4363
|
+
catalogContents: async () => {
|
|
4364
|
+
throw notImplemented("catalog_contents");
|
|
4365
|
+
},
|
|
4366
|
+
catalogCopyFromFormats: async () => {
|
|
4367
|
+
throw notImplemented("catalog_copy_from_formats");
|
|
4368
|
+
},
|
|
4369
|
+
catalogCreate: async () => {
|
|
4370
|
+
throw notImplemented("catalog_create");
|
|
4371
|
+
},
|
|
4372
|
+
catalogDetach: async () => {
|
|
4373
|
+
throw notImplemented("catalog_detach");
|
|
4374
|
+
},
|
|
4375
|
+
catalogDrop: async () => {
|
|
4376
|
+
throw notImplemented("catalog_drop");
|
|
4377
|
+
},
|
|
4378
|
+
catalogIndexCreate: async () => {
|
|
4379
|
+
throw notImplemented("catalog_index_create");
|
|
4380
|
+
},
|
|
4381
|
+
catalogIndexDrop: async () => {
|
|
4382
|
+
throw notImplemented("catalog_index_drop");
|
|
4383
|
+
},
|
|
4384
|
+
catalogIndexGet: async () => {
|
|
4385
|
+
throw notImplemented("catalog_index_get");
|
|
4386
|
+
},
|
|
4387
|
+
catalogMacroCreate: async () => {
|
|
4388
|
+
throw notImplemented("catalog_macro_create");
|
|
4389
|
+
},
|
|
4390
|
+
catalogMacroDrop: async () => {
|
|
4391
|
+
throw notImplemented("catalog_macro_drop");
|
|
4392
|
+
},
|
|
4393
|
+
catalogMacroGet: async () => {
|
|
4394
|
+
throw notImplemented("catalog_macro_get");
|
|
4395
|
+
},
|
|
4396
|
+
catalogSchemaContentsFunctions: async () => {
|
|
4397
|
+
throw notImplemented("catalog_schema_contents_functions");
|
|
4398
|
+
},
|
|
4399
|
+
catalogSchemaContentsIndexes: async () => {
|
|
4400
|
+
throw notImplemented("catalog_schema_contents_indexes");
|
|
4401
|
+
},
|
|
4402
|
+
catalogSchemaContentsMacros: async () => {
|
|
4403
|
+
throw notImplemented("catalog_schema_contents_macros");
|
|
4404
|
+
},
|
|
4405
|
+
catalogSchemaContentsTables: async () => {
|
|
4406
|
+
throw notImplemented("catalog_schema_contents_tables");
|
|
4407
|
+
},
|
|
4408
|
+
catalogSchemaContentsViews: async () => {
|
|
4409
|
+
throw notImplemented("catalog_schema_contents_views");
|
|
4410
|
+
},
|
|
4411
|
+
catalogSchemaCreate: async () => {
|
|
4412
|
+
throw notImplemented("catalog_schema_create");
|
|
4413
|
+
},
|
|
4414
|
+
catalogSchemaDrop: async () => {
|
|
4415
|
+
throw notImplemented("catalog_schema_drop");
|
|
4416
|
+
},
|
|
4417
|
+
catalogSchemaGet: async () => {
|
|
4418
|
+
throw notImplemented("catalog_schema_get");
|
|
4419
|
+
},
|
|
4420
|
+
catalogSchemas: async () => {
|
|
4421
|
+
throw notImplemented("catalog_schemas");
|
|
4422
|
+
},
|
|
4423
|
+
catalogTableColumnAdd: async () => {
|
|
4424
|
+
throw notImplemented("catalog_table_column_add");
|
|
4425
|
+
},
|
|
4426
|
+
catalogTableColumnCommentSet: async () => {
|
|
4427
|
+
throw notImplemented("catalog_table_column_comment_set");
|
|
4428
|
+
},
|
|
4429
|
+
catalogTableColumnDefaultDrop: async () => {
|
|
4430
|
+
throw notImplemented("catalog_table_column_default_drop");
|
|
4431
|
+
},
|
|
4432
|
+
catalogTableColumnDefaultSet: async () => {
|
|
4433
|
+
throw notImplemented("catalog_table_column_default_set");
|
|
4434
|
+
},
|
|
4435
|
+
catalogTableColumnDrop: async () => {
|
|
4436
|
+
throw notImplemented("catalog_table_column_drop");
|
|
4437
|
+
},
|
|
4438
|
+
catalogTableColumnRename: async () => {
|
|
4439
|
+
throw notImplemented("catalog_table_column_rename");
|
|
4440
|
+
},
|
|
4441
|
+
catalogTableColumnStatisticsGet: async () => {
|
|
4442
|
+
throw notImplemented("catalog_table_column_statistics_get");
|
|
4443
|
+
},
|
|
4444
|
+
catalogTableColumnTypeChange: async () => {
|
|
4445
|
+
throw notImplemented("catalog_table_column_type_change");
|
|
4446
|
+
},
|
|
4447
|
+
catalogTableCommentSet: async () => {
|
|
4448
|
+
throw notImplemented("catalog_table_comment_set");
|
|
4449
|
+
},
|
|
4450
|
+
catalogTableCreate: async () => {
|
|
4451
|
+
throw notImplemented("catalog_table_create");
|
|
4452
|
+
},
|
|
4453
|
+
catalogTableDeleteFunctionGet: async () => {
|
|
4454
|
+
throw notImplemented("catalog_table_delete_function_get");
|
|
4455
|
+
},
|
|
4456
|
+
catalogTableDrop: async () => {
|
|
4457
|
+
throw notImplemented("catalog_table_drop");
|
|
4458
|
+
},
|
|
4459
|
+
catalogTableGet: async () => {
|
|
4460
|
+
throw notImplemented("catalog_table_get");
|
|
4461
|
+
},
|
|
4462
|
+
catalogTableInsertFunctionGet: async () => {
|
|
4463
|
+
throw notImplemented("catalog_table_insert_function_get");
|
|
4464
|
+
},
|
|
4465
|
+
catalogTableNotNullDrop: async () => {
|
|
4466
|
+
throw notImplemented("catalog_table_not_null_drop");
|
|
4467
|
+
},
|
|
4468
|
+
catalogTableNotNullSet: async () => {
|
|
4469
|
+
throw notImplemented("catalog_table_not_null_set");
|
|
4470
|
+
},
|
|
4471
|
+
catalogTableRename: async () => {
|
|
4472
|
+
throw notImplemented("catalog_table_rename");
|
|
4473
|
+
},
|
|
4474
|
+
catalogTableScanBranchesGet: async () => {
|
|
4475
|
+
throw notImplemented("catalog_table_scan_branches_get");
|
|
4476
|
+
},
|
|
4477
|
+
catalogTableScanFunctionGet: async () => {
|
|
4478
|
+
throw notImplemented("catalog_table_scan_function_get");
|
|
4479
|
+
},
|
|
4480
|
+
catalogTableUpdateFunctionGet: async () => {
|
|
4481
|
+
throw notImplemented("catalog_table_update_function_get");
|
|
4482
|
+
},
|
|
4483
|
+
catalogTransactionBegin: async () => {
|
|
4484
|
+
throw notImplemented("catalog_transaction_begin");
|
|
4485
|
+
},
|
|
4486
|
+
catalogTransactionCommit: async () => {
|
|
4487
|
+
throw notImplemented("catalog_transaction_commit");
|
|
4488
|
+
},
|
|
4489
|
+
catalogTransactionRollback: async () => {
|
|
4490
|
+
throw notImplemented("catalog_transaction_rollback");
|
|
4491
|
+
},
|
|
4492
|
+
catalogVersion: async () => {
|
|
4493
|
+
throw notImplemented("catalog_version");
|
|
4494
|
+
},
|
|
4495
|
+
catalogViewCommentSet: async () => {
|
|
4496
|
+
throw notImplemented("catalog_view_comment_set");
|
|
4497
|
+
},
|
|
4498
|
+
catalogViewCreate: async () => {
|
|
4499
|
+
throw notImplemented("catalog_view_create");
|
|
4500
|
+
},
|
|
4501
|
+
catalogViewDrop: async () => {
|
|
4502
|
+
throw notImplemented("catalog_view_drop");
|
|
4503
|
+
},
|
|
4504
|
+
catalogViewGet: async () => {
|
|
4505
|
+
throw notImplemented("catalog_view_get");
|
|
4506
|
+
},
|
|
4507
|
+
catalogViewRename: async () => {
|
|
4508
|
+
throw notImplemented("catalog_view_rename");
|
|
4509
|
+
},
|
|
4510
|
+
init: unimplementedStream("init"),
|
|
4511
|
+
tableBufferingCombine: async () => {
|
|
4512
|
+
throw notImplemented("table_buffering_combine");
|
|
4513
|
+
},
|
|
4514
|
+
tableBufferingDestructor: async () => {
|
|
4515
|
+
throw notImplemented("table_buffering_destructor");
|
|
4516
|
+
},
|
|
4517
|
+
tableBufferingProcess: async () => {
|
|
4518
|
+
throw notImplemented("table_buffering_process");
|
|
4519
|
+
},
|
|
4520
|
+
tableFunctionCardinality: async () => {
|
|
4521
|
+
throw notImplemented("table_function_cardinality");
|
|
4522
|
+
},
|
|
4523
|
+
tableFunctionDynamicToString: async () => {
|
|
4524
|
+
throw notImplemented("table_function_dynamic_to_string");
|
|
4525
|
+
},
|
|
4526
|
+
tableFunctionPlan: async () => {
|
|
4527
|
+
throw notImplemented("table_function_plan");
|
|
4528
|
+
},
|
|
4529
|
+
tableFunctionStatistics: async () => {
|
|
4530
|
+
throw notImplemented("table_function_statistics");
|
|
4531
|
+
}
|
|
4532
|
+
});
|
|
4533
|
+
function unimplementedMessage(method) {
|
|
4534
|
+
return `${method} is not implemented by this worker`;
|
|
4535
|
+
}
|
|
4536
|
+
function notImplemented(method) {
|
|
4537
|
+
return new MethodNotImplementedError(unimplementedMessage(method));
|
|
4538
|
+
}
|
|
4539
|
+
function unimplementedStream(method) {
|
|
4540
|
+
return producerStream({
|
|
4541
|
+
outputSchema: schema2([]),
|
|
4542
|
+
init: () => {
|
|
4543
|
+
throw notImplemented(method);
|
|
4544
|
+
},
|
|
4545
|
+
produce: () => {}
|
|
4546
|
+
});
|
|
4547
|
+
}
|
|
4548
|
+
function registerVgiService(protocol, service) {
|
|
4549
|
+
for (const m of VGI_V2_METHODS) {
|
|
4550
|
+
if (m.type === "unary") {
|
|
4551
|
+
const handler = service[m.key];
|
|
4552
|
+
protocol.unary(m.name, {
|
|
4553
|
+
params: m.params,
|
|
4554
|
+
result: m.result,
|
|
4555
|
+
doc: m.doc,
|
|
4556
|
+
handler: (params, ctx) => handler.call(service, params, ctx)
|
|
4557
|
+
});
|
|
4558
|
+
continue;
|
|
4559
|
+
}
|
|
4560
|
+
const stream = service[m.key];
|
|
4561
|
+
const common = {
|
|
4562
|
+
params: m.params,
|
|
4563
|
+
outputSchema: stream.outputSchema,
|
|
4564
|
+
headerSchema: m.header ?? undefined,
|
|
4565
|
+
headerInit: stream.headerInit,
|
|
4566
|
+
onCancel: stream.onCancel,
|
|
4567
|
+
doc: m.doc
|
|
4568
|
+
};
|
|
4569
|
+
if (stream.kind === "exchange") {
|
|
4570
|
+
protocol.exchange(m.name, {
|
|
4571
|
+
...common,
|
|
4572
|
+
inputSchema: stream.inputSchema,
|
|
4573
|
+
init: stream.init,
|
|
4574
|
+
exchange: stream.exchange
|
|
4575
|
+
});
|
|
4576
|
+
} else {
|
|
4577
|
+
protocol.producer(m.name, { ...common, init: stream.init, produce: stream.produce });
|
|
4578
|
+
}
|
|
4579
|
+
}
|
|
4580
|
+
return protocol;
|
|
4581
|
+
}
|
|
4582
|
+
function createVgiProtocol(service) {
|
|
4583
|
+
return registerVgiService(new Protocol(VGI_PROTOCOL_NAME, { protocolVersion: VGI_PROTOCOL_VERSION }), service);
|
|
4584
|
+
}
|
|
3178
4585
|
|
|
3179
4586
|
// src/util/statistics.ts
|
|
3180
4587
|
function serializeColumnStatistics(stats, _cacheMaxAgeSeconds) {
|
|
@@ -4170,9 +5577,6 @@ var RESULT_BINARY_SCHEMA = schema2([
|
|
|
4170
5577
|
var REQUEST_PARAMS_SCHEMA = schema2([
|
|
4171
5578
|
field2("request", binary2(), false)
|
|
4172
5579
|
]);
|
|
4173
|
-
var RESULT_BINARY_NULLABLE_SCHEMA = schema2([
|
|
4174
|
-
field2("result", binary2(), true)
|
|
4175
|
-
]);
|
|
4176
5580
|
function unwrapRequest(requestBytes) {
|
|
4177
5581
|
const bytes = toUint8Array(requestBytes);
|
|
4178
5582
|
const innerBatch = deserializeBatch(bytes);
|
|
@@ -4188,7 +5592,8 @@ function normalizeRequestSchemaPaths(params) {
|
|
|
4188
5592
|
}
|
|
4189
5593
|
function wrapResult(values, innerSchema) {
|
|
4190
5594
|
const a = innerSchema;
|
|
4191
|
-
const
|
|
5595
|
+
const row = conformRecord(a, values);
|
|
5596
|
+
const batch = batchFromColumns(Object.fromEntries(a.fields.map((f) => [f.name, [row[f.name] ?? null]])), a);
|
|
4192
5597
|
return { result: serializeBatch(batch) };
|
|
4193
5598
|
}
|
|
4194
5599
|
function overloadContext(req, catalogInterface) {
|
|
@@ -4211,21 +5616,24 @@ function overloadContext(req, catalogInterface) {
|
|
|
4211
5616
|
|
|
4212
5617
|
// src/errors.ts
|
|
4213
5618
|
class VgiError extends Error {
|
|
4214
|
-
|
|
5619
|
+
errorCode;
|
|
5620
|
+
constructor(message, code) {
|
|
4215
5621
|
super(message);
|
|
4216
5622
|
this.name = "VgiError";
|
|
5623
|
+
if (code !== undefined)
|
|
5624
|
+
this.errorCode = code;
|
|
4217
5625
|
}
|
|
4218
5626
|
}
|
|
4219
5627
|
class ArgumentValidationError extends VgiError {
|
|
4220
5628
|
constructor(message) {
|
|
4221
|
-
super(message);
|
|
5629
|
+
super(message, "INVALID_ARGUMENT");
|
|
4222
5630
|
this.name = "ArgumentValidationError";
|
|
4223
5631
|
}
|
|
4224
5632
|
}
|
|
4225
5633
|
|
|
4226
5634
|
class NoCatalogError extends VgiError {
|
|
4227
5635
|
constructor() {
|
|
4228
|
-
super("No catalog is configured for this worker");
|
|
5636
|
+
super("No catalog is configured for this worker", "UNIMPLEMENTED");
|
|
4229
5637
|
this.name = "NoCatalogError";
|
|
4230
5638
|
}
|
|
4231
5639
|
}
|
|
@@ -5060,20 +6468,16 @@ async function unwrapParamsOpaque(params, ctx, signingKey) {
|
|
|
5060
6468
|
}
|
|
5061
6469
|
}
|
|
5062
6470
|
}
|
|
5063
|
-
function
|
|
5064
|
-
|
|
5065
|
-
params
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
handler: async (params, ctx) => {
|
|
5069
|
-
if (params.request != null && params.attach_opaque_data === undefined && params.name === undefined) {
|
|
5070
|
-
params = unwrapRequest(params.request);
|
|
5071
|
-
}
|
|
5072
|
-
normalizeRequestSchemaPaths(params);
|
|
5073
|
-
await unwrapParamsOpaque(params, ctx, signingKey);
|
|
5074
|
-
return config.handler(params, ctx);
|
|
6471
|
+
function catalogHandler(signingKey, handler) {
|
|
6472
|
+
return async (wire, ctx) => {
|
|
6473
|
+
let params = wire;
|
|
6474
|
+
if (params.request != null && params.attach_opaque_data === undefined && params.name === undefined) {
|
|
6475
|
+
params = unwrapRequest(params.request);
|
|
5075
6476
|
}
|
|
5076
|
-
|
|
6477
|
+
normalizeRequestSchemaPaths(params);
|
|
6478
|
+
await unwrapParamsOpaque(params, ctx, signingKey);
|
|
6479
|
+
return handler(params, ctx);
|
|
6480
|
+
};
|
|
5077
6481
|
}
|
|
5078
6482
|
function makeGetCatalog(catalog) {
|
|
5079
6483
|
return () => {
|
|
@@ -5094,7 +6498,6 @@ function decodeOptionsBatch(bytes) {
|
|
|
5094
6498
|
const row = iterRows(batch).next().value;
|
|
5095
6499
|
return row ?? {};
|
|
5096
6500
|
}
|
|
5097
|
-
var emptyResultSchema = schema2([]);
|
|
5098
6501
|
|
|
5099
6502
|
// src/request-auth.ts
|
|
5100
6503
|
var scope;
|
|
@@ -5324,7 +6727,7 @@ async function resolveSplitPayloads(request, innerParams, opts) {
|
|
|
5324
6727
|
}));
|
|
5325
6728
|
}
|
|
5326
6729
|
}
|
|
5327
|
-
function
|
|
6730
|
+
function functionHandlers(config) {
|
|
5328
6731
|
const { registry, signingKey, catalogInterface } = config;
|
|
5329
6732
|
async function stripAttach(attach, ctx) {
|
|
5330
6733
|
if (attach == null)
|
|
@@ -5343,26 +6746,20 @@ function registerFunctionMethods(protocol, config) {
|
|
|
5343
6746
|
}
|
|
5344
6747
|
return overloadContext({ ...bindCall, attach_opaque_data: attach }, catalogInterface);
|
|
5345
6748
|
}
|
|
5346
|
-
const initHeaderSchema = GLOBAL_INIT_RESPONSE_SCHEMA;
|
|
5347
6749
|
const emptySchema = schema2([]);
|
|
5348
6750
|
const dummyInputSchema = schema2([
|
|
5349
6751
|
field2("_tick", binary2(), true)
|
|
5350
6752
|
]);
|
|
5351
|
-
|
|
5352
|
-
params
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
return wrapResult(serialized, BindResultSchema);
|
|
5362
|
-
}
|
|
5363
|
-
});
|
|
5364
|
-
protocol.exchange("init", {
|
|
5365
|
-
params: InitParamsSchema,
|
|
6753
|
+
const bind = async (params, ctx) => {
|
|
6754
|
+
const innerParams = unwrapRequest(params.request);
|
|
6755
|
+
const request = deserializeBindRequest(innerParams);
|
|
6756
|
+
request.attach_opaque_data = await stripAttach(request.attach_opaque_data, ctx);
|
|
6757
|
+
const func = registry.get(request.function_name, overloadContext(request, catalogInterface));
|
|
6758
|
+
const response = await func.bind(request);
|
|
6759
|
+
const serialized = serializeBindResponse(response);
|
|
6760
|
+
return wrapResult(serialized, BindResultSchema);
|
|
6761
|
+
};
|
|
6762
|
+
const init = exchangeStream({
|
|
5366
6763
|
inputSchema: dummyInputSchema,
|
|
5367
6764
|
outputSchema: emptySchema,
|
|
5368
6765
|
init: async (params, ctx) => {
|
|
@@ -5455,7 +6852,6 @@ function registerFunctionMethods(protocol, config) {
|
|
|
5455
6852
|
}
|
|
5456
6853
|
state.filterHistory = handlerState?.filterHistory ?? null;
|
|
5457
6854
|
},
|
|
5458
|
-
headerSchema: initHeaderSchema,
|
|
5459
6855
|
headerInit: (params, state, ctx) => {
|
|
5460
6856
|
if (!state._initResponse) {
|
|
5461
6857
|
throw new Error("headerInit called on deserialized state: _initResponse not available");
|
|
@@ -5463,83 +6859,75 @@ function registerFunctionMethods(protocol, config) {
|
|
|
5463
6859
|
return serializeGlobalInitResponse(state._initResponse);
|
|
5464
6860
|
}
|
|
5465
6861
|
});
|
|
5466
|
-
|
|
5467
|
-
params
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
cardResult = serializeTableCardinality(await func.cardinality(request));
|
|
5476
|
-
} else {
|
|
5477
|
-
cardResult = { estimate: null, max: null };
|
|
5478
|
-
}
|
|
5479
|
-
return wrapResult(cardResult, TableFunctionCardinalityResultSchema);
|
|
5480
|
-
}
|
|
5481
|
-
});
|
|
5482
|
-
protocol.unary("table_function_plan", {
|
|
5483
|
-
params: TableFunctionPlanParamsSchema,
|
|
5484
|
-
result: RESULT_BINARY_SCHEMA,
|
|
5485
|
-
handler: async (params, ctx) => {
|
|
5486
|
-
const innerParams = unwrapRequest(params.request);
|
|
5487
|
-
const request = deserializePlanRequest(innerParams);
|
|
5488
|
-
const func = registry.get(request.bind_call.function_name, await strippedContext(request.bind_call));
|
|
5489
|
-
const plan = func.plan ? await func.plan(request) : { splits: [{ payload: new Uint8Array(0) }] };
|
|
5490
|
-
const fp = fingerprintInputs(toUint8Array(innerParams.bind_call));
|
|
5491
|
-
const fingerprint = await bindFingerprint(fp.schemaPath, fp.functionName, fp.args, fp.settings, new Uint8Array(0));
|
|
5492
|
-
const anchor = plan.catalogVersion != null ? splitAnchor(plan.catalogVersion) : await liveSplitAnchor(catalogInterface, request.bind_call, ctx?.auth, signingKey) ?? splitAnchor(0);
|
|
5493
|
-
const blobs = [];
|
|
5494
|
-
for (const split of plan.splits) {
|
|
5495
|
-
const token = await buildSplitToken({
|
|
5496
|
-
payload: split.payload,
|
|
5497
|
-
fingerprint,
|
|
5498
|
-
anchor,
|
|
5499
|
-
signingKey,
|
|
5500
|
-
auth: ctx?.auth
|
|
5501
|
-
});
|
|
5502
|
-
blobs.push(serializeBatch(batchFromColumns(Object.fromEntries(SCAN_SPLIT_SCHEMA.fields.map((f) => [
|
|
5503
|
-
f.name,
|
|
5504
|
-
[scanSplitRow(split, token)[f.name] ?? null]
|
|
5505
|
-
])), SCAN_SPLIT_SCHEMA)));
|
|
5506
|
-
}
|
|
5507
|
-
return wrapResult(planResponseRow(plan, blobs), PLAN_RESPONSE_SCHEMA);
|
|
5508
|
-
}
|
|
5509
|
-
});
|
|
5510
|
-
protocol.unary("table_function_statistics", {
|
|
5511
|
-
params: TableFunctionStatisticsParamsSchema,
|
|
5512
|
-
result: RESULT_BINARY_NULLABLE_SCHEMA,
|
|
5513
|
-
handler: async (params) => {
|
|
5514
|
-
const innerParams = unwrapRequest(params.request);
|
|
5515
|
-
const request = deserializeCardinalityRequest(innerParams);
|
|
5516
|
-
const func = registry.get(request.bind_call.function_name, await strippedContext(request.bind_call));
|
|
5517
|
-
if (!func.statistics)
|
|
5518
|
-
return { result: null };
|
|
5519
|
-
const stats = func.statistics(request);
|
|
5520
|
-
if (!stats || stats.length === 0)
|
|
5521
|
-
return { result: null };
|
|
5522
|
-
return { result: serializeColumnStatistics(stats) };
|
|
6862
|
+
const tableFunctionCardinality = async (params) => {
|
|
6863
|
+
const innerParams = unwrapRequest(params.request);
|
|
6864
|
+
const request = deserializeCardinalityRequest(innerParams);
|
|
6865
|
+
const func = registry.get(request.bind_call.function_name, await strippedContext(request.bind_call));
|
|
6866
|
+
let cardResult;
|
|
6867
|
+
if (func.cardinality) {
|
|
6868
|
+
cardResult = serializeTableCardinality(await func.cardinality(request));
|
|
6869
|
+
} else {
|
|
6870
|
+
cardResult = { estimate: null, max: null };
|
|
5523
6871
|
}
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
const
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
6872
|
+
return wrapResult(cardResult, TableFunctionCardinalityResultSchema);
|
|
6873
|
+
};
|
|
6874
|
+
const tableFunctionPlan = async (params, ctx) => {
|
|
6875
|
+
const innerParams = unwrapRequest(params.request);
|
|
6876
|
+
const request = deserializePlanRequest(innerParams);
|
|
6877
|
+
const func = registry.get(request.bind_call.function_name, await strippedContext(request.bind_call));
|
|
6878
|
+
const plan = func.plan ? await func.plan(request) : { splits: [{ payload: new Uint8Array(0) }] };
|
|
6879
|
+
const fp = fingerprintInputs(toUint8Array(innerParams.bind_call));
|
|
6880
|
+
const fingerprint = await bindFingerprint(fp.schemaPath, fp.functionName, fp.args, fp.settings, new Uint8Array(0));
|
|
6881
|
+
const anchor = plan.catalogVersion != null ? splitAnchor(plan.catalogVersion) : await liveSplitAnchor(catalogInterface, request.bind_call, ctx?.auth, signingKey) ?? splitAnchor(0);
|
|
6882
|
+
const blobs = [];
|
|
6883
|
+
for (const split of plan.splits) {
|
|
6884
|
+
const token = await buildSplitToken({
|
|
6885
|
+
payload: split.payload,
|
|
6886
|
+
fingerprint,
|
|
6887
|
+
anchor,
|
|
6888
|
+
signingKey,
|
|
6889
|
+
auth: ctx?.auth
|
|
6890
|
+
});
|
|
6891
|
+
blobs.push(serializeBatch(batchFromColumns(Object.fromEntries(SCAN_SPLIT_SCHEMA.fields.map((f) => [
|
|
6892
|
+
f.name,
|
|
6893
|
+
[scanSplitRow(split, token)[f.name] ?? null]
|
|
6894
|
+
])), SCAN_SPLIT_SCHEMA)));
|
|
5541
6895
|
}
|
|
5542
|
-
|
|
6896
|
+
return wrapResult(planResponseRow(plan, blobs), PLAN_RESPONSE_SCHEMA);
|
|
6897
|
+
};
|
|
6898
|
+
const tableFunctionStatistics = async (params) => {
|
|
6899
|
+
const innerParams = unwrapRequest(params.request);
|
|
6900
|
+
const request = deserializeCardinalityRequest(innerParams);
|
|
6901
|
+
const func = registry.get(request.bind_call.function_name, await strippedContext(request.bind_call));
|
|
6902
|
+
if (!func.statistics)
|
|
6903
|
+
return { result: null };
|
|
6904
|
+
const stats = func.statistics(request);
|
|
6905
|
+
if (!stats || stats.length === 0)
|
|
6906
|
+
return { result: null };
|
|
6907
|
+
return { result: serializeColumnStatistics(stats) };
|
|
6908
|
+
};
|
|
6909
|
+
const tableFunctionDynamicToString = async (params) => {
|
|
6910
|
+
const innerParams = unwrapRequest(params.request);
|
|
6911
|
+
const bindCallBytes = toUint8Array(innerParams.bind_call);
|
|
6912
|
+
const bindCallBatch = deserializeBatch(bindCallBytes);
|
|
6913
|
+
const bindParams = batchToScalarDict(bindCallBatch);
|
|
6914
|
+
const bindCall = deserializeBindRequest(bindParams);
|
|
6915
|
+
const globalExecutionId = toUint8Array(innerParams.global_execution_id);
|
|
6916
|
+
const bindOpaqueData = innerParams.bind_opaque_data ? toUint8Array(innerParams.bind_opaque_data) : null;
|
|
6917
|
+
const func = registry.get(bindCall.function_name, await strippedContext(bindCall));
|
|
6918
|
+
const map = func.dynamicToString ? await func.dynamicToString({ bindCall, bindOpaqueData, globalExecutionId }) : {};
|
|
6919
|
+
const keys = Object.keys(map);
|
|
6920
|
+
const values = keys.map((k) => map[k] ?? "");
|
|
6921
|
+
return wrapResult({ keys, values }, TableFunctionDynamicToStringResultSchema);
|
|
6922
|
+
};
|
|
6923
|
+
return {
|
|
6924
|
+
bind,
|
|
6925
|
+
init,
|
|
6926
|
+
tableFunctionCardinality,
|
|
6927
|
+
tableFunctionPlan,
|
|
6928
|
+
tableFunctionStatistics,
|
|
6929
|
+
tableFunctionDynamicToString
|
|
6930
|
+
};
|
|
5543
6931
|
}
|
|
5544
6932
|
|
|
5545
6933
|
// src/arguments/argument-spec.ts
|
|
@@ -5710,7 +7098,7 @@ function persistGroupStates(executionId, gids) {
|
|
|
5710
7098
|
}
|
|
5711
7099
|
|
|
5712
7100
|
// src/protocol/handlers/aggregate.ts
|
|
5713
|
-
function
|
|
7101
|
+
function aggregateHandlers(registry) {
|
|
5714
7102
|
function resolveAggregate(name, schemaPath) {
|
|
5715
7103
|
const func = registry.get(name, {
|
|
5716
7104
|
arguments: new Arguments,
|
|
@@ -5723,199 +7111,180 @@ function registerAggregateMethods(protocol, registry) {
|
|
|
5723
7111
|
}
|
|
5724
7112
|
return func.aggregateConfig;
|
|
5725
7113
|
}
|
|
5726
|
-
|
|
5727
|
-
params
|
|
5728
|
-
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
|
|
5749
|
-
|
|
5750
|
-
|
|
5751
|
-
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
|
|
5755
|
-
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
handler: (params) => {
|
|
5763
|
-
const innerParams = unwrapRequest(params.request);
|
|
5764
|
-
const functionName = innerParams.function_name;
|
|
5765
|
-
const executionId = toUint8Array(innerParams.execution_id);
|
|
5766
|
-
const cfg = resolveAggregate(functionName, innerParams.schema_path ?? null);
|
|
5767
|
-
const batch = readSingleBatch(toUint8Array(innerParams.input_batch));
|
|
5768
|
-
if (!batch || batch.numRows === 0)
|
|
5769
|
-
return wrapResult({}, schema2([]));
|
|
5770
|
-
const gidIdx = batch.schema.fields.findIndex((f) => f.name === GROUP_COLUMN_NAME);
|
|
5771
|
-
if (gidIdx < 0) {
|
|
5772
|
-
throw new Error(`aggregate_update: input batch missing ${GROUP_COLUMN_NAME} column`);
|
|
5773
|
-
}
|
|
5774
|
-
const gidCol = batch.getChildAt(gidIdx);
|
|
5775
|
-
const groupIds = [];
|
|
5776
|
-
const uniqueGids = new Set;
|
|
5777
|
-
for (let i = 0;i < batch.numRows; i++) {
|
|
5778
|
-
const v = gidCol.get(i);
|
|
5779
|
-
const g = typeof v === "bigint" ? v : BigInt(v);
|
|
5780
|
-
groupIds.push(g);
|
|
5781
|
-
uniqueGids.add(g);
|
|
5782
|
-
}
|
|
5783
|
-
const exec = getExecutionState(executionId, uniqueGids);
|
|
5784
|
-
if (!exec) {
|
|
5785
|
-
throw new Error(`aggregate_update: unknown execution_id for '${functionName}' (bind missing or state dropped)`);
|
|
5786
|
-
}
|
|
5787
|
-
const columns = [];
|
|
5788
|
-
for (let i = 0;i < batch.schema.fields.length; i++) {
|
|
5789
|
-
if (i === gidIdx)
|
|
5790
|
-
continue;
|
|
5791
|
-
columns.push(batch.getChildAt(i));
|
|
5792
|
-
}
|
|
5793
|
-
const ensureState = (gid) => {
|
|
5794
|
-
let s = exec.states.get(gid);
|
|
5795
|
-
if (s === undefined) {
|
|
5796
|
-
s = cfg.initialState(exec.bindParams);
|
|
5797
|
-
exec.states.set(gid, s);
|
|
5798
|
-
}
|
|
5799
|
-
return s;
|
|
5800
|
-
};
|
|
5801
|
-
cfg.update({
|
|
5802
|
-
states: exec.states,
|
|
5803
|
-
groupIds,
|
|
5804
|
-
columns,
|
|
5805
|
-
args: exec.bindParams.args,
|
|
5806
|
-
ensureState
|
|
5807
|
-
});
|
|
5808
|
-
persistGroupStates(executionId, uniqueGids);
|
|
7114
|
+
const aggregateBind = async (params) => {
|
|
7115
|
+
const innerParams = unwrapRequest(params.request);
|
|
7116
|
+
const functionName = innerParams.function_name;
|
|
7117
|
+
const cfg = resolveAggregate(functionName, innerParams.schema_path ?? null);
|
|
7118
|
+
const argBytes = toUint8Array(innerParams.arguments);
|
|
7119
|
+
const args = deserializeArguments(argBytes);
|
|
7120
|
+
const inputSchema = innerParams.input_schema ? deserializeSchema(toUint8Array(innerParams.input_schema)) : null;
|
|
7121
|
+
const secretsBytes = innerParams.secrets ? toUint8Array(innerParams.secrets) : null;
|
|
7122
|
+
const secretsBatch = secretsBytes && secretsBytes.length > 0 ? deserializeBatch(secretsBytes) : null;
|
|
7123
|
+
const secrets = secretsBatch ? batchToSecretDict(secretsBatch) : {};
|
|
7124
|
+
const bindParams = {
|
|
7125
|
+
args: extractArgMap(cfg, args),
|
|
7126
|
+
arguments: args,
|
|
7127
|
+
inputSchema,
|
|
7128
|
+
settings: {},
|
|
7129
|
+
secrets,
|
|
7130
|
+
argumentNames: innerParams.argument_names ? (Array.isArray(innerParams.argument_names) ? innerParams.argument_names : [...innerParams.argument_names]).map((value) => value == null ? null : String(value)) : null
|
|
7131
|
+
};
|
|
7132
|
+
const executionId = new Uint8Array(16);
|
|
7133
|
+
crypto.getRandomValues(executionId);
|
|
7134
|
+
setExecutionState(executionId, {
|
|
7135
|
+
states: new Map,
|
|
7136
|
+
bindArgs: args,
|
|
7137
|
+
bindParams
|
|
7138
|
+
});
|
|
7139
|
+
const outType = cfg.onBind ? await cfg.onBind(bindParams) : cfg.outputType;
|
|
7140
|
+
const outSchema = schema2([field2("result", outType, true)]);
|
|
7141
|
+
return wrapResult({ output_schema: serializeSchema(outSchema), execution_id: executionId }, AggregateBindResultSchema);
|
|
7142
|
+
};
|
|
7143
|
+
const aggregateUpdate = (params) => {
|
|
7144
|
+
const innerParams = unwrapRequest(params.request);
|
|
7145
|
+
const functionName = innerParams.function_name;
|
|
7146
|
+
const executionId = toUint8Array(innerParams.execution_id);
|
|
7147
|
+
const cfg = resolveAggregate(functionName, innerParams.schema_path ?? null);
|
|
7148
|
+
const batch = readSingleBatch(toUint8Array(innerParams.input_batch));
|
|
7149
|
+
if (!batch || batch.numRows === 0)
|
|
5809
7150
|
return wrapResult({}, schema2([]));
|
|
7151
|
+
const gidIdx = batch.schema.fields.findIndex((f) => f.name === GROUP_COLUMN_NAME);
|
|
7152
|
+
if (gidIdx < 0) {
|
|
7153
|
+
throw new Error(`aggregate_update: input batch missing ${GROUP_COLUMN_NAME} column`);
|
|
7154
|
+
}
|
|
7155
|
+
const gidCol = batch.getChildAt(gidIdx);
|
|
7156
|
+
const groupIds = [];
|
|
7157
|
+
const uniqueGids = new Set;
|
|
7158
|
+
for (let i = 0;i < batch.numRows; i++) {
|
|
7159
|
+
const v = gidCol.get(i);
|
|
7160
|
+
const g = typeof v === "bigint" ? v : BigInt(v);
|
|
7161
|
+
groupIds.push(g);
|
|
7162
|
+
uniqueGids.add(g);
|
|
7163
|
+
}
|
|
7164
|
+
const exec = getExecutionState(executionId, uniqueGids);
|
|
7165
|
+
if (!exec) {
|
|
7166
|
+
throw new Error(`aggregate_update: unknown execution_id for '${functionName}' (bind missing or state dropped)`);
|
|
7167
|
+
}
|
|
7168
|
+
const columns = [];
|
|
7169
|
+
for (let i = 0;i < batch.schema.fields.length; i++) {
|
|
7170
|
+
if (i === gidIdx)
|
|
7171
|
+
continue;
|
|
7172
|
+
columns.push(batch.getChildAt(i));
|
|
5810
7173
|
}
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
|
|
5816
|
-
const innerParams = unwrapRequest(params.request);
|
|
5817
|
-
const functionName = innerParams.function_name;
|
|
5818
|
-
const executionId = toUint8Array(innerParams.execution_id);
|
|
5819
|
-
const cfg = resolveAggregate(functionName, innerParams.schema_path ?? null);
|
|
5820
|
-
const batch = readSingleBatch(toUint8Array(innerParams.merge_batch));
|
|
5821
|
-
if (!batch || batch.numRows === 0)
|
|
5822
|
-
return wrapResult({}, schema2([]));
|
|
5823
|
-
const srcCol = batch.getChild("source_group_id");
|
|
5824
|
-
const tgtCol = batch.getChild("target_group_id");
|
|
5825
|
-
const referencedGids = new Set;
|
|
5826
|
-
const srcIds = [];
|
|
5827
|
-
const tgtIds = [];
|
|
5828
|
-
for (let i = 0;i < batch.numRows; i++) {
|
|
5829
|
-
const src = BigInt(srcCol.get(i));
|
|
5830
|
-
const tgt = BigInt(tgtCol.get(i));
|
|
5831
|
-
srcIds.push(src);
|
|
5832
|
-
tgtIds.push(tgt);
|
|
5833
|
-
referencedGids.add(src);
|
|
5834
|
-
referencedGids.add(tgt);
|
|
5835
|
-
}
|
|
5836
|
-
const exec = getExecutionState(executionId, referencedGids);
|
|
5837
|
-
if (!exec) {
|
|
5838
|
-
throw new Error(`aggregate_combine: unknown execution_id for '${functionName}' ` + `(context missing on disk \u2014 bind may have failed or been cleaned up)`);
|
|
5839
|
-
}
|
|
5840
|
-
const touchedTargets = new Set;
|
|
5841
|
-
for (let i = 0;i < batch.numRows; i++) {
|
|
5842
|
-
const src = srcIds[i];
|
|
5843
|
-
const tgt = tgtIds[i];
|
|
5844
|
-
const srcHas = exec.states.has(src);
|
|
5845
|
-
const tgtHas = exec.states.has(tgt);
|
|
5846
|
-
if (!srcHas && !tgtHas)
|
|
5847
|
-
continue;
|
|
5848
|
-
const srcState = srcHas ? exec.states.get(src) : cfg.initialState(exec.bindParams);
|
|
5849
|
-
const tgtState = tgtHas ? exec.states.get(tgt) : cfg.initialState(exec.bindParams);
|
|
5850
|
-
exec.states.set(tgt, cfg.combine(srcState, tgtState, exec.bindParams));
|
|
5851
|
-
touchedTargets.add(tgt);
|
|
7174
|
+
const ensureState = (gid) => {
|
|
7175
|
+
let s = exec.states.get(gid);
|
|
7176
|
+
if (s === undefined) {
|
|
7177
|
+
s = cfg.initialState(exec.bindParams);
|
|
7178
|
+
exec.states.set(gid, s);
|
|
5852
7179
|
}
|
|
5853
|
-
|
|
7180
|
+
return s;
|
|
7181
|
+
};
|
|
7182
|
+
cfg.update({
|
|
7183
|
+
states: exec.states,
|
|
7184
|
+
groupIds,
|
|
7185
|
+
columns,
|
|
7186
|
+
args: exec.bindParams.args,
|
|
7187
|
+
ensureState
|
|
7188
|
+
});
|
|
7189
|
+
persistGroupStates(executionId, uniqueGids);
|
|
7190
|
+
return wrapResult({}, schema2([]));
|
|
7191
|
+
};
|
|
7192
|
+
const aggregateCombine = (params) => {
|
|
7193
|
+
const innerParams = unwrapRequest(params.request);
|
|
7194
|
+
const functionName = innerParams.function_name;
|
|
7195
|
+
const executionId = toUint8Array(innerParams.execution_id);
|
|
7196
|
+
const cfg = resolveAggregate(functionName, innerParams.schema_path ?? null);
|
|
7197
|
+
const batch = readSingleBatch(toUint8Array(innerParams.merge_batch));
|
|
7198
|
+
if (!batch || batch.numRows === 0)
|
|
5854
7199
|
return wrapResult({}, schema2([]));
|
|
7200
|
+
const srcCol = batch.getChild("source_group_id");
|
|
7201
|
+
const tgtCol = batch.getChild("target_group_id");
|
|
7202
|
+
const referencedGids = new Set;
|
|
7203
|
+
const srcIds = [];
|
|
7204
|
+
const tgtIds = [];
|
|
7205
|
+
for (let i = 0;i < batch.numRows; i++) {
|
|
7206
|
+
const src = BigInt(srcCol.get(i));
|
|
7207
|
+
const tgt = BigInt(tgtCol.get(i));
|
|
7208
|
+
srcIds.push(src);
|
|
7209
|
+
tgtIds.push(tgt);
|
|
7210
|
+
referencedGids.add(src);
|
|
7211
|
+
referencedGids.add(tgt);
|
|
7212
|
+
}
|
|
7213
|
+
const exec = getExecutionState(executionId, referencedGids);
|
|
7214
|
+
if (!exec) {
|
|
7215
|
+
throw new Error(`aggregate_combine: unknown execution_id for '${functionName}' ` + `(context missing on disk \u2014 bind may have failed or been cleaned up)`);
|
|
7216
|
+
}
|
|
7217
|
+
const touchedTargets = new Set;
|
|
7218
|
+
for (let i = 0;i < batch.numRows; i++) {
|
|
7219
|
+
const src = srcIds[i];
|
|
7220
|
+
const tgt = tgtIds[i];
|
|
7221
|
+
const srcHas = exec.states.has(src);
|
|
7222
|
+
const tgtHas = exec.states.has(tgt);
|
|
7223
|
+
if (!srcHas && !tgtHas)
|
|
7224
|
+
continue;
|
|
7225
|
+
const srcState = srcHas ? exec.states.get(src) : cfg.initialState(exec.bindParams);
|
|
7226
|
+
const tgtState = tgtHas ? exec.states.get(tgt) : cfg.initialState(exec.bindParams);
|
|
7227
|
+
exec.states.set(tgt, cfg.combine(srcState, tgtState, exec.bindParams));
|
|
7228
|
+
touchedTargets.add(tgt);
|
|
5855
7229
|
}
|
|
5856
|
-
|
|
5857
|
-
|
|
5858
|
-
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
|
|
5862
|
-
|
|
5863
|
-
|
|
5864
|
-
|
|
5865
|
-
|
|
5866
|
-
|
|
5867
|
-
|
|
5868
|
-
|
|
5869
|
-
if (gidBatch) {
|
|
5870
|
-
const col = gidBatch.getChild("group_id");
|
|
5871
|
-
for (let i = 0;i < gidBatch.numRows; i++) {
|
|
5872
|
-
const v = col.get(i);
|
|
5873
|
-
const g = typeof v === "bigint" ? v : BigInt(v);
|
|
5874
|
-
groupIds.push(g);
|
|
5875
|
-
uniqueGids.add(g);
|
|
5876
|
-
}
|
|
5877
|
-
}
|
|
5878
|
-
const exec = getExecutionState(executionId, uniqueGids);
|
|
5879
|
-
if (!exec) {
|
|
5880
|
-
throw new Error(`aggregate_finalize: unknown execution_id for '${functionName}'`);
|
|
5881
|
-
}
|
|
5882
|
-
const states = new Map;
|
|
5883
|
-
for (const gid of groupIds) {
|
|
5884
|
-
states.set(gid, exec.states.has(gid) ? exec.states.get(gid) : null);
|
|
5885
|
-
}
|
|
5886
|
-
const resultBatch = cfg.finalize({
|
|
5887
|
-
groupIds,
|
|
5888
|
-
states,
|
|
5889
|
-
outputSchema,
|
|
5890
|
-
args: exec.bindParams.args
|
|
5891
|
-
});
|
|
5892
|
-
return wrapResult({ result_batch: serializeBatchWithSchema(resultBatch) }, AggregateFinalizeResultSchema);
|
|
5893
|
-
}
|
|
5894
|
-
});
|
|
5895
|
-
protocol.unary("aggregate_destructor", {
|
|
5896
|
-
params: AggregateDestructorParamsSchema,
|
|
5897
|
-
result: RESULT_BINARY_SCHEMA,
|
|
5898
|
-
handler: (params) => {
|
|
5899
|
-
const innerParams = unwrapRequest(params.request);
|
|
5900
|
-
const executionId = toUint8Array(innerParams.execution_id);
|
|
5901
|
-
const exec = getExecutionState(executionId);
|
|
5902
|
-
if (!exec)
|
|
5903
|
-
return wrapResult({}, schema2([]));
|
|
5904
|
-
const gidBatch = readSingleBatch(toUint8Array(innerParams.group_ids_batch));
|
|
5905
|
-
if (!gidBatch || gidBatch.numRows === 0)
|
|
5906
|
-
return wrapResult({}, schema2([]));
|
|
7230
|
+
persistGroupStates(executionId, touchedTargets);
|
|
7231
|
+
return wrapResult({}, schema2([]));
|
|
7232
|
+
};
|
|
7233
|
+
const aggregateFinalize = (params) => {
|
|
7234
|
+
const innerParams = unwrapRequest(params.request);
|
|
7235
|
+
const functionName = innerParams.function_name;
|
|
7236
|
+
const executionId = toUint8Array(innerParams.execution_id);
|
|
7237
|
+
const cfg = resolveAggregate(functionName, innerParams.schema_path ?? null);
|
|
7238
|
+
const outputSchema = deserializeSchema(toUint8Array(innerParams.output_schema));
|
|
7239
|
+
const gidBatch = readSingleBatch(toUint8Array(innerParams.group_ids_batch));
|
|
7240
|
+
const groupIds = [];
|
|
7241
|
+
const uniqueGids = new Set;
|
|
7242
|
+
if (gidBatch) {
|
|
5907
7243
|
const col = gidBatch.getChild("group_id");
|
|
5908
|
-
const toDrop = new Set;
|
|
5909
7244
|
for (let i = 0;i < gidBatch.numRows; i++) {
|
|
5910
7245
|
const v = col.get(i);
|
|
5911
7246
|
const g = typeof v === "bigint" ? v : BigInt(v);
|
|
5912
|
-
|
|
5913
|
-
|
|
7247
|
+
groupIds.push(g);
|
|
7248
|
+
uniqueGids.add(g);
|
|
5914
7249
|
}
|
|
5915
|
-
persistGroupStates(executionId, toDrop);
|
|
5916
|
-
return wrapResult({}, schema2([]));
|
|
5917
7250
|
}
|
|
5918
|
-
|
|
7251
|
+
const exec = getExecutionState(executionId, uniqueGids);
|
|
7252
|
+
if (!exec) {
|
|
7253
|
+
throw new Error(`aggregate_finalize: unknown execution_id for '${functionName}'`);
|
|
7254
|
+
}
|
|
7255
|
+
const states = new Map;
|
|
7256
|
+
for (const gid of groupIds) {
|
|
7257
|
+
states.set(gid, exec.states.has(gid) ? exec.states.get(gid) : null);
|
|
7258
|
+
}
|
|
7259
|
+
const resultBatch = cfg.finalize({
|
|
7260
|
+
groupIds,
|
|
7261
|
+
states,
|
|
7262
|
+
outputSchema,
|
|
7263
|
+
args: exec.bindParams.args
|
|
7264
|
+
});
|
|
7265
|
+
return wrapResult({ result_batch: serializeBatchWithSchema(resultBatch) }, AggregateFinalizeResultSchema);
|
|
7266
|
+
};
|
|
7267
|
+
const aggregateDestructor = (params) => {
|
|
7268
|
+
const innerParams = unwrapRequest(params.request);
|
|
7269
|
+
const executionId = toUint8Array(innerParams.execution_id);
|
|
7270
|
+
const exec = getExecutionState(executionId);
|
|
7271
|
+
if (!exec)
|
|
7272
|
+
return wrapResult({}, schema2([]));
|
|
7273
|
+
const gidBatch = readSingleBatch(toUint8Array(innerParams.group_ids_batch));
|
|
7274
|
+
if (!gidBatch || gidBatch.numRows === 0)
|
|
7275
|
+
return wrapResult({}, schema2([]));
|
|
7276
|
+
const col = gidBatch.getChild("group_id");
|
|
7277
|
+
const toDrop = new Set;
|
|
7278
|
+
for (let i = 0;i < gidBatch.numRows; i++) {
|
|
7279
|
+
const v = col.get(i);
|
|
7280
|
+
const g = typeof v === "bigint" ? v : BigInt(v);
|
|
7281
|
+
exec.states.delete(g);
|
|
7282
|
+
toDrop.add(g);
|
|
7283
|
+
}
|
|
7284
|
+
persistGroupStates(executionId, toDrop);
|
|
7285
|
+
return wrapResult({}, schema2([]));
|
|
7286
|
+
};
|
|
7287
|
+
return { aggregateBind, aggregateUpdate, aggregateCombine, aggregateFinalize, aggregateDestructor };
|
|
5919
7288
|
}
|
|
5920
7289
|
function extractArgMap(cfg, args) {
|
|
5921
7290
|
const out = {};
|
|
@@ -6006,7 +7375,7 @@ function splitLenPrefixed(buf, count) {
|
|
|
6006
7375
|
}
|
|
6007
7376
|
|
|
6008
7377
|
// src/protocol/handlers/table-buffering.ts
|
|
6009
|
-
function
|
|
7378
|
+
function tableBufferingHandlers(registry, signingKey) {
|
|
6010
7379
|
function resolveBuffering(name, schemaPath) {
|
|
6011
7380
|
const func = registry.get(name, {
|
|
6012
7381
|
arguments: new Arguments,
|
|
@@ -6051,55 +7420,44 @@ function registerTableBufferingMethods(protocol, registry, signingKey) {
|
|
|
6051
7420
|
};
|
|
6052
7421
|
return { func, params };
|
|
6053
7422
|
}
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
const { func, params } = await loadParams(inner, clientLog, ctx);
|
|
6061
|
-
if (inner.batch_index != null) {
|
|
6062
|
-
params.batchIndex = Number(inner.batch_index);
|
|
6063
|
-
}
|
|
6064
|
-
const batch = deserializeBatch(toUint8Array(inner.input_batch));
|
|
6065
|
-
const stateId = await func.bufferingConfig.process(batch, params);
|
|
6066
|
-
if (!(stateId instanceof Uint8Array)) {
|
|
6067
|
-
throw new Error(`${func.meta.name}.process() must return Uint8Array (the opaque state_id)`);
|
|
6068
|
-
}
|
|
6069
|
-
return wrapResult({ state_id: stateId }, TableBufferingProcessResultSchema);
|
|
7423
|
+
const tableBufferingProcess = async (rpcParams, ctx) => {
|
|
7424
|
+
const inner = unwrapRequest(rpcParams.request);
|
|
7425
|
+
const clientLog = makeClientLog(ctx);
|
|
7426
|
+
const { func, params } = await loadParams(inner, clientLog, ctx);
|
|
7427
|
+
if (inner.batch_index != null) {
|
|
7428
|
+
params.batchIndex = Number(inner.batch_index);
|
|
6070
7429
|
}
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
handler: async (rpcParams, ctx) => {
|
|
6076
|
-
const inner = unwrapRequest(rpcParams.request);
|
|
6077
|
-
const clientLog = makeClientLog(ctx);
|
|
6078
|
-
const { func, params } = await loadParams(inner, clientLog, ctx);
|
|
6079
|
-
const stateIds = decodeBytesList(inner.state_ids);
|
|
6080
|
-
const finalizeStateIds = await func.bufferingConfig.combine(stateIds, params);
|
|
6081
|
-
const out = finalizeStateIds.map((fid, i) => {
|
|
6082
|
-
if (!(fid instanceof Uint8Array)) {
|
|
6083
|
-
throw new Error(`${func.meta.name}.combine() returned non-Uint8Array finalize_state_id at index ${i}`);
|
|
6084
|
-
}
|
|
6085
|
-
return fid;
|
|
6086
|
-
});
|
|
6087
|
-
return wrapResult({ finalize_state_ids: out }, TableBufferingCombineResultSchema);
|
|
6088
|
-
}
|
|
6089
|
-
});
|
|
6090
|
-
protocol.unary("table_buffering_destructor", {
|
|
6091
|
-
params: TableBufferingDestructorParamsSchema,
|
|
6092
|
-
result: RESULT_BINARY_SCHEMA,
|
|
6093
|
-
handler: async (rpcParams) => {
|
|
6094
|
-
try {
|
|
6095
|
-
const inner = unwrapRequest(rpcParams.request);
|
|
6096
|
-
const executionId = toUint8Array(inner.execution_id);
|
|
6097
|
-
const bound = new BoundStorage(storage, executionId);
|
|
6098
|
-
await bound.executionClear();
|
|
6099
|
-
} catch {}
|
|
6100
|
-
return wrapResult({}, TableBufferingDestructorResultSchema);
|
|
7430
|
+
const batch = deserializeBatch(toUint8Array(inner.input_batch));
|
|
7431
|
+
const stateId = await func.bufferingConfig.process(batch, params);
|
|
7432
|
+
if (!(stateId instanceof Uint8Array)) {
|
|
7433
|
+
throw new Error(`${func.meta.name}.process() must return Uint8Array (the opaque state_id)`);
|
|
6101
7434
|
}
|
|
6102
|
-
|
|
7435
|
+
return wrapResult({ state_id: stateId }, TableBufferingProcessResultSchema);
|
|
7436
|
+
};
|
|
7437
|
+
const tableBufferingCombine = async (rpcParams, ctx) => {
|
|
7438
|
+
const inner = unwrapRequest(rpcParams.request);
|
|
7439
|
+
const clientLog = makeClientLog(ctx);
|
|
7440
|
+
const { func, params } = await loadParams(inner, clientLog, ctx);
|
|
7441
|
+
const stateIds = decodeBytesList(inner.state_ids);
|
|
7442
|
+
const finalizeStateIds = await func.bufferingConfig.combine(stateIds, params);
|
|
7443
|
+
const out = finalizeStateIds.map((fid, i) => {
|
|
7444
|
+
if (!(fid instanceof Uint8Array)) {
|
|
7445
|
+
throw new Error(`${func.meta.name}.combine() returned non-Uint8Array finalize_state_id at index ${i}`);
|
|
7446
|
+
}
|
|
7447
|
+
return fid;
|
|
7448
|
+
});
|
|
7449
|
+
return wrapResult({ finalize_state_ids: out }, TableBufferingCombineResultSchema);
|
|
7450
|
+
};
|
|
7451
|
+
const tableBufferingDestructor = async (rpcParams) => {
|
|
7452
|
+
try {
|
|
7453
|
+
const inner = unwrapRequest(rpcParams.request);
|
|
7454
|
+
const executionId = toUint8Array(inner.execution_id);
|
|
7455
|
+
const bound = new BoundStorage(storage, executionId);
|
|
7456
|
+
await bound.executionClear();
|
|
7457
|
+
} catch {}
|
|
7458
|
+
return wrapResult({}, TableBufferingDestructorResultSchema);
|
|
7459
|
+
};
|
|
7460
|
+
return { tableBufferingProcess, tableBufferingCombine, tableBufferingDestructor };
|
|
6103
7461
|
}
|
|
6104
7462
|
function makeClientLog(ctx) {
|
|
6105
7463
|
if (ctx && typeof ctx.clientLog === "function") {
|
|
@@ -6125,7 +7483,7 @@ function hex(buf) {
|
|
|
6125
7483
|
|
|
6126
7484
|
// src/codec/asd.ts
|
|
6127
7485
|
function encodeASD(schema, obj) {
|
|
6128
|
-
return serializeBatch(batchFromRows([sortMapsForSchema(schema, obj)], schema));
|
|
7486
|
+
return serializeBatch(batchFromRows([sortMapsForSchema(schema, conformRecord(schema, obj))], schema));
|
|
6129
7487
|
}
|
|
6130
7488
|
function compareCodePoints(a, b) {
|
|
6131
7489
|
const n = Math.min(a.length, b.length);
|
|
@@ -6142,7 +7500,7 @@ function compareCodePoints(a, b) {
|
|
|
6142
7500
|
}
|
|
6143
7501
|
return a.length - b.length;
|
|
6144
7502
|
}
|
|
6145
|
-
function
|
|
7503
|
+
function mapPairs2(raw) {
|
|
6146
7504
|
if (Array.isArray(raw))
|
|
6147
7505
|
return raw.map((e) => Array.isArray(e) ? [e[0], e[1]] : [e?.key, e?.value]);
|
|
6148
7506
|
if (raw instanceof Map)
|
|
@@ -6177,7 +7535,7 @@ function sortMapsForType(type, value) {
|
|
|
6177
7535
|
if (isMap(type)) {
|
|
6178
7536
|
const entries = type.children[0].type;
|
|
6179
7537
|
const valueType = entries.children[1].type;
|
|
6180
|
-
return
|
|
7538
|
+
return mapPairs2(value).map(([k, v]) => [k, sortMapsForType(valueType, v)]).sort((x, y) => compareKeys(x[0], y[0]));
|
|
6181
7539
|
}
|
|
6182
7540
|
if (isList(type)) {
|
|
6183
7541
|
const child = type.children[0].type;
|
|
@@ -6415,7 +7773,7 @@ var encodeCopyFromFormatInfo = (v) => encodeASD(CopyFromFormatInfoSchema, {
|
|
|
6415
7773
|
|
|
6416
7774
|
// src/attach-ticket.ts
|
|
6417
7775
|
import {
|
|
6418
|
-
Protocol,
|
|
7776
|
+
Protocol as Protocol2,
|
|
6419
7777
|
badRequest,
|
|
6420
7778
|
errorInfo,
|
|
6421
7779
|
preconditionFailure
|
|
@@ -6505,7 +7863,7 @@ async function checkReservedAttachOptions(catalog) {
|
|
|
6505
7863
|
var ATTACH_TICKET_PREFIX = "vgia1.";
|
|
6506
7864
|
var ATTACH_TICKET_OPTION = RESERVED_ATTACH_OPTION;
|
|
6507
7865
|
var ATTACH_TICKETS_PROTOCOL_NAME = "vgi.attach_tickets.v1";
|
|
6508
|
-
var ATTACH_TICKETS_PROTOCOL_VERSION = "
|
|
7866
|
+
var ATTACH_TICKETS_PROTOCOL_VERSION = "2.0.0";
|
|
6509
7867
|
var TICKET_ENVELOPE_VERSION = 1;
|
|
6510
7868
|
var MAX_OPTIONS_BYTES = 16 * 1024;
|
|
6511
7869
|
var MAX_TICKET_CHARS = 32 * 1024;
|
|
@@ -6780,8 +8138,19 @@ var SEAL_ATTACH_REQUEST_SCHEMA = schema2([
|
|
|
6780
8138
|
]);
|
|
6781
8139
|
var ATTACH_TICKET_SCHEMA = schema2([
|
|
6782
8140
|
field2("ticket", utf82(), false),
|
|
6783
|
-
field2("expires_at",
|
|
8141
|
+
field2("expires_at", timestamp2(TimeUnit2.MICROSECOND, "UTC"), true)
|
|
6784
8142
|
]);
|
|
8143
|
+
function expiresAtMicros(value) {
|
|
8144
|
+
if (value === null)
|
|
8145
|
+
return null;
|
|
8146
|
+
const ms = value.getTime();
|
|
8147
|
+
if (!Number.isFinite(ms))
|
|
8148
|
+
throw new TypeError("AttachTicket.expires_at must be a valid Date or null");
|
|
8149
|
+
return BigInt(ms) * 1000n;
|
|
8150
|
+
}
|
|
8151
|
+
function encodeAttachTicket(ticket) {
|
|
8152
|
+
return serializeBatch(batchFromColumns({ ticket: [ticket.ticket], expires_at: [expiresAtMicros(ticket.expires_at)] }, ATTACH_TICKET_SCHEMA));
|
|
8153
|
+
}
|
|
6785
8154
|
function resolveTicketMaxTtl(grantKeys, env) {
|
|
6786
8155
|
if (grantKeys)
|
|
6787
8156
|
return Math.trunc(grantKeys.maxTtlSeconds);
|
|
@@ -6868,10 +8237,10 @@ async function sealAttach2(config, request, auth) {
|
|
|
6868
8237
|
} catch (e) {
|
|
6869
8238
|
throw new AttachTicketRequestError("seal_attach request is invalid", [["request", e.message]]);
|
|
6870
8239
|
}
|
|
6871
|
-
return { ticket: token, expires_at: expiresAt === 0 ?
|
|
8240
|
+
return { ticket: token, expires_at: expiresAt === 0 ? null : new Date(expiresAt * 1000) };
|
|
6872
8241
|
}
|
|
6873
8242
|
function buildAttachTicketsProtocol(config) {
|
|
6874
|
-
const p = new
|
|
8243
|
+
const p = new Protocol2(ATTACH_TICKETS_PROTOCOL_NAME, { protocolVersion: ATTACH_TICKETS_PROTOCOL_VERSION });
|
|
6875
8244
|
p.unary("seal_attach", {
|
|
6876
8245
|
params: REQUEST_PARAMS_SCHEMA,
|
|
6877
8246
|
result: RESULT_BINARY_SCHEMA,
|
|
@@ -6879,544 +8248,376 @@ function buildAttachTicketsProtocol(config) {
|
|
|
6879
8248
|
handler: async (params, ctx) => {
|
|
6880
8249
|
const request = unwrapRequest(params.request);
|
|
6881
8250
|
const sealed = await sealAttach2(config, request, ctx?.auth);
|
|
6882
|
-
|
|
6883
|
-
return { result: serializeBatch(batch) };
|
|
8251
|
+
return { result: encodeAttachTicket(sealed) };
|
|
6884
8252
|
}
|
|
6885
8253
|
});
|
|
6886
8254
|
return p;
|
|
6887
8255
|
}
|
|
6888
8256
|
|
|
6889
8257
|
// src/protocol/handlers/catalog/admin.ts
|
|
6890
|
-
function
|
|
6891
|
-
|
|
6892
|
-
|
|
6893
|
-
|
|
6894
|
-
|
|
6895
|
-
|
|
6896
|
-
|
|
6897
|
-
|
|
6898
|
-
|
|
6899
|
-
|
|
6900
|
-
|
|
6901
|
-
|
|
6902
|
-
}));
|
|
6903
|
-
const items = infos.map((info) => encodeCatalogInfo(info));
|
|
6904
|
-
return wrapResult({ items }, CatalogCatalogsResultSchema);
|
|
6905
|
-
}
|
|
6906
|
-
});
|
|
6907
|
-
protocol.unary("catalog_attach", {
|
|
6908
|
-
params: CatalogAttachParamsSchema,
|
|
6909
|
-
result: RESULT_BINARY_SCHEMA,
|
|
6910
|
-
handler: async (params, ctx) => {
|
|
6911
|
-
const innerParams = unwrapRequest(params.request);
|
|
6912
|
-
const cat = getCatalog();
|
|
6913
|
-
let optionsDict = decodeOptionsBatch(innerParams.options);
|
|
6914
|
-
const restored = await redeemAttachTicket(optionsDict, signingKey, ctx?.auth ?? currentRequestAuth());
|
|
6915
|
-
if (restored !== null) {
|
|
6916
|
-
innerParams.name = restored.name;
|
|
6917
|
-
innerParams.options = restored.optionsIpc;
|
|
6918
|
-
innerParams.data_version_spec = restored.dataVersionSpec;
|
|
6919
|
-
innerParams.implementation_version = restored.implementationVersion;
|
|
6920
|
-
optionsDict = restored.options;
|
|
6921
|
-
}
|
|
6922
|
-
const result = await cat.attach(innerParams.name, optionsDict, innerParams.data_version_spec ?? null, innerParams.implementation_version ?? null);
|
|
6923
|
-
const sealedAttach = await sealAttach(toUint8Array(result.attach_opaque_data), ctx?.auth, signingKey);
|
|
6924
|
-
return wrapResult(buildCatalogAttachResult({
|
|
6925
|
-
...result,
|
|
6926
|
-
attach_opaque_data: sealedAttach,
|
|
6927
|
-
supports_column_statistics: result.supports_column_statistics ?? true
|
|
6928
|
-
}), CatalogAttachResultSchema);
|
|
6929
|
-
}
|
|
6930
|
-
});
|
|
6931
|
-
catalogUnary(protocol, signingKey, "catalog_detach", {
|
|
6932
|
-
params: CatalogDetachParamsSchema,
|
|
6933
|
-
result: emptyResultSchema,
|
|
6934
|
-
handler: async (params) => {
|
|
6935
|
-
const cat = getCatalog();
|
|
6936
|
-
await cat.detach(toUint8Array(params.attach_opaque_data));
|
|
6937
|
-
return {};
|
|
6938
|
-
}
|
|
8258
|
+
function catalogAdminHandlers(getCatalog, signingKey) {
|
|
8259
|
+
const catalogCatalogs = catalogHandler(signingKey, async () => {
|
|
8260
|
+
const cat = getCatalog();
|
|
8261
|
+
const infos = cat.catalogsInfo ? await cat.catalogsInfo() : cat.catalogs().map((name) => ({
|
|
8262
|
+
name,
|
|
8263
|
+
implementation_version: null,
|
|
8264
|
+
data_version_spec: null,
|
|
8265
|
+
attach_option_specs: [],
|
|
8266
|
+
releases: []
|
|
8267
|
+
}));
|
|
8268
|
+
const items = infos.map((info) => encodeCatalogInfo(info));
|
|
8269
|
+
return wrapResult({ items }, CatalogCatalogsResultSchema);
|
|
6939
8270
|
});
|
|
6940
|
-
|
|
6941
|
-
params
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
|
|
6946
|
-
|
|
6947
|
-
|
|
8271
|
+
const catalogAttach = async (params, ctx) => {
|
|
8272
|
+
const innerParams = unwrapRequest(params.request);
|
|
8273
|
+
const cat = getCatalog();
|
|
8274
|
+
let optionsDict = decodeOptionsBatch(innerParams.options);
|
|
8275
|
+
const restored = await redeemAttachTicket(optionsDict, signingKey, ctx?.auth ?? currentRequestAuth());
|
|
8276
|
+
if (restored !== null) {
|
|
8277
|
+
innerParams.name = restored.name;
|
|
8278
|
+
innerParams.options = restored.optionsIpc;
|
|
8279
|
+
innerParams.data_version_spec = restored.dataVersionSpec;
|
|
8280
|
+
innerParams.implementation_version = restored.implementationVersion;
|
|
8281
|
+
optionsDict = restored.options;
|
|
8282
|
+
}
|
|
8283
|
+
const result = await cat.attach(innerParams.name, optionsDict, innerParams.data_version_spec ?? null, innerParams.implementation_version ?? null);
|
|
8284
|
+
const sealedAttach = await sealAttach(toUint8Array(result.attach_opaque_data), ctx?.auth, signingKey);
|
|
8285
|
+
return wrapResult(buildCatalogAttachResult({
|
|
8286
|
+
...result,
|
|
8287
|
+
attach_opaque_data: sealedAttach,
|
|
8288
|
+
supports_column_statistics: result.supports_column_statistics ?? true
|
|
8289
|
+
}), CatalogAttachResultSchema);
|
|
8290
|
+
};
|
|
8291
|
+
const catalogDetach = catalogHandler(signingKey, async (params) => {
|
|
8292
|
+
const cat = getCatalog();
|
|
8293
|
+
await cat.detach(toUint8Array(params.attach_opaque_data));
|
|
8294
|
+
return {};
|
|
6948
8295
|
});
|
|
6949
|
-
|
|
6950
|
-
|
|
6951
|
-
|
|
6952
|
-
|
|
6953
|
-
const cat = getCatalog();
|
|
6954
|
-
await cat.drop(params.name);
|
|
6955
|
-
return {};
|
|
6956
|
-
}
|
|
8296
|
+
const catalogCreate = catalogHandler(signingKey, async (params) => {
|
|
8297
|
+
const cat = getCatalog();
|
|
8298
|
+
await cat.create(params.name, params.on_conflict, params.options);
|
|
8299
|
+
return {};
|
|
6957
8300
|
});
|
|
6958
|
-
|
|
6959
|
-
|
|
6960
|
-
|
|
6961
|
-
|
|
6962
|
-
const cat = getCatalog();
|
|
6963
|
-
const version = await cat.version(toUint8Array(params.attach_opaque_data), params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
6964
|
-
return wrapResult({ version }, CatalogVersionResultSchema);
|
|
6965
|
-
}
|
|
8301
|
+
const catalogDrop = catalogHandler(signingKey, async (params) => {
|
|
8302
|
+
const cat = getCatalog();
|
|
8303
|
+
await cat.drop(params.name);
|
|
8304
|
+
return {};
|
|
6966
8305
|
});
|
|
6967
|
-
|
|
6968
|
-
|
|
6969
|
-
|
|
6970
|
-
|
|
6971
|
-
const auth = ctx?.auth;
|
|
6972
|
-
const sealedAttach = params.attach_opaque_data != null ? toUint8Array(params.attach_opaque_data) : new Uint8Array(0);
|
|
6973
|
-
const attachPlain = await openAttach(sealedAttach, auth, signingKey);
|
|
6974
|
-
const cat = getCatalog();
|
|
6975
|
-
const txPlain = await cat.transactionBegin(attachPlain);
|
|
6976
|
-
const transaction_opaque_data = txPlain != null ? await sealTransaction(toUint8Array(txPlain), sealedAttach, auth, signingKey) : null;
|
|
6977
|
-
return wrapResult({ transaction_opaque_data }, CatalogTransactionBeginResultSchema);
|
|
6978
|
-
}
|
|
8306
|
+
const catalogVersion = catalogHandler(signingKey, async (params) => {
|
|
8307
|
+
const cat = getCatalog();
|
|
8308
|
+
const version = await cat.version(toUint8Array(params.attach_opaque_data), params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
8309
|
+
return wrapResult({ version }, CatalogVersionResultSchema);
|
|
6979
8310
|
});
|
|
6980
|
-
|
|
6981
|
-
|
|
6982
|
-
|
|
6983
|
-
|
|
6984
|
-
|
|
6985
|
-
|
|
6986
|
-
|
|
6987
|
-
}
|
|
8311
|
+
const catalogTransactionBegin = async (params, ctx) => {
|
|
8312
|
+
const auth = ctx?.auth;
|
|
8313
|
+
const sealedAttach = params.attach_opaque_data != null ? toUint8Array(params.attach_opaque_data) : new Uint8Array(0);
|
|
8314
|
+
const attachPlain = await openAttach(sealedAttach, auth, signingKey);
|
|
8315
|
+
const cat = getCatalog();
|
|
8316
|
+
const txPlain = await cat.transactionBegin(attachPlain);
|
|
8317
|
+
const transaction_opaque_data = txPlain != null ? await sealTransaction(toUint8Array(txPlain), sealedAttach, auth, signingKey) : null;
|
|
8318
|
+
return wrapResult({ transaction_opaque_data }, CatalogTransactionBeginResultSchema);
|
|
8319
|
+
};
|
|
8320
|
+
const catalogTransactionCommit = catalogHandler(signingKey, async (params) => {
|
|
8321
|
+
const cat = getCatalog();
|
|
8322
|
+
await cat.transactionCommit(toUint8Array(params.attach_opaque_data), toUint8Array(params.transaction_opaque_data));
|
|
8323
|
+
return {};
|
|
6988
8324
|
});
|
|
6989
|
-
|
|
6990
|
-
|
|
6991
|
-
|
|
6992
|
-
|
|
6993
|
-
const cat = getCatalog();
|
|
6994
|
-
await cat.transactionRollback(toUint8Array(params.attach_opaque_data), toUint8Array(params.transaction_opaque_data));
|
|
6995
|
-
return {};
|
|
6996
|
-
}
|
|
8325
|
+
const catalogTransactionRollback = catalogHandler(signingKey, async (params) => {
|
|
8326
|
+
const cat = getCatalog();
|
|
8327
|
+
await cat.transactionRollback(toUint8Array(params.attach_opaque_data), toUint8Array(params.transaction_opaque_data));
|
|
8328
|
+
return {};
|
|
6997
8329
|
});
|
|
6998
|
-
|
|
6999
|
-
|
|
7000
|
-
|
|
7001
|
-
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
return wrapResult({
|
|
7005
|
-
items: schemas.map((s) => encodeSchemaInfo(s))
|
|
7006
|
-
}, CatalogSchemasResultSchema);
|
|
7007
|
-
}
|
|
8330
|
+
const catalogSchemas = catalogHandler(signingKey, async (params) => {
|
|
8331
|
+
const cat = getCatalog();
|
|
8332
|
+
const schemas = await cat.schemas(toUint8Array(params.attach_opaque_data), params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
8333
|
+
return wrapResult({
|
|
8334
|
+
items: schemas.map((s) => encodeSchemaInfo(s))
|
|
8335
|
+
}, CatalogSchemasResultSchema);
|
|
7008
8336
|
});
|
|
7009
|
-
|
|
7010
|
-
params:
|
|
7011
|
-
|
|
7012
|
-
handler: async (params) => {
|
|
7013
|
-
const ifNoneMatch = params.if_none_match == null ? null : String(params.if_none_match);
|
|
7014
|
-
return serveCatalogContents(getCatalog(), toUint8Array(params.attach_opaque_data), ifNoneMatch);
|
|
7015
|
-
}
|
|
8337
|
+
const catalogContents = catalogHandler(signingKey, async (params) => {
|
|
8338
|
+
const ifNoneMatch = params.if_none_match == null ? null : String(params.if_none_match);
|
|
8339
|
+
return serveCatalogContents(getCatalog(), toUint8Array(params.attach_opaque_data), ifNoneMatch);
|
|
7016
8340
|
});
|
|
7017
|
-
|
|
7018
|
-
|
|
7019
|
-
|
|
7020
|
-
|
|
7021
|
-
|
|
7022
|
-
|
|
7023
|
-
return wrapResult({
|
|
7024
|
-
items: formats.map((f) => encodeCopyFromFormatInfo(f))
|
|
7025
|
-
}, CatalogCopyFromFormatsResultSchema);
|
|
7026
|
-
}
|
|
8341
|
+
const catalogCopyFromFormats = catalogHandler(signingKey, async (params) => {
|
|
8342
|
+
const cat = getCatalog();
|
|
8343
|
+
const formats = await cat.copyFromFormats(toUint8Array(params.attach_opaque_data), params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
8344
|
+
return wrapResult({
|
|
8345
|
+
items: formats.map((f) => encodeCopyFromFormatInfo(f))
|
|
8346
|
+
}, CatalogCopyFromFormatsResultSchema);
|
|
7027
8347
|
});
|
|
7028
|
-
|
|
7029
|
-
|
|
7030
|
-
|
|
7031
|
-
|
|
7032
|
-
|
|
7033
|
-
|
|
7034
|
-
return wrapResult({
|
|
7035
|
-
items: info ? [encodeSchemaInfo(info)] : []
|
|
7036
|
-
}, CatalogSchemaGetResultSchema);
|
|
7037
|
-
}
|
|
8348
|
+
const catalogSchemaGet = catalogHandler(signingKey, async (params) => {
|
|
8349
|
+
const cat = getCatalog();
|
|
8350
|
+
const info = await cat.schemaGet(toUint8Array(params.attach_opaque_data), params.path, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
8351
|
+
return wrapResult({
|
|
8352
|
+
items: info ? [encodeSchemaInfo(info)] : []
|
|
8353
|
+
}, CatalogSchemaGetResultSchema);
|
|
7038
8354
|
});
|
|
7039
|
-
|
|
7040
|
-
|
|
7041
|
-
|
|
7042
|
-
|
|
7043
|
-
const cat = getCatalog();
|
|
7044
|
-
await cat.schemaCreate(toUint8Array(params.attach_opaque_data), params.path, params.comment, null, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
7045
|
-
return {};
|
|
7046
|
-
}
|
|
8355
|
+
const catalogSchemaCreate = catalogHandler(signingKey, async (params) => {
|
|
8356
|
+
const cat = getCatalog();
|
|
8357
|
+
await cat.schemaCreate(toUint8Array(params.attach_opaque_data), params.path, params.comment, null, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
8358
|
+
return {};
|
|
7047
8359
|
});
|
|
7048
|
-
|
|
7049
|
-
|
|
7050
|
-
|
|
7051
|
-
|
|
7052
|
-
const cat = getCatalog();
|
|
7053
|
-
await cat.schemaDrop(toUint8Array(params.attach_opaque_data), params.path, params.ignore_not_found, params.cascade, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
7054
|
-
return {};
|
|
7055
|
-
}
|
|
8360
|
+
const catalogSchemaDrop = catalogHandler(signingKey, async (params) => {
|
|
8361
|
+
const cat = getCatalog();
|
|
8362
|
+
await cat.schemaDrop(toUint8Array(params.attach_opaque_data), params.path, params.ignore_not_found, params.cascade, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
8363
|
+
return {};
|
|
7056
8364
|
});
|
|
7057
|
-
|
|
7058
|
-
|
|
7059
|
-
|
|
7060
|
-
|
|
7061
|
-
|
|
7062
|
-
|
|
7063
|
-
return wrapResult({
|
|
7064
|
-
items: tables.map((t) => encodeTableInfo(t))
|
|
7065
|
-
}, CatalogSchemaContentsTablesResultSchema);
|
|
7066
|
-
}
|
|
8365
|
+
const catalogSchemaContentsTables = catalogHandler(signingKey, async (params) => {
|
|
8366
|
+
const cat = getCatalog();
|
|
8367
|
+
const tables = await cat.schemaContentsTables(toUint8Array(params.attach_opaque_data), params.path, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
8368
|
+
return wrapResult({
|
|
8369
|
+
items: tables.map((t) => encodeTableInfo(t))
|
|
8370
|
+
}, CatalogSchemaContentsTablesResultSchema);
|
|
7067
8371
|
});
|
|
7068
|
-
|
|
7069
|
-
|
|
7070
|
-
|
|
7071
|
-
|
|
7072
|
-
|
|
7073
|
-
|
|
7074
|
-
return wrapResult({
|
|
7075
|
-
items: views.map((v) => encodeViewInfo(v))
|
|
7076
|
-
}, CatalogSchemaContentsViewsResultSchema);
|
|
7077
|
-
}
|
|
8372
|
+
const catalogSchemaContentsViews = catalogHandler(signingKey, async (params) => {
|
|
8373
|
+
const cat = getCatalog();
|
|
8374
|
+
const views = await cat.schemaContentsViews(toUint8Array(params.attach_opaque_data), params.path, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
8375
|
+
return wrapResult({
|
|
8376
|
+
items: views.map((v) => encodeViewInfo(v))
|
|
8377
|
+
}, CatalogSchemaContentsViewsResultSchema);
|
|
7078
8378
|
});
|
|
7079
|
-
|
|
7080
|
-
|
|
7081
|
-
|
|
7082
|
-
|
|
7083
|
-
|
|
7084
|
-
|
|
7085
|
-
return wrapResult({
|
|
7086
|
-
items: funcs.map((f) => encodeFunctionInfoOnce(f))
|
|
7087
|
-
}, CatalogSchemaContentsFunctionsResultSchema);
|
|
7088
|
-
}
|
|
8379
|
+
const catalogSchemaContentsFunctions = catalogHandler(signingKey, async (params) => {
|
|
8380
|
+
const cat = getCatalog();
|
|
8381
|
+
const funcs = await cat.schemaContentsFunctions(toUint8Array(params.attach_opaque_data), params.path, decodeDictValue(params.type), params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
8382
|
+
return wrapResult({
|
|
8383
|
+
items: funcs.map((f) => encodeFunctionInfoOnce(f))
|
|
8384
|
+
}, CatalogSchemaContentsFunctionsResultSchema);
|
|
7089
8385
|
});
|
|
8386
|
+
return {
|
|
8387
|
+
catalogCatalogs,
|
|
8388
|
+
catalogAttach,
|
|
8389
|
+
catalogDetach,
|
|
8390
|
+
catalogCreate,
|
|
8391
|
+
catalogDrop,
|
|
8392
|
+
catalogVersion,
|
|
8393
|
+
catalogTransactionBegin,
|
|
8394
|
+
catalogTransactionCommit,
|
|
8395
|
+
catalogTransactionRollback,
|
|
8396
|
+
catalogSchemas,
|
|
8397
|
+
catalogContents,
|
|
8398
|
+
catalogCopyFromFormats,
|
|
8399
|
+
catalogSchemaGet,
|
|
8400
|
+
catalogSchemaCreate,
|
|
8401
|
+
catalogSchemaDrop,
|
|
8402
|
+
catalogSchemaContentsTables,
|
|
8403
|
+
catalogSchemaContentsViews,
|
|
8404
|
+
catalogSchemaContentsFunctions
|
|
8405
|
+
};
|
|
7090
8406
|
}
|
|
7091
8407
|
|
|
7092
8408
|
// src/protocol/handlers/catalog/table.ts
|
|
7093
|
-
function
|
|
7094
|
-
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
|
|
7098
|
-
|
|
7099
|
-
|
|
7100
|
-
return wrapResult({
|
|
7101
|
-
items: info ? [encodeTableInfo(info)] : []
|
|
7102
|
-
}, CatalogTableGetResultSchema);
|
|
7103
|
-
}
|
|
8409
|
+
function catalogTableHandlers(getCatalog, signingKey) {
|
|
8410
|
+
const catalogTableGet = catalogHandler(signingKey, async (params) => {
|
|
8411
|
+
const cat = getCatalog();
|
|
8412
|
+
const info = await cat.tableGet(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.at_unit, params.at_value, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
8413
|
+
return wrapResult({
|
|
8414
|
+
items: info ? [encodeTableInfo(info)] : []
|
|
8415
|
+
}, CatalogTableGetResultSchema);
|
|
7104
8416
|
});
|
|
7105
|
-
|
|
7106
|
-
|
|
7107
|
-
|
|
7108
|
-
|
|
7109
|
-
const cat = getCatalog();
|
|
7110
|
-
await cat.tableCreate(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, toUint8Array(params.columns), params.on_conflict, params.not_null_constraints ?? [], params.unique_constraints ?? [], params.check_constraints ?? [], params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
7111
|
-
return {};
|
|
7112
|
-
}
|
|
8417
|
+
const catalogTableCreate = catalogHandler(signingKey, async (params) => {
|
|
8418
|
+
const cat = getCatalog();
|
|
8419
|
+
await cat.tableCreate(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, toUint8Array(params.columns), params.on_conflict, params.not_null_constraints ?? [], params.unique_constraints ?? [], params.check_constraints ?? [], params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
8420
|
+
return {};
|
|
7113
8421
|
});
|
|
7114
|
-
|
|
7115
|
-
|
|
7116
|
-
|
|
7117
|
-
|
|
7118
|
-
const cat = getCatalog();
|
|
7119
|
-
await cat.tableDrop(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
7120
|
-
return {};
|
|
7121
|
-
}
|
|
8422
|
+
const catalogTableDrop = catalogHandler(signingKey, async (params) => {
|
|
8423
|
+
const cat = getCatalog();
|
|
8424
|
+
await cat.tableDrop(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
8425
|
+
return {};
|
|
7122
8426
|
});
|
|
7123
|
-
|
|
7124
|
-
|
|
7125
|
-
|
|
7126
|
-
|
|
7127
|
-
const cat = getCatalog();
|
|
7128
|
-
const stats = await cat.tableColumnStatisticsGet(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
7129
|
-
return { result: stats?.bytes ?? null };
|
|
7130
|
-
}
|
|
8427
|
+
const catalogTableColumnStatisticsGet = catalogHandler(signingKey, async (params) => {
|
|
8428
|
+
const cat = getCatalog();
|
|
8429
|
+
const stats = await cat.tableColumnStatisticsGet(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
8430
|
+
return { result: stats?.bytes ?? null };
|
|
7131
8431
|
});
|
|
7132
|
-
|
|
7133
|
-
|
|
7134
|
-
|
|
7135
|
-
|
|
7136
|
-
const cat = getCatalog();
|
|
7137
|
-
const scanResult = await cat.tableScanFunctionGet(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.at_unit, params.at_value, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
7138
|
-
return wrapResult(scanResult, ScanFunctionResultSchema);
|
|
7139
|
-
}
|
|
8432
|
+
const catalogTableScanFunctionGet = catalogHandler(signingKey, async (params) => {
|
|
8433
|
+
const cat = getCatalog();
|
|
8434
|
+
const scanResult = await cat.tableScanFunctionGet(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.at_unit, params.at_value, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
8435
|
+
return wrapResult(scanResult, ScanFunctionResultSchema);
|
|
7140
8436
|
});
|
|
7141
|
-
|
|
7142
|
-
|
|
7143
|
-
|
|
7144
|
-
|
|
7145
|
-
const cat = getCatalog();
|
|
7146
|
-
const branchesResult = await cat.tableScanBranchesGet(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.at_unit, params.at_value, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
7147
|
-
return wrapResult(branchesResult, ScanBranchesResultSchema);
|
|
7148
|
-
}
|
|
8437
|
+
const catalogTableScanBranchesGet = catalogHandler(signingKey, async (params) => {
|
|
8438
|
+
const cat = getCatalog();
|
|
8439
|
+
const branchesResult = await cat.tableScanBranchesGet(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.at_unit, params.at_value, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
8440
|
+
return wrapResult(branchesResult, ScanBranchesResultSchema);
|
|
7149
8441
|
});
|
|
7150
|
-
|
|
7151
|
-
|
|
7152
|
-
|
|
7153
|
-
|
|
7154
|
-
const cat = getCatalog();
|
|
7155
|
-
await cat.tableCommentSet(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.comment, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
7156
|
-
return {};
|
|
7157
|
-
}
|
|
8442
|
+
const catalogTableCommentSet = catalogHandler(signingKey, async (params) => {
|
|
8443
|
+
const cat = getCatalog();
|
|
8444
|
+
await cat.tableCommentSet(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.comment, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
8445
|
+
return {};
|
|
7158
8446
|
});
|
|
7159
|
-
|
|
7160
|
-
|
|
7161
|
-
|
|
7162
|
-
|
|
7163
|
-
const cat = getCatalog();
|
|
7164
|
-
await cat.tableRename(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.new_name, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
7165
|
-
return {};
|
|
7166
|
-
}
|
|
8447
|
+
const catalogTableRename = catalogHandler(signingKey, async (params) => {
|
|
8448
|
+
const cat = getCatalog();
|
|
8449
|
+
await cat.tableRename(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.new_name, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
8450
|
+
return {};
|
|
7167
8451
|
});
|
|
7168
|
-
|
|
7169
|
-
|
|
7170
|
-
|
|
7171
|
-
|
|
7172
|
-
const cat = getCatalog();
|
|
7173
|
-
await cat.tableColumnAdd(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.column_name, params.column_type, params.default_value, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
7174
|
-
return {};
|
|
7175
|
-
}
|
|
8452
|
+
const catalogTableColumnAdd = catalogHandler(signingKey, async (params) => {
|
|
8453
|
+
const cat = getCatalog();
|
|
8454
|
+
await cat.tableColumnAdd(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.column_name, params.column_type, params.default_value, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
8455
|
+
return {};
|
|
7176
8456
|
});
|
|
7177
|
-
|
|
7178
|
-
|
|
7179
|
-
|
|
7180
|
-
|
|
7181
|
-
const cat = getCatalog();
|
|
7182
|
-
await cat.tableColumnDrop(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.column_name, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
7183
|
-
return {};
|
|
7184
|
-
}
|
|
8457
|
+
const catalogTableColumnDrop = catalogHandler(signingKey, async (params) => {
|
|
8458
|
+
const cat = getCatalog();
|
|
8459
|
+
await cat.tableColumnDrop(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.column_name, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
8460
|
+
return {};
|
|
7185
8461
|
});
|
|
7186
|
-
|
|
7187
|
-
|
|
7188
|
-
|
|
7189
|
-
|
|
7190
|
-
const cat = getCatalog();
|
|
7191
|
-
await cat.tableColumnRename(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.column_name, params.new_name, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
7192
|
-
return {};
|
|
7193
|
-
}
|
|
8462
|
+
const catalogTableColumnRename = catalogHandler(signingKey, async (params) => {
|
|
8463
|
+
const cat = getCatalog();
|
|
8464
|
+
await cat.tableColumnRename(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.column_name, params.new_name, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
8465
|
+
return {};
|
|
7194
8466
|
});
|
|
7195
|
-
|
|
7196
|
-
|
|
7197
|
-
|
|
7198
|
-
|
|
7199
|
-
const cat = getCatalog();
|
|
7200
|
-
await cat.tableColumnDefaultSet(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.column_name, params.default_value, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
7201
|
-
return {};
|
|
7202
|
-
}
|
|
8467
|
+
const catalogTableColumnDefaultSet = catalogHandler(signingKey, async (params) => {
|
|
8468
|
+
const cat = getCatalog();
|
|
8469
|
+
await cat.tableColumnDefaultSet(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.column_name, params.default_value, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
8470
|
+
return {};
|
|
7203
8471
|
});
|
|
7204
|
-
|
|
7205
|
-
|
|
7206
|
-
|
|
7207
|
-
|
|
7208
|
-
const cat = getCatalog();
|
|
7209
|
-
await cat.tableColumnDefaultDrop(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.column_name, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
7210
|
-
return {};
|
|
7211
|
-
}
|
|
8472
|
+
const catalogTableColumnDefaultDrop = catalogHandler(signingKey, async (params) => {
|
|
8473
|
+
const cat = getCatalog();
|
|
8474
|
+
await cat.tableColumnDefaultDrop(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.column_name, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
8475
|
+
return {};
|
|
7212
8476
|
});
|
|
7213
|
-
|
|
7214
|
-
|
|
7215
|
-
|
|
7216
|
-
|
|
7217
|
-
const cat = getCatalog();
|
|
7218
|
-
await cat.tableColumnTypeChange(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.column_name, params.new_type, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
7219
|
-
return {};
|
|
7220
|
-
}
|
|
8477
|
+
const catalogTableColumnTypeChange = catalogHandler(signingKey, async (params) => {
|
|
8478
|
+
const cat = getCatalog();
|
|
8479
|
+
await cat.tableColumnTypeChange(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.column_name, params.new_type, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
8480
|
+
return {};
|
|
7221
8481
|
});
|
|
7222
|
-
|
|
7223
|
-
|
|
7224
|
-
|
|
7225
|
-
|
|
7226
|
-
const cat = getCatalog();
|
|
7227
|
-
await cat.tableNotNullSet(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.column_name, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
7228
|
-
return {};
|
|
7229
|
-
}
|
|
8482
|
+
const catalogTableNotNullSet = catalogHandler(signingKey, async (params) => {
|
|
8483
|
+
const cat = getCatalog();
|
|
8484
|
+
await cat.tableNotNullSet(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.column_name, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
8485
|
+
return {};
|
|
7230
8486
|
});
|
|
7231
|
-
|
|
7232
|
-
|
|
7233
|
-
|
|
7234
|
-
|
|
7235
|
-
const cat = getCatalog();
|
|
7236
|
-
await cat.tableNotNullDrop(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.column_name, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
7237
|
-
return {};
|
|
7238
|
-
}
|
|
8487
|
+
const catalogTableNotNullDrop = catalogHandler(signingKey, async (params) => {
|
|
8488
|
+
const cat = getCatalog();
|
|
8489
|
+
await cat.tableNotNullDrop(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.column_name, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
8490
|
+
return {};
|
|
7239
8491
|
});
|
|
8492
|
+
return {
|
|
8493
|
+
catalogTableGet,
|
|
8494
|
+
catalogTableCreate,
|
|
8495
|
+
catalogTableDrop,
|
|
8496
|
+
catalogTableColumnStatisticsGet,
|
|
8497
|
+
catalogTableScanFunctionGet,
|
|
8498
|
+
catalogTableScanBranchesGet,
|
|
8499
|
+
catalogTableCommentSet,
|
|
8500
|
+
catalogTableRename,
|
|
8501
|
+
catalogTableColumnAdd,
|
|
8502
|
+
catalogTableColumnDrop,
|
|
8503
|
+
catalogTableColumnRename,
|
|
8504
|
+
catalogTableColumnDefaultSet,
|
|
8505
|
+
catalogTableColumnDefaultDrop,
|
|
8506
|
+
catalogTableColumnTypeChange,
|
|
8507
|
+
catalogTableNotNullSet,
|
|
8508
|
+
catalogTableNotNullDrop
|
|
8509
|
+
};
|
|
7240
8510
|
}
|
|
7241
8511
|
|
|
7242
8512
|
// src/protocol/handlers/catalog/view.ts
|
|
7243
|
-
function
|
|
7244
|
-
|
|
7245
|
-
|
|
7246
|
-
|
|
7247
|
-
|
|
7248
|
-
|
|
7249
|
-
|
|
7250
|
-
return wrapResult({
|
|
7251
|
-
items: info ? [encodeViewInfo(info)] : []
|
|
7252
|
-
}, CatalogViewGetResultSchema);
|
|
7253
|
-
}
|
|
8513
|
+
function catalogViewHandlers(getCatalog, signingKey) {
|
|
8514
|
+
const catalogViewGet = catalogHandler(signingKey, async (params) => {
|
|
8515
|
+
const cat = getCatalog();
|
|
8516
|
+
const info = await cat.viewGet(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
8517
|
+
return wrapResult({
|
|
8518
|
+
items: info ? [encodeViewInfo(info)] : []
|
|
8519
|
+
}, CatalogViewGetResultSchema);
|
|
7254
8520
|
});
|
|
7255
|
-
|
|
7256
|
-
|
|
7257
|
-
|
|
7258
|
-
|
|
7259
|
-
const cat = getCatalog();
|
|
7260
|
-
await cat.viewCreate(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.definition, params.on_conflict, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
7261
|
-
return {};
|
|
7262
|
-
}
|
|
8521
|
+
const catalogViewCreate = catalogHandler(signingKey, async (params) => {
|
|
8522
|
+
const cat = getCatalog();
|
|
8523
|
+
await cat.viewCreate(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.definition, params.on_conflict, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
8524
|
+
return {};
|
|
7263
8525
|
});
|
|
7264
|
-
|
|
7265
|
-
|
|
7266
|
-
|
|
7267
|
-
|
|
7268
|
-
const cat = getCatalog();
|
|
7269
|
-
await cat.viewDrop(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
7270
|
-
return {};
|
|
7271
|
-
}
|
|
8526
|
+
const catalogViewDrop = catalogHandler(signingKey, async (params) => {
|
|
8527
|
+
const cat = getCatalog();
|
|
8528
|
+
await cat.viewDrop(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
8529
|
+
return {};
|
|
7272
8530
|
});
|
|
7273
|
-
|
|
7274
|
-
|
|
7275
|
-
|
|
7276
|
-
|
|
7277
|
-
const cat = getCatalog();
|
|
7278
|
-
await cat.viewRename(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.new_name, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
7279
|
-
return {};
|
|
7280
|
-
}
|
|
8531
|
+
const catalogViewRename = catalogHandler(signingKey, async (params) => {
|
|
8532
|
+
const cat = getCatalog();
|
|
8533
|
+
await cat.viewRename(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.new_name, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
8534
|
+
return {};
|
|
7281
8535
|
});
|
|
7282
|
-
|
|
7283
|
-
|
|
7284
|
-
|
|
7285
|
-
|
|
7286
|
-
const cat = getCatalog();
|
|
7287
|
-
await cat.viewCommentSet(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.comment, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
7288
|
-
return {};
|
|
7289
|
-
}
|
|
8536
|
+
const catalogViewCommentSet = catalogHandler(signingKey, async (params) => {
|
|
8537
|
+
const cat = getCatalog();
|
|
8538
|
+
await cat.viewCommentSet(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.comment, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
8539
|
+
return {};
|
|
7290
8540
|
});
|
|
8541
|
+
return { catalogViewGet, catalogViewCreate, catalogViewDrop, catalogViewRename, catalogViewCommentSet };
|
|
7291
8542
|
}
|
|
7292
8543
|
|
|
7293
8544
|
// src/protocol/handlers/catalog/macro.ts
|
|
7294
|
-
function
|
|
7295
|
-
|
|
7296
|
-
|
|
7297
|
-
|
|
7298
|
-
|
|
7299
|
-
|
|
7300
|
-
|
|
7301
|
-
return wrapResult({
|
|
7302
|
-
items: info ? [encodeMacroInfo(info)] : []
|
|
7303
|
-
}, CatalogMacroGetResultSchema);
|
|
7304
|
-
}
|
|
8545
|
+
function catalogMacroHandlers(getCatalog, signingKey) {
|
|
8546
|
+
const catalogMacroGet = catalogHandler(signingKey, async (params) => {
|
|
8547
|
+
const cat = getCatalog();
|
|
8548
|
+
const info = await cat.macroGet(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
8549
|
+
return wrapResult({
|
|
8550
|
+
items: info ? [encodeMacroInfo(info)] : []
|
|
8551
|
+
}, CatalogMacroGetResultSchema);
|
|
7305
8552
|
});
|
|
7306
|
-
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
|
|
7310
|
-
|
|
7311
|
-
const innerParams = params;
|
|
7312
|
-
await cat.macroCreate(toUint8Array(innerParams.attach_opaque_data), innerParams.schema_path, innerParams.name, innerParams.macro_type, innerParams.parameters ? Array.isArray(innerParams.parameters) ? innerParams.parameters : [...innerParams.parameters] : [], innerParams.definition, innerParams.on_conflict, innerParams.parameter_default_values ? toUint8Array(innerParams.parameter_default_values) : null, innerParams.arguments_schema ? toUint8Array(innerParams.arguments_schema) : null, innerParams.transaction_opaque_data ? toUint8Array(innerParams.transaction_opaque_data) : undefined);
|
|
7313
|
-
return {};
|
|
7314
|
-
}
|
|
8553
|
+
const catalogMacroCreate = catalogHandler(signingKey, async (params) => {
|
|
8554
|
+
const cat = getCatalog();
|
|
8555
|
+
const innerParams = params;
|
|
8556
|
+
await cat.macroCreate(toUint8Array(innerParams.attach_opaque_data), innerParams.schema_path, innerParams.name, innerParams.macro_type, innerParams.parameters ? Array.isArray(innerParams.parameters) ? innerParams.parameters : [...innerParams.parameters] : [], innerParams.definition, innerParams.on_conflict, innerParams.parameter_default_values ? toUint8Array(innerParams.parameter_default_values) : null, innerParams.arguments_schema ? toUint8Array(innerParams.arguments_schema) : null, innerParams.transaction_opaque_data ? toUint8Array(innerParams.transaction_opaque_data) : undefined);
|
|
8557
|
+
return {};
|
|
7315
8558
|
});
|
|
7316
|
-
|
|
7317
|
-
|
|
7318
|
-
|
|
7319
|
-
|
|
7320
|
-
const cat = getCatalog();
|
|
7321
|
-
await cat.macroDrop(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
7322
|
-
return {};
|
|
7323
|
-
}
|
|
8559
|
+
const catalogMacroDrop = catalogHandler(signingKey, async (params) => {
|
|
8560
|
+
const cat = getCatalog();
|
|
8561
|
+
await cat.macroDrop(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
8562
|
+
return {};
|
|
7324
8563
|
});
|
|
7325
|
-
|
|
7326
|
-
|
|
7327
|
-
|
|
7328
|
-
|
|
7329
|
-
|
|
7330
|
-
|
|
7331
|
-
return wrapResult({
|
|
7332
|
-
items: macros.map((m) => encodeMacroInfo(m))
|
|
7333
|
-
}, CatalogSchemaContentsMacrosResultSchema);
|
|
7334
|
-
}
|
|
8564
|
+
const catalogSchemaContentsMacros = catalogHandler(signingKey, async (params) => {
|
|
8565
|
+
const cat = getCatalog();
|
|
8566
|
+
const macros = await cat.schemaContentsMacros(toUint8Array(params.attach_opaque_data), params.path, decodeDictValue(params.type), params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
8567
|
+
return wrapResult({
|
|
8568
|
+
items: macros.map((m) => encodeMacroInfo(m))
|
|
8569
|
+
}, CatalogSchemaContentsMacrosResultSchema);
|
|
7335
8570
|
});
|
|
8571
|
+
return { catalogMacroGet, catalogMacroCreate, catalogMacroDrop, catalogSchemaContentsMacros };
|
|
7336
8572
|
}
|
|
7337
8573
|
|
|
7338
8574
|
// src/protocol/handlers/catalog/index_methods.ts
|
|
7339
|
-
function
|
|
7340
|
-
|
|
7341
|
-
|
|
7342
|
-
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
return wrapResult({
|
|
7347
|
-
items: indexes.map((i) => encodeIndexInfo(i))
|
|
7348
|
-
}, CatalogSchemaContentsIndexesResultSchema);
|
|
7349
|
-
}
|
|
8575
|
+
function catalogIndexHandlers(getCatalog, signingKey) {
|
|
8576
|
+
const catalogSchemaContentsIndexes = catalogHandler(signingKey, async (params) => {
|
|
8577
|
+
const cat = getCatalog();
|
|
8578
|
+
const indexes = await cat.schemaContentsIndexes(toUint8Array(params.attach_opaque_data), params.path, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
8579
|
+
return wrapResult({
|
|
8580
|
+
items: indexes.map((i) => encodeIndexInfo(i))
|
|
8581
|
+
}, CatalogSchemaContentsIndexesResultSchema);
|
|
7350
8582
|
});
|
|
7351
|
-
|
|
7352
|
-
|
|
7353
|
-
|
|
7354
|
-
|
|
7355
|
-
|
|
7356
|
-
|
|
7357
|
-
return wrapResult({
|
|
7358
|
-
items: info ? [encodeIndexInfo(info)] : []
|
|
7359
|
-
}, CatalogIndexGetResultSchema);
|
|
7360
|
-
}
|
|
8583
|
+
const catalogIndexGet = catalogHandler(signingKey, async (params) => {
|
|
8584
|
+
const cat = getCatalog();
|
|
8585
|
+
const info = await cat.indexGet(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
8586
|
+
return wrapResult({
|
|
8587
|
+
items: info ? [encodeIndexInfo(info)] : []
|
|
8588
|
+
}, CatalogIndexGetResultSchema);
|
|
7361
8589
|
});
|
|
8590
|
+
return { catalogSchemaContentsIndexes, catalogIndexGet };
|
|
7362
8591
|
}
|
|
7363
8592
|
|
|
7364
8593
|
// src/protocol/handlers/catalog/index.ts
|
|
7365
|
-
function
|
|
8594
|
+
function catalogHandlers(catalog, signingKey) {
|
|
7366
8595
|
const getCatalog = makeGetCatalog(catalog);
|
|
7367
|
-
|
|
7368
|
-
|
|
7369
|
-
|
|
7370
|
-
|
|
7371
|
-
|
|
7372
|
-
|
|
7373
|
-
|
|
7374
|
-
// src/protocol/handlers/unimplemented.ts
|
|
7375
|
-
import { MethodNotImplementedError } from "@query-farm/vgi-rpc";
|
|
7376
|
-
var UNIMPLEMENTED_METHODS = [
|
|
7377
|
-
{ name: "aggregate_streaming_open", params: REQUEST_PARAMS_SCHEMA, result: RESULT_BINARY_SCHEMA },
|
|
7378
|
-
{ name: "aggregate_streaming_chunk", params: REQUEST_PARAMS_SCHEMA, result: RESULT_BINARY_SCHEMA },
|
|
7379
|
-
{ name: "aggregate_streaming_close", params: REQUEST_PARAMS_SCHEMA, result: RESULT_BINARY_SCHEMA },
|
|
7380
|
-
{ name: "aggregate_window_init", params: REQUEST_PARAMS_SCHEMA, result: RESULT_BINARY_SCHEMA },
|
|
7381
|
-
{ name: "aggregate_window", params: REQUEST_PARAMS_SCHEMA, result: RESULT_BINARY_SCHEMA },
|
|
7382
|
-
{ name: "aggregate_window_batch", params: REQUEST_PARAMS_SCHEMA, result: RESULT_BINARY_SCHEMA },
|
|
7383
|
-
{ name: "aggregate_window_destructor", params: REQUEST_PARAMS_SCHEMA, result: RESULT_BINARY_SCHEMA },
|
|
7384
|
-
{ name: "catalog_index_create", params: CatalogIndexCreateParamsSchema, result: emptyResultSchema },
|
|
7385
|
-
{ name: "catalog_index_drop", params: CatalogIndexDropParamsSchema, result: emptyResultSchema },
|
|
7386
|
-
{ name: "catalog_table_column_comment_set", params: CatalogTableColumnCommentSetParamsSchema, result: emptyResultSchema },
|
|
7387
|
-
{ name: "catalog_table_insert_function_get", params: CatalogTableInsertFunctionGetParamsSchema, result: RESULT_BINARY_SCHEMA },
|
|
7388
|
-
{ name: "catalog_table_update_function_get", params: CatalogTableUpdateFunctionGetParamsSchema, result: RESULT_BINARY_SCHEMA },
|
|
7389
|
-
{ name: "catalog_table_delete_function_get", params: CatalogTableDeleteFunctionGetParamsSchema, result: RESULT_BINARY_SCHEMA }
|
|
7390
|
-
];
|
|
7391
|
-
function unimplementedMessage(method) {
|
|
7392
|
-
return `${method} is not implemented by this worker`;
|
|
7393
|
-
}
|
|
7394
|
-
function registerUnimplementedMethods(protocol) {
|
|
7395
|
-
for (const m of UNIMPLEMENTED_METHODS) {
|
|
7396
|
-
protocol.unary(m.name, {
|
|
7397
|
-
params: m.params,
|
|
7398
|
-
result: m.result,
|
|
7399
|
-
handler: async () => {
|
|
7400
|
-
throw new MethodNotImplementedError(unimplementedMessage(m.name));
|
|
7401
|
-
}
|
|
7402
|
-
});
|
|
7403
|
-
}
|
|
8596
|
+
return {
|
|
8597
|
+
...catalogAdminHandlers(getCatalog, signingKey),
|
|
8598
|
+
...catalogTableHandlers(getCatalog, signingKey),
|
|
8599
|
+
...catalogViewHandlers(getCatalog, signingKey),
|
|
8600
|
+
...catalogMacroHandlers(getCatalog, signingKey),
|
|
8601
|
+
...catalogIndexHandlers(getCatalog, signingKey)
|
|
8602
|
+
};
|
|
7404
8603
|
}
|
|
7405
8604
|
|
|
7406
8605
|
// src/protocol/dispatch.ts
|
|
7407
|
-
|
|
8606
|
+
function buildVgiService(config) {
|
|
8607
|
+
return {
|
|
8608
|
+
...UNIMPLEMENTED_VGI_SERVICE,
|
|
8609
|
+
...functionHandlers({
|
|
8610
|
+
registry: config.registry,
|
|
8611
|
+
signingKey: config.signingKey,
|
|
8612
|
+
catalogInterface: config.catalogInterface
|
|
8613
|
+
}),
|
|
8614
|
+
...aggregateHandlers(config.registry),
|
|
8615
|
+
...tableBufferingHandlers(config.registry, config.signingKey),
|
|
8616
|
+
...catalogHandlers(config.catalogInterface, config.signingKey)
|
|
8617
|
+
};
|
|
8618
|
+
}
|
|
7408
8619
|
function buildVgiProtocol(config) {
|
|
7409
|
-
|
|
7410
|
-
registerFunctionMethods(protocol, {
|
|
7411
|
-
registry: config.registry,
|
|
7412
|
-
signingKey: config.signingKey,
|
|
7413
|
-
catalogInterface: config.catalogInterface
|
|
7414
|
-
});
|
|
7415
|
-
registerAggregateMethods(protocol, config.registry);
|
|
7416
|
-
registerTableBufferingMethods(protocol, config.registry, config.signingKey);
|
|
7417
|
-
registerCatalogMethods(protocol, config.catalogInterface, config.catalogName, config.signingKey);
|
|
7418
|
-
registerUnimplementedMethods(protocol);
|
|
7419
|
-
return protocol;
|
|
8620
|
+
return createVgiProtocol(buildVgiService(config));
|
|
7420
8621
|
}
|
|
7421
8622
|
|
|
7422
8623
|
// src/http/landing-html.ts
|
|
@@ -7574,7 +8775,7 @@ function validatedHostedProtocols(hosting, primary) {
|
|
|
7574
8775
|
}
|
|
7575
8776
|
const name = p.name;
|
|
7576
8777
|
if (name.startsWith(RESERVED_PREFIX)) {
|
|
7577
|
-
throw new Error(`${owner} entry ${index} is named '${name}', which claims the reserved '${RESERVED_PREFIX}' prefix. ` + "Framework protocols are not supplied through this hook: reflection is hosted automatically, and " + "vgi_rpc.Identity.
|
|
8778
|
+
throw new Error(`${owner} entry ${index} is named '${name}', which claims the reserved '${RESERVED_PREFIX}' prefix. ` + "Framework protocols are not supplied through this hook: reflection is hosted automatically, and " + "vgi_rpc.Identity.v2 is enabled by supplying resolveToken and/or mintGrant.");
|
|
7578
8779
|
}
|
|
7579
8780
|
if (!/^[A-Za-z_][A-Za-z0-9_.]*$/.test(name)) {
|
|
7580
8781
|
throw new Error(`${owner} entry ${index}: protocol name '${name}' is not an identifier, optionally dot-qualified ` + "(e.g. 'acme.Reports.v1').");
|
|
@@ -7624,7 +8825,7 @@ function resolveIntrospectPrincipals(explicit, env) {
|
|
|
7624
8825
|
principals = raw.split(",").map((p) => p.trim()).filter((p) => p !== "");
|
|
7625
8826
|
}
|
|
7626
8827
|
if (principals.length === 0) {
|
|
7627
|
-
throw new Error("This worker supplies resolveToken, which hosts the vgi_rpc.Identity.
|
|
8828
|
+
throw new Error("This worker supplies resolveToken, which hosts the vgi_rpc.Identity.v2 protocol, but no " + `introspector allowlist was configured. Set ${INTROSPECT_PRINCIPALS_ENV} (comma-separated) or pass ` + `introspectPrincipals.
|
|
7628
8829
|
|
|
7629
8830
|
` + "There is no permissive default on purpose: introspection is a separate capability from " + "authentication, and allowing every authenticated caller lets any user resolve any other user's " + "credential to its owner. Remove resolveToken to leave the protocol unhosted entirely.");
|
|
7630
8831
|
}
|
|
@@ -7859,4 +9060,4 @@ export {
|
|
|
7859
9060
|
serveVgiWorker
|
|
7860
9061
|
};
|
|
7861
9062
|
|
|
7862
|
-
//# debugId=
|
|
9063
|
+
//# debugId=8C488693F22A8E5A64756E2164756E21
|