@query-farm/vgi 0.29.0 → 0.30.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.
Files changed (91) hide show
  1. package/README.md +26 -1
  2. package/dist/arguments/argument-spec.d.ts +4 -2
  3. package/dist/catalog/composite.d.ts +13 -13
  4. package/dist/catalog/descriptors.d.ts +7 -3
  5. package/dist/catalog/interface.d.ts +67 -40
  6. package/dist/catalog/read-only.d.ts +32 -15
  7. package/dist/client/client.d.ts +36 -29
  8. package/dist/client/types.d.ts +2 -0
  9. package/dist/client-entry.d.ts +1 -1
  10. package/dist/client-entry.js +442 -283
  11. package/dist/client-entry.js.map +12 -11
  12. package/dist/filter-pushdown/capabilities.d.ts +3 -0
  13. package/dist/filter-pushdown/deserialize.d.ts +14 -15
  14. package/dist/filter-pushdown/evaluate.d.ts +14 -44
  15. package/dist/filter-pushdown/index.d.ts +2 -2
  16. package/dist/filter-pushdown/types.d.ts +120 -68
  17. package/dist/functions/aggregate.d.ts +4 -0
  18. package/dist/functions/registry.d.ts +5 -5
  19. package/dist/functions/scalar.d.ts +6 -1
  20. package/dist/functions/table-buffering.d.ts +9 -0
  21. package/dist/functions/table-in-out.d.ts +13 -0
  22. package/dist/functions/table.d.ts +9 -2
  23. package/dist/functions/types.d.ts +22 -2
  24. package/dist/generated/vgi-client.d.ts +57 -31
  25. package/dist/generated/vgi-protocol-schemas.d.ts +15 -0
  26. package/dist/http/fetch.d.ts +7 -1
  27. package/dist/index.core.d.ts +2 -1
  28. package/dist/index.js +2320 -1363
  29. package/dist/index.js.map +44 -41
  30. package/dist/metadata/types.d.ts +15 -2
  31. package/dist/protocol/handlers/shared.d.ts +3 -1
  32. package/dist/protocol/serializers/splits.d.ts +1 -1
  33. package/dist/protocol/types.d.ts +9 -3
  34. package/dist/schema-path.d.ts +7 -0
  35. package/dist/serve-entry.d.ts +22 -1
  36. package/dist/serve-entry.js +414 -243
  37. package/dist/serve-entry.js.map +28 -27
  38. package/dist/split-token.d.ts +1 -1
  39. package/dist/types.d.ts +8 -0
  40. package/dist/worker-cf-entry.js +2033 -1210
  41. package/dist/worker-cf-entry.js.map +41 -37
  42. package/dist/worker.d.ts +1 -1
  43. package/package.json +3 -3
  44. package/src/arguments/argument-spec.ts +12 -4
  45. package/src/catalog/composite.ts +26 -26
  46. package/src/catalog/descriptors.ts +12 -3
  47. package/src/catalog/interface.ts +98 -48
  48. package/src/catalog/read-only.ts +125 -71
  49. package/src/client/client.ts +92 -72
  50. package/src/client/types.ts +2 -0
  51. package/src/client-entry.ts +2 -1
  52. package/src/filter-pushdown/capabilities.ts +13 -0
  53. package/src/filter-pushdown/collector.ts +22 -35
  54. package/src/filter-pushdown/deserialize.ts +657 -221
  55. package/src/filter-pushdown/evaluate.ts +410 -499
  56. package/src/filter-pushdown/index.ts +16 -2
  57. package/src/filter-pushdown/types.ts +88 -71
  58. package/src/functions/aggregate.ts +9 -1
  59. package/src/functions/registry.ts +24 -22
  60. package/src/functions/scalar.ts +26 -0
  61. package/src/functions/table-buffering.ts +46 -7
  62. package/src/functions/table-in-out.ts +187 -30
  63. package/src/functions/table.ts +58 -20
  64. package/src/functions/types.ts +24 -1
  65. package/src/generated/vgi-client.ts +62 -33
  66. package/src/generated/vgi-protocol-schemas.ts +226 -58
  67. package/src/http/client-bundle.ts +1 -1
  68. package/src/http/fetch.ts +12 -0
  69. package/src/index.core.ts +2 -0
  70. package/src/metadata/resolve.ts +43 -1
  71. package/src/metadata/serialize.ts +43 -5
  72. package/src/metadata/types.ts +17 -1
  73. package/src/protocol/dispatch.ts +1 -1
  74. package/src/protocol/handlers/aggregate.ts +13 -7
  75. package/src/protocol/handlers/catalog/admin.ts +6 -6
  76. package/src/protocol/handlers/catalog/index_methods.ts +2 -2
  77. package/src/protocol/handlers/catalog/macro.ts +4 -4
  78. package/src/protocol/handlers/catalog/shared.ts +2 -0
  79. package/src/protocol/handlers/catalog/table.ts +16 -16
  80. package/src/protocol/handlers/catalog/view.ts +5 -5
  81. package/src/protocol/handlers/function.ts +2 -2
  82. package/src/protocol/handlers/shared.ts +12 -3
  83. package/src/protocol/handlers/table-buffering.ts +4 -4
  84. package/src/protocol/serializers/bind.ts +15 -6
  85. package/src/protocol/serializers/splits.ts +4 -2
  86. package/src/protocol/types.ts +9 -3
  87. package/src/schema-path.ts +25 -0
  88. package/src/serve-entry.ts +65 -3
  89. package/src/split-token.ts +2 -2
  90. package/src/types.ts +9 -0
  91. package/src/worker.ts +49 -4
package/src/http/fetch.ts CHANGED
@@ -18,6 +18,9 @@ import {
18
18
  type DispatchHook,
19
19
  type DispatchInfo,
20
20
  type HookToken,
21
+ type PeerAuthenticationPolicy,
22
+ type PeerIdentityProvider,
23
+ type PeerResolutionOptions,
21
24
  type Protocol,
22
25
  } from "@query-farm/vgi-rpc";
23
26
  import { arrowStateSerializer } from "../protocol/state-serializer.js";
@@ -76,6 +79,12 @@ export interface VgiFetchOptions {
76
79
  * and the identity it returns is the one the worker seals `attach_opaque_data`
77
80
  * and split tokens under. */
78
81
  authenticate?: AuthenticateFn;
82
+ /** Off-wire transport identities, including a trusted Iroh HTTP bridge. */
83
+ peerIdentityProviders?: readonly PeerIdentityProvider[];
84
+ /** Policy composing peer evidence with application authentication. */
85
+ peerAuthenticationPolicy?: PeerAuthenticationPolicy;
86
+ /** Host adapter supplying the physical peer and multiplicity-preserving headers. */
87
+ peerResolutionContext?: (request: Request) => PeerResolutionOptions | Promise<PeerResolutionOptions>;
79
88
  }
80
89
 
81
90
  // ---------------------------------------------------------------------------
@@ -207,6 +216,9 @@ export function createVgiFetch(opts: VgiFetchOptions): (req: Request) => Promise
207
216
  // can still open the identity-bound attach and split envelopes.
208
217
  dispatchHook: REQUEST_AUTH_DISPATCH_HOOK,
209
218
  authenticate: opts.authenticate,
219
+ peerIdentityProviders: opts.peerIdentityProviders,
220
+ peerAuthenticationPolicy: opts.peerAuthenticationPolicy,
221
+ peerResolutionContext: opts.peerResolutionContext,
210
222
  // `null` is the explicit opt-out; `undefined` (omitted) means "*".
211
223
  corsOrigins: opts.corsOrigins === null ? undefined : (opts.corsOrigins ?? "*"),
212
224
  repositoryUrl: opts.repositoryUrl,
package/src/index.core.ts CHANGED
@@ -88,6 +88,7 @@ export {
88
88
  FunctionType,
89
89
  FunctionStability,
90
90
  NullHandling,
91
+ ArgumentMonotonicity,
91
92
  OrderPreservation,
92
93
  OrderDependence,
93
94
  DistinctDependence,
@@ -307,3 +308,4 @@ export type {
307
308
  export { str, bytes, int, int32, float, float32, bool, toSchema, OutputCollector, AuthContext } from "@query-farm/vgi-rpc";
308
309
  export { subprocessConnect, httpConnect, tcpConnect } from "@query-farm/vgi-rpc";
309
310
  export type { RpcClient, StreamSession, LogMessage } from "@query-farm/vgi-rpc";
311
+ export { normalizeSchemaPath, schemaPathDisplay, schemaPathKey, schemaPathsEqual, type SchemaPath } from "./schema-path.js";
@@ -4,6 +4,7 @@
4
4
  import {
5
5
  FunctionStability,
6
6
  NullHandling,
7
+ ArgumentMonotonicity,
7
8
  OrderPreservation,
8
9
  OrderDependence,
9
10
  DistinctDependence,
@@ -11,6 +12,7 @@ import {
11
12
  } from "../types.js";
12
13
  import type { VgiFunction } from "../functions/types.js";
13
14
  import type { ArgumentSpec } from "../arguments/argument-spec.js";
15
+ import { supportsExtensionFilterFunction } from "../filter-pushdown/capabilities.js";
14
16
  import {
15
17
  CatalogFunctionType,
16
18
  type ResolvedMetadata,
@@ -55,6 +57,19 @@ function specToParameterInfo(spec: ArgumentSpec): ParameterInfo {
55
57
  export function resolveMetadata(func: VgiFunction): ResolvedMetadata {
56
58
  const meta = func.meta;
57
59
 
60
+ if (meta.runtimeFilterAlgorithms?.length) {
61
+ throw new Error("TypeScript SDK has no registered runtime-filter artifact evaluator to advertise");
62
+ }
63
+ if (meta.filterEvaluationContexts?.length) {
64
+ throw new Error("TypeScript SDK has no isolated DuckDB session-context evaluator to advertise");
65
+ }
66
+ if (meta.filterSemanticProfiles?.some((value) => value !== "vgi.duckdb.standard.v1")) {
67
+ throw new Error("TypeScript SDK supports only vgi.duckdb.standard.v1 filter semantics");
68
+ }
69
+ if (meta.additionalFilterFunctions?.some((value) => !supportsExtensionFilterFunction(value))) {
70
+ throw new Error("TypeScript SDK cannot advertise an extension-filter function without an evaluator");
71
+ }
72
+
58
73
  let functionType: CatalogFunctionType;
59
74
  switch (func.kind) {
60
75
  case "scalar":
@@ -74,8 +89,28 @@ export function resolveMetadata(func: VgiFunction): ResolvedMetadata {
74
89
  functionType = CatalogFunctionType.TABLE;
75
90
  }
76
91
 
92
+ const argumentMonotonicity = meta.argumentMonotonicity ?? null;
93
+ if (argumentMonotonicity !== null && functionType !== CatalogFunctionType.SCALAR) {
94
+ throw new Error("argumentMonotonicity is only valid for scalar functions");
95
+ }
96
+
77
97
  const parameters: ParameterInfo[] = func.argumentSpecs.map(specToParameterInfo);
78
98
 
99
+ if (argumentMonotonicity !== null) {
100
+ if (argumentMonotonicity.length !== parameters.length) {
101
+ throw new Error(
102
+ `argumentMonotonicity has ${argumentMonotonicity.length} entries, ` +
103
+ `expected ${parameters.length} declaration slots`,
104
+ );
105
+ }
106
+ const allowed = new Set<string>(Object.values(ArgumentMonotonicity));
107
+ for (const [index, value] of argumentMonotonicity.entries()) {
108
+ if (!allowed.has(value)) {
109
+ throw new Error(`argumentMonotonicity[${index}] has unknown value ${String(value)}`);
110
+ }
111
+ }
112
+ }
113
+
79
114
  const examples: FunctionExample[] = (meta.examples ?? []).map((e) => ({
80
115
  sql: e.sql,
81
116
  description: e.description,
@@ -95,12 +130,19 @@ export function resolveMetadata(func: VgiFunction): ResolvedMetadata {
95
130
  parameters,
96
131
  stability: meta.stability ?? FunctionStability.CONSISTENT,
97
132
  nullHandling: meta.nullHandling ?? NullHandling.DEFAULT,
133
+ argumentMonotonicity,
98
134
  requiredSettings: meta.requiredSettings ?? [],
99
135
  requiredSecrets: meta.requiredSecrets ?? [],
100
136
  projectionPushdown: meta.projectionPushdown ?? false,
101
137
  filterPushdown: meta.filterPushdown ?? false,
102
138
  samplingPushdown: meta.samplingPushdown ?? false,
103
- supportedExpressionFilters: meta.supportedExpressionFilters ?? [],
139
+ filterSemanticProfiles: meta.filterSemanticProfiles ?? (meta.filterPushdown ? ["vgi.duckdb.standard.v1"] : []),
140
+ additionalFilterFunctions: meta.additionalFilterFunctions ?? [],
141
+ runtimeFilterAlgorithms: meta.runtimeFilterAlgorithms ?? [],
142
+ filterEvaluationContexts: (meta.filterEvaluationContexts ?? []).map((value) => ({
143
+ profile: value.profile,
144
+ providerFingerprint: value.providerFingerprint ?? null,
145
+ })),
104
146
  preservesOrder: meta.preservesOrder ?? OrderPreservation.NO_ORDER_GUARANTEE,
105
147
  maxWorkers: maxWorkers === DEFAULT_MAX_WORKERS ? null : maxWorkers,
106
148
  orderDependent: meta.orderDependent ?? OrderDependence.NOT_ORDER_DEPENDENT,
@@ -8,6 +8,7 @@ import {
8
8
  field,
9
9
  utf8,
10
10
  int32,
11
+ uint64,
11
12
  bool,
12
13
  list,
13
14
  struct as makeStruct,
@@ -16,6 +17,7 @@ import {
16
17
  emptyBatch,
17
18
  } from "../arrow/index.js";
18
19
  import type { ResolvedMetadata, ParameterInfo, FunctionExample } from "./types.js";
20
+ import type { ArgumentMonotonicity } from "../types.js";
19
21
 
20
22
  // ============================================================================
21
23
  // Schema definitions matching Python's _METADATA_SCHEMA exactly
@@ -41,6 +43,17 @@ const PARAMETER_STRUCT = makeStruct([
41
43
  field("is_const", bool(), false),
42
44
  ]);
43
45
 
46
+ const FILTER_IDENTITY_STRUCT = makeStruct([
47
+ field("namespace", utf8(), false),
48
+ field("name", utf8(), false),
49
+ field("version", uint64(), false),
50
+ ]);
51
+
52
+ const FILTER_CONTEXT_STRUCT = makeStruct([
53
+ field("profile", utf8(), false),
54
+ field("provider_fingerprint", utf8(), true),
55
+ ]);
56
+
44
57
  const METADATA_SCHEMA = makeSchema([
45
58
  field("name", utf8(), false),
46
59
  field("class_name", utf8(), false),
@@ -52,10 +65,15 @@ const METADATA_SCHEMA = makeSchema([
52
65
  field("parameters", list(field("item", PARAMETER_STRUCT, true)), false),
53
66
  field("stability", utf8(), false),
54
67
  field("null_handling", utf8(), false),
68
+ field("argument_monotonicity", list(field("item", utf8(), true)), true),
55
69
  field("required_settings", list(field("item", utf8(), true)), false),
56
70
  field("required_secrets", list(field("item", utf8(), true)), false),
57
71
  field("projection_pushdown", bool(), false),
58
72
  field("filter_pushdown", bool(), false),
73
+ field("filter_semantic_profiles", list(field("item", utf8(), true)), false),
74
+ field("additional_filter_functions", list(field("item", FILTER_IDENTITY_STRUCT, true)), false),
75
+ field("runtime_filter_algorithms", list(field("item", FILTER_IDENTITY_STRUCT, true)), false),
76
+ field("filter_evaluation_contexts", list(field("item", FILTER_CONTEXT_STRUCT, true)), false),
59
77
  field("preserves_order", utf8(), false),
60
78
  field("max_workers", int32(), true),
61
79
  field("order_dependent", utf8(), false),
@@ -96,12 +114,23 @@ function metadataToRow(m: ResolvedMetadata): Record<string, any> {
96
114
  })),
97
115
  stability: m.stability,
98
116
  null_handling: m.nullHandling,
117
+ argument_monotonicity: m.argumentMonotonicity,
99
118
  required_settings: m.requiredSettings,
100
119
  required_secrets: m.requiredSecrets,
101
120
  projection_pushdown: m.projectionPushdown,
102
121
  filter_pushdown: m.filterPushdown,
103
122
  sampling_pushdown: m.samplingPushdown,
104
- supported_expression_filters: m.supportedExpressionFilters,
123
+ filter_semantic_profiles: m.filterSemanticProfiles,
124
+ additional_filter_functions: m.additionalFilterFunctions.map((value) => ({
125
+ ...value, version: BigInt(value.version),
126
+ })),
127
+ runtime_filter_algorithms: m.runtimeFilterAlgorithms.map((value) => ({
128
+ ...value, version: BigInt(value.version),
129
+ })),
130
+ filter_evaluation_contexts: m.filterEvaluationContexts.map((value) => ({
131
+ profile: value.profile,
132
+ provider_fingerprint: value.providerFingerprint,
133
+ })),
105
134
  preserves_order: m.preservesOrder,
106
135
  max_workers: m.maxWorkers,
107
136
  order_dependent: m.orderDependent,
@@ -222,15 +251,24 @@ export function arrowToMetadatas(batch: VgiBatch): ResolvedMetadata[] {
222
251
  parameters,
223
252
  stability: (get("stability") as any) ?? "CONSISTENT",
224
253
  nullHandling: (get("null_handling") as any) ?? "DEFAULT",
254
+ argumentMonotonicity: get("argument_monotonicity") == null
255
+ ? null
256
+ : [...(get("argument_monotonicity") as any)].map(String) as ArgumentMonotonicity[],
225
257
  requiredSettings,
226
258
  requiredSecrets,
227
259
  projectionPushdown: (get("projection_pushdown") as boolean) ?? false,
228
260
  filterPushdown: (get("filter_pushdown") as boolean) ?? false,
229
261
  samplingPushdown: (get("sampling_pushdown") as boolean) ?? false,
230
- supportedExpressionFilters: (() => {
231
- const raw = get("supported_expression_filters") as any ?? [];
232
- return raw ? [...raw].filter((s: any) => s != null).map(String) : [];
233
- })(),
262
+ filterSemanticProfiles: [...((get("filter_semantic_profiles") as any) ?? [])].filter((s: any) => s != null).map(String),
263
+ additionalFilterFunctions: [...((get("additional_filter_functions") as any) ?? [])].filter((v: any) => v != null).map((v: any) => ({
264
+ namespace: String(v.namespace), name: String(v.name), version: Number(v.version),
265
+ })),
266
+ runtimeFilterAlgorithms: [...((get("runtime_filter_algorithms") as any) ?? [])].filter((v: any) => v != null).map((v: any) => ({
267
+ namespace: String(v.namespace), name: String(v.name), version: Number(v.version),
268
+ })),
269
+ filterEvaluationContexts: [...((get("filter_evaluation_contexts") as any) ?? [])].filter((v: any) => v != null).map((v: any) => ({
270
+ profile: String(v.profile), providerFingerprint: v.provider_fingerprint == null ? null : String(v.provider_fingerprint),
271
+ })),
234
272
  preservesOrder: (get("preserves_order") as any) ?? "NO_ORDER_GUARANTEE",
235
273
  maxWorkers: (get("max_workers") as number | null) ?? null,
236
274
  orderDependent: (get("order_dependent") as any) ?? "NOT_ORDER_DEPENDENT",
@@ -4,6 +4,7 @@
4
4
  import {
5
5
  FunctionStability,
6
6
  NullHandling,
7
+ ArgumentMonotonicity,
7
8
  OrderPreservation,
8
9
  OrderDependence,
9
10
  DistinctDependence,
@@ -36,6 +37,17 @@ export interface FunctionExample {
36
37
  expectedOutput: string | null;
37
38
  }
38
39
 
40
+ export interface FilterFunctionCapability {
41
+ namespace: string;
42
+ name: string;
43
+ version: number;
44
+ }
45
+
46
+ export interface EvaluationContextCapability {
47
+ profile: string;
48
+ providerFingerprint: string | null;
49
+ }
50
+
39
51
  export interface ResolvedMetadata {
40
52
  name: string;
41
53
  className: string;
@@ -47,12 +59,16 @@ export interface ResolvedMetadata {
47
59
  parameters: ParameterInfo[];
48
60
  stability: FunctionStability;
49
61
  nullHandling: NullHandling;
62
+ argumentMonotonicity: ArgumentMonotonicity[] | null;
50
63
  requiredSettings: string[];
51
64
  requiredSecrets: string[];
52
65
  projectionPushdown: boolean;
53
66
  filterPushdown: boolean;
54
67
  samplingPushdown: boolean;
55
- supportedExpressionFilters: string[];
68
+ filterSemanticProfiles: string[];
69
+ additionalFilterFunctions: FilterFunctionCapability[];
70
+ runtimeFilterAlgorithms: FilterFunctionCapability[];
71
+ filterEvaluationContexts: EvaluationContextCapability[];
56
72
  preservesOrder: OrderPreservation;
57
73
  maxWorkers: number | null;
58
74
  orderDependent: OrderDependence;
@@ -37,7 +37,7 @@ export interface ProtocolConfig {
37
37
  }
38
38
 
39
39
  export function buildVgiProtocol(config: ProtocolConfig): Protocol {
40
- const protocol = new Protocol("vgi");
40
+ const protocol = new Protocol("vgi", { protocolVersion: "2.0.0" });
41
41
 
42
42
  registerFunctionMethods(protocol, {
43
43
  registry: config.registry,
@@ -46,19 +46,19 @@ import {
46
46
  } from "./shared.js";
47
47
 
48
48
  export function registerAggregateMethods(protocol: Protocol, registry: FunctionRegistry): void {
49
- // `schemaName` scopes resolution to the schema the caller named. Every
49
+ // `schemaPath` scopes resolution to the schema the caller named. Every
50
50
  // aggregate RPC carries it (protocol 1.2.0), so an aggregate name declared in
51
51
  // two schemas dispatches to the one the request names rather than colliding
52
52
  // on the flat by-name index. `null` (no schema) keeps the cross-schema lookup.
53
53
  function resolveAggregate(
54
54
  name: string,
55
- schemaName?: string | null,
55
+ schemaPath?: string[] | null,
56
56
  ): AggregateFunctionConfig<any, any> {
57
57
  const func = registry.get(name, {
58
58
  arguments: new Arguments(),
59
59
  inputSchema: null,
60
60
  isScalar: false,
61
- schemaName: schemaName ?? null,
61
+ schemaPath: schemaPath ?? null,
62
62
  }) as any;
63
63
  if (!func || func.kind !== "aggregate") {
64
64
  throw new Error(`Function '${name}' is not an aggregate function`);
@@ -75,7 +75,7 @@ export function registerAggregateMethods(protocol: Protocol, registry: FunctionR
75
75
  handler: async (params) => {
76
76
  const innerParams = unwrapRequest(params.request);
77
77
  const functionName: string = innerParams.function_name;
78
- const cfg = resolveAggregate(functionName, innerParams.schema_name ?? null);
78
+ const cfg = resolveAggregate(functionName, innerParams.schema_path ?? null);
79
79
  const argBytes = toUint8Array(innerParams.arguments);
80
80
  const args = deserializeArguments(argBytes);
81
81
  const inputSchema = innerParams.input_schema
@@ -95,6 +95,12 @@ export function registerAggregateMethods(protocol: Protocol, registry: FunctionR
95
95
  inputSchema,
96
96
  settings: {},
97
97
  secrets,
98
+ argumentNames: innerParams.argument_names
99
+ ? (Array.isArray(innerParams.argument_names)
100
+ ? innerParams.argument_names
101
+ : [...innerParams.argument_names])
102
+ .map((value: unknown) => value == null ? null : String(value))
103
+ : null,
98
104
  };
99
105
  const executionId = new Uint8Array(16);
100
106
  crypto.getRandomValues(executionId);
@@ -126,7 +132,7 @@ export function registerAggregateMethods(protocol: Protocol, registry: FunctionR
126
132
  const innerParams = unwrapRequest(params.request);
127
133
  const functionName: string = innerParams.function_name;
128
134
  const executionId = toUint8Array(innerParams.execution_id);
129
- const cfg = resolveAggregate(functionName, innerParams.schema_name ?? null);
135
+ const cfg = resolveAggregate(functionName, innerParams.schema_path ?? null);
130
136
  const batch = readSingleBatch(toUint8Array(innerParams.input_batch));
131
137
  if (!batch || batch.numRows === 0) return wrapResult({}, makeSchema([]));
132
138
 
@@ -193,7 +199,7 @@ export function registerAggregateMethods(protocol: Protocol, registry: FunctionR
193
199
  const innerParams = unwrapRequest(params.request);
194
200
  const functionName: string = innerParams.function_name;
195
201
  const executionId = toUint8Array(innerParams.execution_id);
196
- const cfg = resolveAggregate(functionName, innerParams.schema_name ?? null);
202
+ const cfg = resolveAggregate(functionName, innerParams.schema_path ?? null);
197
203
  const batch = readSingleBatch(toUint8Array(innerParams.merge_batch));
198
204
  if (!batch || batch.numRows === 0) return wrapResult({}, makeSchema([]));
199
205
 
@@ -242,7 +248,7 @@ export function registerAggregateMethods(protocol: Protocol, registry: FunctionR
242
248
  const innerParams = unwrapRequest(params.request);
243
249
  const functionName: string = innerParams.function_name;
244
250
  const executionId = toUint8Array(innerParams.execution_id);
245
- const cfg = resolveAggregate(functionName, innerParams.schema_name ?? null);
251
+ const cfg = resolveAggregate(functionName, innerParams.schema_path ?? null);
246
252
  const outputSchema = deserializeSchema(toUint8Array(innerParams.output_schema));
247
253
  const gidBatch = readSingleBatch(toUint8Array(innerParams.group_ids_batch));
248
254
  const groupIds: bigint[] = [];
@@ -271,7 +271,7 @@ export function registerCatalogAdminMethods(protocol: Protocol, getCatalog: GetC
271
271
  const cat = getCatalog();
272
272
  const info = await cat.schemaGet(
273
273
  toUint8Array(params.attach_opaque_data),
274
- params.name,
274
+ params.path,
275
275
  params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined
276
276
  );
277
277
  return wrapResult({
@@ -288,7 +288,7 @@ export function registerCatalogAdminMethods(protocol: Protocol, getCatalog: GetC
288
288
  const cat = getCatalog();
289
289
  await cat.schemaCreate(
290
290
  toUint8Array(params.attach_opaque_data),
291
- params.name,
291
+ params.path,
292
292
  params.comment,
293
293
  null, // tags
294
294
  params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined
@@ -305,7 +305,7 @@ export function registerCatalogAdminMethods(protocol: Protocol, getCatalog: GetC
305
305
  const cat = getCatalog();
306
306
  await cat.schemaDrop(
307
307
  toUint8Array(params.attach_opaque_data),
308
- params.name,
308
+ params.path,
309
309
  params.ignore_not_found,
310
310
  params.cascade,
311
311
  params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined
@@ -322,7 +322,7 @@ export function registerCatalogAdminMethods(protocol: Protocol, getCatalog: GetC
322
322
  const cat = getCatalog();
323
323
  const tables = await cat.schemaContentsTables(
324
324
  toUint8Array(params.attach_opaque_data),
325
- params.name,
325
+ params.path,
326
326
  params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined
327
327
  );
328
328
  return wrapResult({
@@ -339,7 +339,7 @@ export function registerCatalogAdminMethods(protocol: Protocol, getCatalog: GetC
339
339
  const cat = getCatalog();
340
340
  const views = await cat.schemaContentsViews(
341
341
  toUint8Array(params.attach_opaque_data),
342
- params.name,
342
+ params.path,
343
343
  params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined
344
344
  );
345
345
  return wrapResult({
@@ -356,7 +356,7 @@ export function registerCatalogAdminMethods(protocol: Protocol, getCatalog: GetC
356
356
  const cat = getCatalog();
357
357
  const funcs = await cat.schemaContentsFunctions(
358
358
  toUint8Array(params.attach_opaque_data),
359
- params.name,
359
+ params.path,
360
360
  decodeDictValue(params.type),
361
361
  params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined
362
362
  );
@@ -29,7 +29,7 @@ export function registerCatalogIndexMethods(protocol: Protocol, getCatalog: GetC
29
29
  const cat = getCatalog();
30
30
  const indexes = await cat.schemaContentsIndexes(
31
31
  toUint8Array(params.attach_opaque_data),
32
- params.name,
32
+ params.path,
33
33
  params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined,
34
34
  );
35
35
  return wrapResult({
@@ -46,7 +46,7 @@ export function registerCatalogIndexMethods(protocol: Protocol, getCatalog: GetC
46
46
  const cat = getCatalog();
47
47
  const info = await cat.indexGet(
48
48
  toUint8Array(params.attach_opaque_data),
49
- params.schema_name,
49
+ params.schema_path,
50
50
  params.name,
51
51
  params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined,
52
52
  );
@@ -36,7 +36,7 @@ export function registerCatalogMacroMethods(protocol: Protocol, getCatalog: GetC
36
36
  const cat = getCatalog();
37
37
  const info = await cat.macroGet(
38
38
  toUint8Array(params.attach_opaque_data),
39
- params.schema_name,
39
+ params.schema_path,
40
40
  params.name,
41
41
  params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined
42
42
  );
@@ -55,7 +55,7 @@ export function registerCatalogMacroMethods(protocol: Protocol, getCatalog: GetC
55
55
  const innerParams = unwrapRequest(params.request);
56
56
  await cat.macroCreate(
57
57
  toUint8Array(innerParams.attach_opaque_data),
58
- innerParams.schema_name,
58
+ innerParams.schema_path,
59
59
  innerParams.name,
60
60
  innerParams.macro_type as MacroType,
61
61
  innerParams.parameters ? (Array.isArray(innerParams.parameters) ? innerParams.parameters : [...innerParams.parameters]) : [],
@@ -77,7 +77,7 @@ export function registerCatalogMacroMethods(protocol: Protocol, getCatalog: GetC
77
77
  const cat = getCatalog();
78
78
  await cat.macroDrop(
79
79
  toUint8Array(params.attach_opaque_data),
80
- params.schema_name,
80
+ params.schema_path,
81
81
  params.name,
82
82
  params.ignore_not_found,
83
83
  params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined
@@ -94,7 +94,7 @@ export function registerCatalogMacroMethods(protocol: Protocol, getCatalog: GetC
94
94
  const cat = getCatalog();
95
95
  const macros = await cat.schemaContentsMacros(
96
96
  toUint8Array(params.attach_opaque_data),
97
- params.name,
97
+ params.path,
98
98
  decodeDictValue(params.type),
99
99
  params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined
100
100
  );
@@ -7,6 +7,7 @@ import type { CatalogInterface } from "../../../catalog/interface.js";
7
7
  import { NoCatalogError } from "../../../errors.js";
8
8
  import { deserializeBatch } from "../../../util/arrow/index.js";
9
9
  import { toUint8Array } from "../../../util/bytes.js";
10
+ import { normalizeRequestSchemaPaths } from "../shared.js";
10
11
  import {
11
12
  sealBytes,
12
13
  openBytes,
@@ -194,6 +195,7 @@ export function catalogUnary(
194
195
  result: config.result as any,
195
196
  doc: config.doc,
196
197
  handler: async (params: Record<string, any>, ctx: any) => {
198
+ normalizeRequestSchemaPaths(params);
197
199
  await unwrapParamsOpaque(params, ctx, signingKey);
198
200
  return config.handler(params, ctx);
199
201
  },
@@ -47,7 +47,7 @@ export function registerCatalogTableMethods(protocol: Protocol, getCatalog: GetC
47
47
  const cat = getCatalog();
48
48
  const info = await cat.tableGet(
49
49
  toUint8Array(params.attach_opaque_data),
50
- params.schema_name,
50
+ params.schema_path,
51
51
  params.name,
52
52
  params.at_unit,
53
53
  params.at_value,
@@ -67,7 +67,7 @@ export function registerCatalogTableMethods(protocol: Protocol, getCatalog: GetC
67
67
  const cat = getCatalog();
68
68
  await cat.tableCreate(
69
69
  toUint8Array(params.attach_opaque_data),
70
- params.schema_name,
70
+ params.schema_path,
71
71
  params.name,
72
72
  toUint8Array(params.columns),
73
73
  params.on_conflict,
@@ -88,7 +88,7 @@ export function registerCatalogTableMethods(protocol: Protocol, getCatalog: GetC
88
88
  const cat = getCatalog();
89
89
  await cat.tableDrop(
90
90
  toUint8Array(params.attach_opaque_data),
91
- params.schema_name,
91
+ params.schema_path,
92
92
  params.name,
93
93
  params.ignore_not_found,
94
94
  params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined
@@ -105,7 +105,7 @@ export function registerCatalogTableMethods(protocol: Protocol, getCatalog: GetC
105
105
  const cat = getCatalog();
106
106
  const stats = await cat.tableColumnStatisticsGet(
107
107
  toUint8Array(params.attach_opaque_data),
108
- params.schema_name,
108
+ params.schema_path,
109
109
  params.name,
110
110
  params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined,
111
111
  );
@@ -121,7 +121,7 @@ export function registerCatalogTableMethods(protocol: Protocol, getCatalog: GetC
121
121
  const cat = getCatalog();
122
122
  const scanResult = await cat.tableScanFunctionGet(
123
123
  toUint8Array(params.attach_opaque_data),
124
- params.schema_name,
124
+ params.schema_path,
125
125
  params.name,
126
126
  params.at_unit,
127
127
  params.at_value,
@@ -141,7 +141,7 @@ export function registerCatalogTableMethods(protocol: Protocol, getCatalog: GetC
141
141
  const cat = getCatalog();
142
142
  const branchesResult = await cat.tableScanBranchesGet(
143
143
  toUint8Array(params.attach_opaque_data),
144
- params.schema_name,
144
+ params.schema_path,
145
145
  params.name,
146
146
  params.at_unit,
147
147
  params.at_value,
@@ -159,7 +159,7 @@ export function registerCatalogTableMethods(protocol: Protocol, getCatalog: GetC
159
159
  const cat = getCatalog();
160
160
  await cat.tableCommentSet(
161
161
  toUint8Array(params.attach_opaque_data),
162
- params.schema_name,
162
+ params.schema_path,
163
163
  params.name,
164
164
  params.comment,
165
165
  params.ignore_not_found,
@@ -177,7 +177,7 @@ export function registerCatalogTableMethods(protocol: Protocol, getCatalog: GetC
177
177
  const cat = getCatalog();
178
178
  await cat.tableRename(
179
179
  toUint8Array(params.attach_opaque_data),
180
- params.schema_name,
180
+ params.schema_path,
181
181
  params.name,
182
182
  params.new_name,
183
183
  params.ignore_not_found,
@@ -195,7 +195,7 @@ export function registerCatalogTableMethods(protocol: Protocol, getCatalog: GetC
195
195
  const cat = getCatalog();
196
196
  await cat.tableColumnAdd(
197
197
  toUint8Array(params.attach_opaque_data),
198
- params.schema_name,
198
+ params.schema_path,
199
199
  params.name,
200
200
  params.column_name,
201
201
  params.column_type,
@@ -215,7 +215,7 @@ export function registerCatalogTableMethods(protocol: Protocol, getCatalog: GetC
215
215
  const cat = getCatalog();
216
216
  await cat.tableColumnDrop(
217
217
  toUint8Array(params.attach_opaque_data),
218
- params.schema_name,
218
+ params.schema_path,
219
219
  params.name,
220
220
  params.column_name,
221
221
  params.ignore_not_found,
@@ -233,7 +233,7 @@ export function registerCatalogTableMethods(protocol: Protocol, getCatalog: GetC
233
233
  const cat = getCatalog();
234
234
  await cat.tableColumnRename(
235
235
  toUint8Array(params.attach_opaque_data),
236
- params.schema_name,
236
+ params.schema_path,
237
237
  params.name,
238
238
  params.column_name,
239
239
  params.new_name,
@@ -252,7 +252,7 @@ export function registerCatalogTableMethods(protocol: Protocol, getCatalog: GetC
252
252
  const cat = getCatalog();
253
253
  await cat.tableColumnDefaultSet(
254
254
  toUint8Array(params.attach_opaque_data),
255
- params.schema_name,
255
+ params.schema_path,
256
256
  params.name,
257
257
  params.column_name,
258
258
  params.default_value,
@@ -271,7 +271,7 @@ export function registerCatalogTableMethods(protocol: Protocol, getCatalog: GetC
271
271
  const cat = getCatalog();
272
272
  await cat.tableColumnDefaultDrop(
273
273
  toUint8Array(params.attach_opaque_data),
274
- params.schema_name,
274
+ params.schema_path,
275
275
  params.name,
276
276
  params.column_name,
277
277
  params.ignore_not_found,
@@ -289,7 +289,7 @@ export function registerCatalogTableMethods(protocol: Protocol, getCatalog: GetC
289
289
  const cat = getCatalog();
290
290
  await cat.tableColumnTypeChange(
291
291
  toUint8Array(params.attach_opaque_data),
292
- params.schema_name,
292
+ params.schema_path,
293
293
  params.name,
294
294
  params.column_name,
295
295
  params.new_type,
@@ -308,7 +308,7 @@ export function registerCatalogTableMethods(protocol: Protocol, getCatalog: GetC
308
308
  const cat = getCatalog();
309
309
  await cat.tableNotNullSet(
310
310
  toUint8Array(params.attach_opaque_data),
311
- params.schema_name,
311
+ params.schema_path,
312
312
  params.name,
313
313
  params.column_name,
314
314
  params.ignore_not_found,
@@ -326,7 +326,7 @@ export function registerCatalogTableMethods(protocol: Protocol, getCatalog: GetC
326
326
  const cat = getCatalog();
327
327
  await cat.tableNotNullDrop(
328
328
  toUint8Array(params.attach_opaque_data),
329
- params.schema_name,
329
+ params.schema_path,
330
330
  params.name,
331
331
  params.column_name,
332
332
  params.ignore_not_found,
@@ -32,7 +32,7 @@ export function registerCatalogViewMethods(protocol: Protocol, getCatalog: GetCa
32
32
  const cat = getCatalog();
33
33
  const info = await cat.viewGet(
34
34
  toUint8Array(params.attach_opaque_data),
35
- params.schema_name,
35
+ params.schema_path,
36
36
  params.name,
37
37
  params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined
38
38
  );
@@ -50,7 +50,7 @@ export function registerCatalogViewMethods(protocol: Protocol, getCatalog: GetCa
50
50
  const cat = getCatalog();
51
51
  await cat.viewCreate(
52
52
  toUint8Array(params.attach_opaque_data),
53
- params.schema_name,
53
+ params.schema_path,
54
54
  params.name,
55
55
  params.definition,
56
56
  params.on_conflict,
@@ -68,7 +68,7 @@ export function registerCatalogViewMethods(protocol: Protocol, getCatalog: GetCa
68
68
  const cat = getCatalog();
69
69
  await cat.viewDrop(
70
70
  toUint8Array(params.attach_opaque_data),
71
- params.schema_name,
71
+ params.schema_path,
72
72
  params.name,
73
73
  params.ignore_not_found,
74
74
  params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined
@@ -85,7 +85,7 @@ export function registerCatalogViewMethods(protocol: Protocol, getCatalog: GetCa
85
85
  const cat = getCatalog();
86
86
  await cat.viewRename(
87
87
  toUint8Array(params.attach_opaque_data),
88
- params.schema_name,
88
+ params.schema_path,
89
89
  params.name,
90
90
  params.new_name,
91
91
  params.ignore_not_found,
@@ -103,7 +103,7 @@ export function registerCatalogViewMethods(protocol: Protocol, getCatalog: GetCa
103
103
  const cat = getCatalog();
104
104
  await cat.viewCommentSet(
105
105
  toUint8Array(params.attach_opaque_data),
106
- params.schema_name,
106
+ params.schema_path,
107
107
  params.name,
108
108
  params.comment,
109
109
  params.ignore_not_found,