@query-farm/vgi 0.46.0 → 0.47.1

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 (93) hide show
  1. package/README.md +11 -5
  2. package/dist/arrow/impl-arrowjs/index.d.ts +1 -1
  3. package/dist/arrow/impl-arrowjs/iterate.d.ts +2 -0
  4. package/dist/arrow/impl-flechette/index.d.ts +1 -1
  5. package/dist/arrow/impl-flechette/iterate.d.ts +2 -0
  6. package/dist/arrow/index.d.ts +1 -1
  7. package/dist/catalog/column-expressions.d.ts +8 -0
  8. package/dist/catalog/column-metadata.d.ts +11 -0
  9. package/dist/catalog/composite.d.ts +2 -1
  10. package/dist/catalog/constraints.d.ts +74 -0
  11. package/dist/catalog/descriptors.d.ts +21 -29
  12. package/dist/catalog/interface.d.ts +15 -20
  13. package/dist/catalog/macro-overloads.d.ts +4 -0
  14. package/dist/catalog/read-only.d.ts +7 -1
  15. package/dist/catalog/unconstrained-columns.d.ts +2 -0
  16. package/dist/client/client.d.ts +18 -13
  17. package/dist/client-entry.js +753 -103
  18. package/dist/client-entry.js.map +16 -14
  19. package/dist/functions/projection.d.ts +18 -0
  20. package/dist/functions/table.d.ts +6 -1
  21. package/dist/functions/types.d.ts +1 -0
  22. package/dist/generated/vgi-client.d.ts +177 -36
  23. package/dist/generated/vgi-protocol-schemas.d.ts +51 -1
  24. package/dist/generated/vgi-protocol-types.d.ts +317 -3
  25. package/dist/generated/vgi-service.d.ts +266 -29
  26. package/dist/index.core.d.ts +3 -1
  27. package/dist/index.js +1630 -240
  28. package/dist/index.js.map +41 -34
  29. package/dist/protocol/dispatch.d.ts +9 -9
  30. package/dist/protocol/handlers/aggregate.d.ts +1 -1
  31. package/dist/protocol/handlers/catalog/index.d.ts +1 -1
  32. package/dist/protocol/handlers/catalog/metadata.d.ts +1 -0
  33. package/dist/protocol/handlers/function.d.ts +1 -1
  34. package/dist/protocol/handlers/table-buffering.d.ts +1 -1
  35. package/dist/protocol/handlers/unimplemented.d.ts +1 -1
  36. package/dist/protocol/serializers/bind.d.ts +5 -1
  37. package/dist/protocol/types.d.ts +5 -0
  38. package/dist/rpc-server.d.ts +6 -6
  39. package/dist/serve-entry.js +1613 -447
  40. package/dist/serve-entry.js.map +32 -26
  41. package/dist/util/arrow/index.d.ts +1 -1
  42. package/dist/worker-cf-entry.d.ts +2 -2
  43. package/dist/worker-cf-entry.js +1943 -572
  44. package/dist/worker-cf-entry.js.map +41 -34
  45. package/dist/worker.d.ts +1 -1
  46. package/package.json +5 -4
  47. package/src/arrow/impl-arrowjs/index.ts +1 -1
  48. package/src/arrow/impl-arrowjs/iterate.ts +9 -1
  49. package/src/arrow/impl-arrowjs/project.ts +1 -1
  50. package/src/arrow/impl-flechette/index.ts +1 -1
  51. package/src/arrow/impl-flechette/ipc.ts +12 -0
  52. package/src/arrow/impl-flechette/iterate.ts +5 -0
  53. package/src/arrow/impl-flechette/project.ts +6 -8
  54. package/src/arrow/index.ts +1 -1
  55. package/src/catalog/column-expressions.ts +224 -0
  56. package/src/catalog/column-metadata.ts +151 -0
  57. package/src/catalog/composite.ts +5 -1
  58. package/src/catalog/constraints.ts +207 -0
  59. package/src/catalog/contents-codec.ts +6 -1
  60. package/src/catalog/descriptors.ts +21 -29
  61. package/src/catalog/interface.ts +70 -55
  62. package/src/catalog/macro-overloads.ts +44 -0
  63. package/src/catalog/read-only.ts +92 -71
  64. package/src/catalog/unconstrained-columns.ts +23 -0
  65. package/src/client/client.ts +100 -58
  66. package/src/codec/asd.ts +3 -1
  67. package/src/functions/projection.ts +207 -0
  68. package/src/functions/table.ts +10 -0
  69. package/src/functions/types.ts +1 -0
  70. package/src/generated/vgi-client.ts +199 -37
  71. package/src/generated/vgi-protocol-schemas.ts +455 -41
  72. package/src/generated/vgi-protocol-types.ts +879 -5
  73. package/src/generated/vgi-service.ts +514 -42
  74. package/src/http/client-bundle.ts +1 -1
  75. package/src/http/fetch.ts +1 -1
  76. package/src/index.core.ts +5 -0
  77. package/src/protocol/dispatch.ts +9 -9
  78. package/src/protocol/handlers/aggregate.ts +1 -1
  79. package/src/protocol/handlers/catalog/admin.ts +27 -6
  80. package/src/protocol/handlers/catalog/index.ts +2 -2
  81. package/src/protocol/handlers/catalog/macro.ts +6 -5
  82. package/src/protocol/handlers/catalog/metadata.ts +16 -0
  83. package/src/protocol/handlers/catalog/table.ts +72 -26
  84. package/src/protocol/handlers/catalog/view.ts +24 -3
  85. package/src/protocol/handlers/function.ts +67 -1
  86. package/src/protocol/handlers/table-buffering.ts +1 -1
  87. package/src/protocol/handlers/unimplemented.ts +6 -6
  88. package/src/protocol/serializers/bind.ts +17 -1
  89. package/src/protocol/types.ts +6 -0
  90. package/src/rpc-server.ts +9 -9
  91. package/src/util/arrow/index.ts +1 -1
  92. package/src/worker-cf-entry.ts +6 -0
  93. package/src/worker.ts +1 -1
package/src/codec/asd.ts CHANGED
@@ -189,7 +189,9 @@ function normalizeValue(raw: any, type: VgiDataType): any {
189
189
  const valueType = ((entries as any).children as VgiField[])[1].type;
190
190
  const out: Record<string, any> = {};
191
191
  const put = (k: unknown, v: unknown): void => {
192
- out[String(k)] = normalizeValue(v, valueType);
192
+ Object.defineProperty(out, String(k), {
193
+ value: normalizeValue(v, valueType), enumerable: true, writable: true, configurable: true,
194
+ });
193
195
  };
194
196
  // arrow-js MapRow is iterable of [k,v]; flechette returns [[k,v],...] arrays.
195
197
  if (raw[Symbol.iterator]) {
@@ -0,0 +1,207 @@
1
+ // Copyright 2025, 2026 Query Farm LLC - https://query.farm
2
+ import {
3
+ schema,
4
+ serializeSchema,
5
+ deserializeBatch,
6
+ type VgiSchema,
7
+ } from "../arrow/index.js";
8
+ import { validateEncoded } from "../catalog/column-expressions.js";
9
+ import { decodeSqlExpression } from "../generated/vgi-protocol-types.js";
10
+ import { batchToScalarDict } from "../util/arrow/index.js";
11
+ import type { BindRequest, BindResponse } from "../protocol/types.js";
12
+ import {
13
+ normalizeBindRepeatability,
14
+ parseBindRepeatability,
15
+ } from "../protocol/serializers/bind.js";
16
+ export const SCALAR_PROJECTION_PROFILE = "vgi.expression.duckdb.scalar.v1";
17
+ export interface ProjectionProposal {
18
+ bindCall: BindRequest;
19
+ bindResult: BindResponse;
20
+ expressions: Uint8Array[];
21
+ resultSchema: VgiSchema;
22
+ }
23
+ export interface ProjectionAcceptance {
24
+ acceptedIndices: number[];
25
+ bindResult: BindResponse | null;
26
+ }
27
+ /** Strict envelope boundary for the projection RPC and its original bind records. */
28
+ export function projectionRecord(
29
+ bytes: Uint8Array,
30
+ expected: VgiSchema,
31
+ ): Record<string, any> {
32
+ if (!bytes.length || bytes.length > 8 * 1024 * 1024)
33
+ throw new Error("invalid projection record size");
34
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
35
+ let offset = 0,
36
+ schemas = 0,
37
+ batches = 0;
38
+ while (offset < bytes.length) {
39
+ if (bytes.length - offset < 4)
40
+ throw new Error("truncated projection IPC prefix");
41
+ const prefix = view.getInt32(offset, true) === -1 ? 8 : 4;
42
+ if (bytes.length - offset < prefix)
43
+ throw new Error("truncated projection IPC prefix");
44
+ const length = view.getInt32(offset + prefix - 4, true);
45
+ offset += prefix;
46
+ if (length === 0) {
47
+ break;
48
+ }
49
+ if (length < 0 || offset + length > bytes.length)
50
+ throw new Error("invalid projection IPC message");
51
+ const table = offset + view.getUint32(offset, true);
52
+ const vtable = table - view.getInt32(table, true);
53
+ const slot = (id: number) =>
54
+ 4 + id * 2 < view.getUint16(vtable, true)
55
+ ? view.getUint16(vtable + 4 + id * 2, true)
56
+ : 0;
57
+ const kindSlot = slot(1),
58
+ bodySlot = slot(3);
59
+ const kind = kindSlot ? view.getUint8(table + kindSlot) : 0;
60
+ const body = bodySlot
61
+ ? Number(view.getBigInt64(table + bodySlot, true))
62
+ : 0;
63
+ if (
64
+ body < 0 ||
65
+ body > bytes.length - offset - length ||
66
+ !Number.isSafeInteger(body)
67
+ )
68
+ throw new Error("invalid projection IPC body");
69
+ if (kind === 1 && schemas === 0 && batches === 0) schemas++;
70
+ else if (kind === 2 && schemas === 1 && batches === 0) {
71
+ /* dictionary before record */
72
+ } else if (kind === 3 && schemas === 1 && batches === 0) batches++;
73
+ else throw new Error("projection requires one complete IPC batch");
74
+ offset += length + body;
75
+ }
76
+ // Arrow permits physical EOF after a complete message, with or without EOS.
77
+ if (offset !== bytes.length || schemas !== 1 || batches !== 1)
78
+ throw new Error("projection requires one complete IPC batch");
79
+ const batch = deserializeBatch(bytes);
80
+ // IPC dictionary ids are stream-local and may be reassigned on re-encoding.
81
+ // Compare the exact Arrow shape and metadata instead of those transport ids.
82
+ const metadata = (m: ReadonlyMap<string, string>) =>
83
+ [...m].sort(([a], [b]) => a.localeCompare(b));
84
+ const fieldShape = (f: any): unknown => [
85
+ f.name,
86
+ f.nullable,
87
+ String(f.type),
88
+ metadata(f.metadata),
89
+ (f.type.children ?? []).map(fieldShape),
90
+ ];
91
+ const shape = (s: VgiSchema) =>
92
+ JSON.stringify([s.fields.map(fieldShape), metadata(s.metadata)]);
93
+ if (batch.numRows !== 1 || shape(batch.schema) !== shape(expected))
94
+ throw new Error("invalid projection record schema/row count");
95
+ for (let i = 0; i < expected.fields.length; i++)
96
+ if (!expected.fields[i]!.nullable && batch.getChildAt(i)?.get(0) == null)
97
+ throw new Error("required projection field is NULL");
98
+ return batchToScalarDict(batch);
99
+ }
100
+ export function validateProjectionOffer(result: BindResponse): void {
101
+ const profiles = result.projection_expression_profiles ?? [];
102
+ if (
103
+ profiles.length > 64 ||
104
+ new Set(profiles).size !== profiles.length ||
105
+ profiles.some(
106
+ (p) =>
107
+ typeof p !== "string" ||
108
+ p.length > 256 ||
109
+ !/^[a-z][a-z0-9_]*(?:\.[a-z][a-z0-9_]*)*\.v[1-9][0-9]*$/.test(p),
110
+ )
111
+ )
112
+ throw new Error("unsupported projection profile offer");
113
+ }
114
+ export function validateProjectionProposal(p: ProjectionProposal): void {
115
+ parseBindRepeatability(p.bindResult.repeatability);
116
+ validateProjectionOffer(p.bindResult);
117
+ if (
118
+ p.bindCall.function_type !== "table" ||
119
+ p.bindCall.input_schema !== null ||
120
+ p.bindCall.schema_path == null
121
+ )
122
+ throw new Error("projection requires an ordinary table and explicit owner");
123
+ if (
124
+ [
125
+ p.bindResult.lookup_secret_types,
126
+ p.bindResult.lookup_scopes,
127
+ p.bindResult.lookup_names,
128
+ ].some((v) => v?.length)
129
+ )
130
+ throw new Error("projection cannot request secrets");
131
+ if (
132
+ p.expressions.length < 1 ||
133
+ p.expressions.length > 1024 ||
134
+ p.resultSchema.fields.length !== p.expressions.length ||
135
+ p.resultSchema.metadata.size
136
+ )
137
+ throw new Error("invalid projection result schema/count");
138
+ const names = [
139
+ ...p.bindResult.output_schema.fields,
140
+ ...p.resultSchema.fields,
141
+ ].map((f) => f.name.replace(/[A-Z]/g, (c) => c.toLowerCase()));
142
+ if (
143
+ names.some((n) => !n || n.includes("\0")) ||
144
+ new Set(names).size !== names.length
145
+ )
146
+ throw new Error("ambiguous projection column names");
147
+ let context: string | undefined;
148
+ for (const raw of p.expressions) {
149
+ validateEncoded(
150
+ btoa(Array.from(raw, (b) => String.fromCharCode(b)).join("")),
151
+ p.bindCall.schema_path,
152
+ );
153
+ const expression = decodeSqlExpression(raw);
154
+ if (
155
+ !(p.bindResult.projection_expression_profiles ?? []).includes(
156
+ expression.profile,
157
+ )
158
+ )
159
+ throw new Error("projection profile was not offered");
160
+ const next = JSON.stringify(expression.evaluation_context);
161
+ if (context !== undefined && next !== context)
162
+ throw new Error("projection contexts differ");
163
+ context = next;
164
+ }
165
+ }
166
+ export function validateProjectionAcceptance(
167
+ p: ProjectionProposal,
168
+ r: ProjectionAcceptance,
169
+ ): void {
170
+ validateProjectionProposal(p);
171
+ if ((r.acceptedIndices.length === 0) !== (r.bindResult === null))
172
+ throw new Error("projection indices and bind result must occur together");
173
+ let previous = -1;
174
+ for (const i of r.acceptedIndices) {
175
+ if (!Number.isSafeInteger(i) || i <= previous || i >= p.expressions.length)
176
+ throw new Error("invalid accepted projection index");
177
+ previous = i;
178
+ }
179
+ if (!r.bindResult) return;
180
+ validateProjectionOffer(r.bindResult);
181
+ if (
182
+ normalizeBindRepeatability(r.bindResult.repeatability) !==
183
+ p.bindResult.repeatability
184
+ )
185
+ throw new Error("accepted projection changed bind repeatability");
186
+ if (
187
+ JSON.stringify(r.bindResult.projection_expression_profiles ?? []) !==
188
+ JSON.stringify(p.bindResult.projection_expression_profiles ?? []) ||
189
+ [
190
+ r.bindResult.lookup_secret_types,
191
+ r.bindResult.lookup_scopes,
192
+ r.bindResult.lookup_names,
193
+ ].some((v) => v?.length)
194
+ )
195
+ throw new Error("accepted projection changed bind offer/secrets");
196
+ const expected = schema(
197
+ [
198
+ ...p.bindResult.output_schema.fields,
199
+ ...r.acceptedIndices.map((i) => p.resultSchema.fields[i]),
200
+ ],
201
+ p.bindResult.output_schema.metadata,
202
+ );
203
+ const a = serializeSchema(expected),
204
+ b = serializeSchema(r.bindResult.output_schema);
205
+ if (a.length !== b.length || a.some((v, i) => v !== b[i]))
206
+ throw new Error("accepted projection changed append-only schema");
207
+ }
@@ -21,6 +21,7 @@ import type {
21
21
  import type {
22
22
  BindRequest,
23
23
  BindResponse,
24
+ BindRepeatability,
24
25
  InitRequest,
25
26
  GlobalInitResponse,
26
27
  TableFunctionCardinalityRequest,
@@ -216,6 +217,8 @@ export interface TableFunctionConfig<
216
217
  | {
217
218
  outputSchema: VgiSchema;
218
219
  opaqueData?: Uint8Array;
220
+ projectionExpressionProfiles?: string[];
221
+ repeatability?: BindRepeatability;
219
222
  lookupSecretTypes?: string[];
220
223
  lookupScopes?: string[];
221
224
  lookupNames?: string[];
@@ -223,10 +226,13 @@ export interface TableFunctionConfig<
223
226
  | Promise<{
224
227
  outputSchema: VgiSchema;
225
228
  opaqueData?: Uint8Array;
229
+ projectionExpressionProfiles?: string[];
230
+ repeatability?: BindRepeatability;
226
231
  lookupSecretTypes?: string[];
227
232
  lookupScopes?: string[];
228
233
  lookupNames?: string[];
229
234
  }>;
235
+ projection?: (params: TableBindParams<TArgs>, proposal: import("./projection.js").ProjectionProposal) => import("./projection.js").ProjectionAcceptance | Promise<import("./projection.js").ProjectionAcceptance>;
230
236
  /** Init (optional). May be async — common when storage is HTTP-backed. */
231
237
  onInit?: (params: {
232
238
  args: TArgs;
@@ -460,12 +466,16 @@ export function defineTableFunction<
460
466
  return {
461
467
  output_schema: result.outputSchema,
462
468
  opaque_data: result.opaqueData ?? null,
469
+ projection_expression_profiles: result.projectionExpressionProfiles ?? [],
470
+ repeatability: result.repeatability === undefined ? "UNKNOWN" : result.repeatability,
463
471
  lookup_secret_types: result.lookupSecretTypes,
464
472
  lookup_scopes: result.lookupScopes,
465
473
  lookup_names: result.lookupNames,
466
474
  };
467
475
  },
468
476
 
477
+ projection: config.projection ? (proposal) => config.projection!({args: extractArgs(proposal.bindCall), bindCall:proposal.bindCall, settings:batchToScalarDict(proposal.bindCall.settings),secrets:batchToSecretDict(proposal.bindCall.secrets),resolvedSecretsProvided:proposal.bindCall.resolved_secrets_provided},proposal) : undefined,
478
+
469
479
  async globalInit(request: InitRequest): Promise<GlobalInitResponse> {
470
480
  const executionId = new Uint8Array(16);
471
481
  crypto.getRandomValues(executionId);
@@ -273,6 +273,7 @@ export interface VgiFunction {
273
273
  * function is not split-capable: the whole scan is one unit of work, and the
274
274
  * framework answers with a single empty-payload split.
275
275
  */
276
+ projection?(proposal: import("./projection.js").ProjectionProposal): import("./projection.js").ProjectionAcceptance | Promise<import("./projection.js").ProjectionAcceptance>;
276
277
  plan?(request: import("../protocol/serializers/splits.js").TableFunctionPlanRequest):
277
278
  | import("../protocol/serializers/splits.js").PlanResult
278
279
  | Promise<import("../protocol/serializers/splits.js").PlanResult>;
@@ -2,7 +2,7 @@
2
2
  // GENERATED by vgi.codegen.ts_client. DO NOT EDIT BY HAND.
3
3
  //
4
4
  // Generator: vgi-gen-ts-client v1
5
- // Content hash: 7a9035b498e5
5
+ // Content hash: b20bb9dfcb1f
6
6
  //
7
7
  // To regenerate:
8
8
  // uv run --project ~/Development/vgi-python vgi-gen-ts-client \
@@ -21,11 +21,13 @@ import {
21
21
  } from "./vgi-protocol-schemas.js";
22
22
 
23
23
  export type ArgumentMonotonicity = "UNKNOWN" | "CONSTANT" | "NON_DECREASING" | "STRICTLY_INCREASING" | "NON_INCREASING" | "STRICTLY_DECREASING";
24
+ export type BindRepeatability = "UNKNOWN" | "STABLE_WITHIN_QUERY";
24
25
  export type DistinctDependence = "DISTINCT_DEPENDENT" | "NOT_DISTINCT_DEPENDENT";
25
26
  export type FunctionStability = "CONSISTENT" | "VOLATILE" | "CONSISTENT_WITHIN_QUERY";
26
27
  export type FunctionType = "SCALAR" | "TABLE" | "TABLE_BUFFERING" | "AGGREGATE";
27
28
  export type IndexConstraintType = "NONE" | "UNIQUE" | "PRIMARY";
28
29
  export type InvocationFunctionType = "AGGREGATE" | "SCALAR" | "TABLE" | "TABLE_BUFFERING";
30
+ export type LayoutCoverage = "ALL_ROWS" | "FUTURE_WRITES";
29
31
  export type MacroType = "SCALAR" | "TABLE";
30
32
  export type NullHandling = "DEFAULT" | "SPECIAL";
31
33
  export type OnConflict = "ERROR" | "IGNORE" | "REPLACE";
@@ -53,11 +55,27 @@ export interface CatalogInfo {
53
55
  source_url?: string | null;
54
56
  }
55
57
 
58
+ export interface TypedValueBatch {
59
+ batch: Uint8Array;
60
+ }
61
+
62
+ export interface OptionState {
63
+ values: /** @ipc-record TypedValueBatch */ Uint8Array;
64
+ explicit_names: string[];
65
+ }
66
+
56
67
  export interface SchemaInfo {
57
68
  comment?: string | null;
58
69
  tags: Record<string, string>;
59
70
  path: string[];
60
71
  estimated_object_count?: Record<string, number> | null;
72
+ options?: /** @ipc-record OptionState */ Uint8Array | null;
73
+ }
74
+
75
+ export interface TableLayout {
76
+ partition_by: Uint8Array[];
77
+ sorted_by: Uint8Array[];
78
+ coverage: LayoutCoverage;
61
79
  }
62
80
 
63
81
  export interface TableInfo {
@@ -66,11 +84,8 @@ export interface TableInfo {
66
84
  name: string;
67
85
  schema_path: string[];
68
86
  columns: Uint8Array;
69
- not_null_constraints: number[];
70
- unique_constraints: number[][];
71
- check_constraints: string[];
72
- primary_key_constraints: number[][];
73
- foreign_key_constraints: Uint8Array[];
87
+ constraints: Uint8Array[];
88
+ definition_revision?: Uint8Array | null;
74
89
  write_result_modes: Record<string, string>;
75
90
  supports_column_statistics: boolean;
76
91
  scan_function?: Uint8Array | null;
@@ -81,7 +96,9 @@ export interface TableInfo {
81
96
  cardinality_max?: number | null;
82
97
  column_statistics?: Uint8Array | null;
83
98
  bind_result?: Uint8Array | null;
84
- required_filters: string[][];
99
+ required_filters: string[][][];
100
+ options?: /** @ipc-record OptionState */ Uint8Array | null;
101
+ layout?: /** @ipc-record TableLayout */ Uint8Array | null;
85
102
  }
86
103
 
87
104
  export interface ViewInfo {
@@ -91,6 +108,8 @@ export interface ViewInfo {
91
108
  schema_path: string[];
92
109
  definition: string;
93
110
  column_comments: Record<string, string>;
111
+ aliases: string[];
112
+ security: string;
94
113
  }
95
114
 
96
115
  export interface CatalogExample {
@@ -167,16 +186,61 @@ export interface FunctionInfo {
167
186
  required_secrets: SecretLookupEntry[];
168
187
  }
169
188
 
189
+ export interface QueryEvaluationContext {
190
+ timezone: string;
191
+ collation: string;
192
+ default_order: string;
193
+ default_null_order: string;
194
+ preserve_insertion_order: boolean;
195
+ }
196
+
197
+ export interface SqlExpression {
198
+ sql: string;
199
+ profile: string;
200
+ schema_path: string[];
201
+ evaluation_context: QueryEvaluationContext;
202
+ }
203
+
204
+ export interface MacroParameter {
205
+ name: string;
206
+ declared_type?: /** @arrow-schema */ Uint8Array | null;
207
+ default_value?: /** @ipc-record TypedValueBatch */ Uint8Array | null;
208
+ default_expression?: /** @ipc-record SqlExpression */ Uint8Array | null;
209
+ documentation?: string | null;
210
+ }
211
+
212
+ export interface MacroOverload {
213
+ parameters: MacroParameter[];
214
+ definition: string;
215
+ profile: string;
216
+ schema_path: string[];
217
+ macro_type: string;
218
+ evaluation_context: QueryEvaluationContext;
219
+ }
220
+
170
221
  export interface MacroInfo {
171
222
  comment?: string | null;
172
223
  tags: Record<string, string>;
173
224
  name: string;
174
225
  schema_path: string[];
175
226
  macro_type: MacroType;
176
- parameters: string[];
177
- parameter_default_values?: /** @record-batch */ Uint8Array | null;
178
- definition: string;
179
- arguments_schema?: /** @arrow-schema */ Uint8Array | null;
227
+ overloads: MacroOverload[];
228
+ }
229
+
230
+ export interface CatalogObjectRef {
231
+ kind: string;
232
+ schema_path: string[];
233
+ name: string;
234
+ owner_table?: string | null;
235
+ }
236
+
237
+ export interface IndexDefinition {
238
+ table: /** @ipc-record CatalogObjectRef */ Uint8Array;
239
+ algorithm: string;
240
+ keys: Uint8Array[];
241
+ options: /** @ipc-record TypedValueBatch */ Uint8Array;
242
+ constraint_type: IndexConstraintType;
243
+ associated_constraint?: /** @ipc-record CatalogObjectRef */ Uint8Array | null;
180
244
  }
181
245
 
182
246
  export interface IndexInfo {
@@ -184,11 +248,8 @@ export interface IndexInfo {
184
248
  tags: Record<string, string>;
185
249
  name: string;
186
250
  schema_path: string[];
187
- table_name: string;
188
- index_type: string;
189
- constraint_type: IndexConstraintType;
190
- expressions: string[];
191
- options: Record<string, string>;
251
+ definition: /** @ipc-record IndexDefinition */ Uint8Array;
252
+ options: /** @ipc-record OptionState */ Uint8Array;
192
253
  }
193
254
 
194
255
  export interface AggregateBindRequest {
@@ -387,6 +448,22 @@ export interface BindResponse {
387
448
  lookup_secret_types: string[];
388
449
  lookup_scopes: string[];
389
450
  lookup_names: string[];
451
+ projection_expression_profiles: string[];
452
+ repeatability: BindRepeatability;
453
+ }
454
+
455
+ export interface CatalogCapabilities {
456
+ read: string[];
457
+ ddl: string[];
458
+ write: string[];
459
+ transaction: string[];
460
+ }
461
+
462
+ export interface ClientQueryCapabilities {
463
+ encodings: string[];
464
+ semantic_profiles: string[];
465
+ engine_version: string;
466
+ max_query_bytes: number;
390
467
  }
391
468
 
392
469
  export interface ClientCapabilities {
@@ -395,6 +472,8 @@ export interface ClientCapabilities {
395
472
  catalogs: string[];
396
473
  can_stream: boolean;
397
474
  filter_encodings: string[];
475
+ catalog?: /** @ipc-record CatalogCapabilities */ Uint8Array | null;
476
+ query_pushdown?: ClientQueryCapabilities | null;
398
477
  }
399
478
 
400
479
  export interface CatalogAttachRequest {
@@ -402,7 +481,18 @@ export interface CatalogAttachRequest {
402
481
  options?: /** @record-batch */ Uint8Array | null;
403
482
  data_version_spec?: string | null;
404
483
  implementation_version?: string | null;
405
- client_capabilities?: ClientCapabilities | null;
484
+ client_capabilities?: /** @ipc-record ClientCapabilities */ Uint8Array | null;
485
+ }
486
+
487
+ export interface QueryCapabilities {
488
+ encoding: string;
489
+ semantic_profiles: string[];
490
+ execution_modes: string[];
491
+ backend_engine: string;
492
+ backend_version: string;
493
+ capability_revision: string;
494
+ default_evaluation_context: QueryEvaluationContext;
495
+ max_query_bytes: number;
406
496
  }
407
497
 
408
498
  export interface CatalogAttachResult {
@@ -412,7 +502,7 @@ export interface CatalogAttachResult {
412
502
  catalog_version_frozen: boolean;
413
503
  catalog_version: number;
414
504
  attach_opaque_data_required: boolean;
415
- default_schema: string;
505
+ default_schema?: string | null;
416
506
  settings: Uint8Array[];
417
507
  secret_types: Uint8Array[];
418
508
  attach_catalogs: Uint8Array[];
@@ -424,6 +514,9 @@ export interface CatalogAttachResult {
424
514
  resolved_data_version?: string | null;
425
515
  resolved_implementation_version?: string | null;
426
516
  supports_catalog_contents: boolean;
517
+ catalog_capabilities?: /** @ipc-record CatalogCapabilities */ Uint8Array | null;
518
+ selected_capabilities?: /** @ipc-record CatalogCapabilities */ Uint8Array | null;
519
+ query_pushdown?: QueryCapabilities | null;
427
520
  }
428
521
 
429
522
  export interface CatalogsResponse {
@@ -452,16 +545,18 @@ export interface CatalogCreateRequest {
452
545
  options?: /** @record-batch */ Uint8Array | null;
453
546
  }
454
547
 
548
+ export interface DependencySnapshot {
549
+ catalog_version: number;
550
+ objects: Uint8Array[];
551
+ dependencies: Uint8Array[];
552
+ }
553
+
455
554
  export interface IndexCreateRequest {
456
555
  attach_opaque_data: Uint8Array;
457
556
  schema_path: string[];
458
557
  name: string;
459
- table_name: string;
460
- index_type: string;
461
- constraint_type: IndexConstraintType;
462
- expressions: string[];
558
+ definition: /** @ipc-record IndexDefinition */ Uint8Array;
463
559
  on_conflict: OnConflict;
464
- options: Record<string, string>;
465
560
  transaction_opaque_data?: Uint8Array | null;
466
561
  }
467
562
 
@@ -469,16 +564,20 @@ export interface IndexesResponse {
469
564
  items: IndexInfo[];
470
565
  }
471
566
 
567
+ export interface OptionDefinitions {
568
+ schema: /** @arrow-schema */ Uint8Array;
569
+ defaults: /** @ipc-record TypedValueBatch */ Uint8Array;
570
+ create_names: string[];
571
+ alter_names: string[];
572
+ }
573
+
472
574
  export interface MacroCreateRequest {
473
575
  attach_opaque_data: Uint8Array;
474
576
  schema_path: string[];
475
577
  name: string;
476
578
  macro_type: MacroType;
477
- parameters: string[];
478
- definition: string;
579
+ overloads: MacroOverload[];
479
580
  on_conflict: OnConflict;
480
- parameter_default_values?: /** @record-batch */ Uint8Array | null;
481
- arguments_schema?: /** @arrow-schema */ Uint8Array | null;
482
581
  transaction_opaque_data?: Uint8Array | null;
483
582
  }
484
583
 
@@ -486,6 +585,43 @@ export interface MacrosResponse {
486
585
  items: MacroInfo[];
487
586
  }
488
587
 
588
+ export interface QueryObjectReference {
589
+ object: CatalogObjectRef;
590
+ expected_schema: Uint8Array;
591
+ }
592
+
593
+ export interface CatalogQueryPrepareRequest {
594
+ attach_opaque_data: Uint8Array;
595
+ encoding: string;
596
+ semantic_profile: string;
597
+ mode: string;
598
+ capability_revision: string;
599
+ query: string;
600
+ parameter_schema: Uint8Array;
601
+ evaluation_context: QueryEvaluationContext;
602
+ transaction_opaque_data?: Uint8Array | null;
603
+ catalog_version?: number | null;
604
+ catalog_etag?: string | null;
605
+ referenced_objects: QueryObjectReference[];
606
+ expected_output_schema?: Uint8Array | null;
607
+ required_ordering: string;
608
+ }
609
+
610
+ export interface CatalogQueryPrepareResult {
611
+ status: string;
612
+ reason_code?: string | null;
613
+ reason_detail?: string | null;
614
+ prepared_query_token?: Uint8Array | null;
615
+ output_schema?: Uint8Array | null;
616
+ result_ordering?: string | null;
617
+ validated_catalog_version?: number | null;
618
+ validated_catalog_etag?: string | null;
619
+ context_digest?: Uint8Array | null;
620
+ expires_at_epoch_ms?: number | null;
621
+ estimated_rows?: number | null;
622
+ estimated_bytes?: number | null;
623
+ }
624
+
489
625
  export interface FunctionsResponse {
490
626
  items: FunctionInfo[];
491
627
  }
@@ -502,18 +638,32 @@ export interface SchemasResponse {
502
638
  items: SchemaInfo[];
503
639
  }
504
640
 
641
+ export interface ConstraintsApplyRequest {
642
+ attach_opaque_data: Uint8Array;
643
+ table: /** @ipc-record CatalogObjectRef */ Uint8Array;
644
+ expected_revision: Uint8Array;
645
+ changes: Uint8Array[];
646
+ transaction_opaque_data?: Uint8Array | null;
647
+ }
648
+
649
+ export interface ConstraintSnapshot {
650
+ table: /** @ipc-record CatalogObjectRef */ Uint8Array;
651
+ definition_revision: Uint8Array;
652
+ constraints: Uint8Array[];
653
+ }
654
+
505
655
  export interface TableCreateRequest {
506
656
  attach_opaque_data: Uint8Array;
507
657
  schema_path: string[];
508
658
  name: string;
509
659
  columns: Uint8Array;
510
660
  on_conflict: OnConflict;
511
- not_null_constraints: number[];
512
- unique_constraints: number[][];
513
- check_constraints: string[];
514
- primary_key_constraints: number[][];
515
- foreign_key_constraints: Uint8Array[];
661
+ constraint_definitions: Uint8Array[];
516
662
  transaction_opaque_data?: Uint8Array | null;
663
+ comment?: string | null;
664
+ tags?: Record<string, string> | null;
665
+ options?: /** @ipc-record TypedValueBatch */ Uint8Array | null;
666
+ layout?: /** @ipc-record TableLayout */ Uint8Array | null;
517
667
  }
518
668
 
519
669
  export interface TransactionBeginResponse {
@@ -525,7 +675,7 @@ export interface CatalogVersionResponse {
525
675
  }
526
676
 
527
677
  export interface InitRequest {
528
- bind_call: BindRequest;
678
+ bind_call: /** @ipc-record BindRequest */ Uint8Array;
529
679
  output_schema: /** @arrow-schema */ Uint8Array;
530
680
  bind_opaque_data?: Uint8Array | null;
531
681
  projection_ids?: number[] | null;
@@ -585,7 +735,7 @@ export interface TableBufferingProcessResponse {
585
735
  }
586
736
 
587
737
  export interface TableFunctionCardinalityRequest {
588
- bind_call: BindRequest;
738
+ bind_call: /** @ipc-record BindRequest */ Uint8Array;
589
739
  bind_opaque_data?: Uint8Array | null;
590
740
  }
591
741
 
@@ -595,7 +745,7 @@ export interface TableCardinality {
595
745
  }
596
746
 
597
747
  export interface TableFunctionDynamicToStringRequest {
598
- bind_call: BindRequest;
748
+ bind_call: /** @ipc-record BindRequest */ Uint8Array;
599
749
  bind_opaque_data?: Uint8Array | null;
600
750
  global_execution_id: Uint8Array;
601
751
  }
@@ -606,7 +756,7 @@ export interface TableFunctionDynamicToStringResponse {
606
756
  }
607
757
 
608
758
  export interface TableFunctionPlanRequest {
609
- bind_call: BindRequest;
759
+ bind_call: /** @ipc-record BindRequest */ Uint8Array;
610
760
  bind_opaque_data?: Uint8Array | null;
611
761
  projection_ids?: number[] | null;
612
762
  pushdown_filters?: /** @record-batch */ Uint8Array | null;
@@ -660,8 +810,20 @@ export interface PlanResponse {
660
810
  end_position?: Uint8Array | null;
661
811
  }
662
812
 
813
+ export interface TableFunctionProjectionRequest {
814
+ bind_call: /** @ipc-record BindRequest */ Uint8Array;
815
+ bind_result: /** @ipc-record BindResponse */ Uint8Array;
816
+ expressions: Uint8Array[];
817
+ result_schema: /** @arrow-schema */ Uint8Array;
818
+ }
819
+
820
+ export interface TableFunctionProjectionResponse {
821
+ accepted_indices: number[];
822
+ bind_result?: /** @ipc-record BindResponse */ Uint8Array | null;
823
+ }
824
+
663
825
  export interface TableFunctionStatisticsRequest {
664
- bind_call: BindRequest;
826
+ bind_call: /** @ipc-record BindRequest */ Uint8Array;
665
827
  bind_opaque_data?: Uint8Array | null;
666
828
  }
667
829