@query-farm/vgi 0.45.0 → 0.47.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 +19 -6
- package/dist/arrow/impl-arrowjs/index.d.ts +1 -1
- package/dist/arrow/impl-arrowjs/iterate.d.ts +2 -0
- package/dist/arrow/impl-flechette/canonical.d.ts +1 -1
- package/dist/arrow/impl-flechette/index.d.ts +1 -1
- package/dist/arrow/impl-flechette/iterate.d.ts +2 -0
- package/dist/arrow/impl-flechette/schema.d.ts +19 -5
- package/dist/arrow/index.d.ts +1 -1
- package/dist/catalog/column-expressions.d.ts +8 -0
- package/dist/catalog/column-metadata.d.ts +11 -0
- package/dist/catalog/composite.d.ts +2 -1
- package/dist/catalog/descriptors.d.ts +21 -29
- package/dist/catalog/interface.d.ts +15 -20
- package/dist/catalog/macro-overloads.d.ts +4 -0
- package/dist/catalog/read-only.d.ts +1 -1
- package/dist/catalog/unconstrained-columns.d.ts +2 -0
- package/dist/client/client.d.ts +38 -14
- package/dist/client-entry.js +806 -115
- package/dist/client-entry.js.map +18 -14
- package/dist/functions/continuation.d.ts +69 -0
- package/dist/functions/projection.d.ts +18 -0
- package/dist/functions/table-in-out.d.ts +51 -7
- package/dist/functions/table.d.ts +6 -1
- package/dist/functions/types.d.ts +21 -0
- package/dist/generated/vgi-client.d.ts +178 -36
- package/dist/generated/vgi-protocol-schemas.d.ts +51 -1
- package/dist/generated/vgi-protocol-types.d.ts +317 -3
- package/dist/generated/vgi-service.d.ts +266 -29
- package/dist/index.core.d.ts +3 -1
- package/dist/index.js +1747 -320
- package/dist/index.js.map +45 -37
- package/dist/protocol/dispatch.d.ts +9 -9
- package/dist/protocol/handlers/aggregate.d.ts +1 -1
- package/dist/protocol/handlers/catalog/index.d.ts +1 -1
- package/dist/protocol/handlers/catalog/metadata.d.ts +1 -0
- package/dist/protocol/handlers/function.d.ts +1 -1
- package/dist/protocol/handlers/table-buffering.d.ts +1 -1
- package/dist/protocol/handlers/unimplemented.d.ts +1 -1
- package/dist/protocol/serializers/bind.d.ts +5 -1
- package/dist/protocol/types.d.ts +5 -0
- package/dist/rpc-server.d.ts +6 -6
- package/dist/serve-entry.js +1607 -436
- package/dist/serve-entry.js.map +33 -27
- package/dist/util/arrow/index.d.ts +1 -1
- package/dist/util/parent-rows.d.ts +8 -0
- package/dist/worker-cf-entry.d.ts +1 -1
- package/dist/worker-cf-entry.js +1901 -526
- package/dist/worker-cf-entry.js.map +45 -37
- package/dist/worker.d.ts +1 -1
- package/package.json +8 -7
- package/src/arrow/impl-arrowjs/index.ts +1 -1
- package/src/arrow/impl-arrowjs/iterate.ts +9 -1
- package/src/arrow/impl-arrowjs/project.ts +1 -1
- package/src/arrow/impl-flechette/canonical.ts +7 -5
- package/src/arrow/impl-flechette/index.ts +1 -1
- package/src/arrow/impl-flechette/ipc.ts +12 -0
- package/src/arrow/impl-flechette/iterate.ts +5 -0
- package/src/arrow/impl-flechette/project.ts +6 -8
- package/src/arrow/index.ts +1 -1
- package/src/catalog/column-expressions.ts +224 -0
- package/src/catalog/column-metadata.ts +151 -0
- package/src/catalog/composite.ts +5 -1
- package/src/catalog/contents-codec.ts +6 -1
- package/src/catalog/descriptors.ts +21 -29
- package/src/catalog/interface.ts +70 -55
- package/src/catalog/macro-overloads.ts +44 -0
- package/src/catalog/read-only.ts +69 -71
- package/src/catalog/unconstrained-columns.ts +23 -0
- package/src/client/client.ts +180 -69
- package/src/codec/asd.ts +3 -1
- package/src/filter-pushdown/collector.ts +17 -1
- package/src/functions/continuation.ts +202 -0
- package/src/functions/projection.ts +207 -0
- package/src/functions/table-in-out.ts +131 -56
- package/src/functions/table.ts +10 -0
- package/src/functions/types.ts +21 -0
- package/src/generated/vgi-client.ts +200 -37
- package/src/generated/vgi-protocol-schemas.ts +456 -41
- package/src/generated/vgi-protocol-types.ts +879 -5
- package/src/generated/vgi-service.ts +514 -42
- package/src/http/client-bundle.ts +1 -1
- package/src/http/fetch.ts +1 -1
- package/src/index.core.ts +10 -0
- package/src/protocol/dispatch.ts +9 -9
- package/src/protocol/handlers/aggregate.ts +1 -1
- package/src/protocol/handlers/catalog/admin.ts +10 -5
- package/src/protocol/handlers/catalog/index.ts +2 -2
- package/src/protocol/handlers/catalog/macro.ts +6 -5
- package/src/protocol/handlers/catalog/metadata.ts +16 -0
- package/src/protocol/handlers/catalog/table.ts +72 -26
- package/src/protocol/handlers/catalog/view.ts +24 -3
- package/src/protocol/handlers/function.ts +79 -1
- package/src/protocol/handlers/table-buffering.ts +1 -1
- package/src/protocol/handlers/unimplemented.ts +6 -6
- package/src/protocol/serializers/bind.ts +17 -1
- package/src/protocol/state-serializer.ts +7 -1
- package/src/protocol/types.ts +6 -0
- package/src/rpc-server.ts +9 -9
- package/src/util/arrow/index.ts +1 -1
- package/src/util/parent-rows.ts +41 -0
- package/src/worker-cf-entry.ts +3 -0
- package/src/worker.ts +1 -1
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { OutputCollector } from "@query-farm/vgi-rpc";
|
|
2
|
+
import type { VgiBatch } from "../arrow/index.js";
|
|
3
|
+
/** Metadata key carrying a table-in-out exchange status, on the batch itself. */
|
|
4
|
+
export declare const STATUS_KEY = "vgi.status";
|
|
5
|
+
/** Reply status: this input has more output; ask for it with a tick. */
|
|
6
|
+
export declare const HAVE_MORE_OUTPUT = "HAVE_MORE_OUTPUT";
|
|
7
|
+
/** Input status: a continuation tick, asking for the last input's next reply. */
|
|
8
|
+
export declare const CONTINUE = "CONTINUE";
|
|
9
|
+
/**
|
|
10
|
+
* Mark an emitted table-in-out reply as one of several for the same input
|
|
11
|
+
* batch when `more` is true: the client asks for the next one with a
|
|
12
|
+
* continuation tick, which the framework answers through the function's
|
|
13
|
+
* `resume()`. `false` adds nothing, so the last reply can pass its own
|
|
14
|
+
* condition. Composes with {@link parentRowsMetadata} and
|
|
15
|
+
* `cacheControlMetadata` via `extra`:
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* out.emit(batch, moreOutputMetadata(state.row < state.counts.length,
|
|
19
|
+
* parentRowsMetadata(parents, batch.numRows)));
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* Valid only from the `process()` or `resume()` of a table-in-out function
|
|
23
|
+
* that implements `resume()`; the framework reads it off the emitted reply.
|
|
24
|
+
*/
|
|
25
|
+
export declare function moreOutputMetadata(more: boolean, extra?: Map<string, string>): Map<string, string>;
|
|
26
|
+
/**
|
|
27
|
+
* Refuse "more" on a stream that cannot continue: anything but a table-in-out
|
|
28
|
+
* exchange, where the client would never send the tick. Run by the dispatcher
|
|
29
|
+
* after every non-table-in-out turn.
|
|
30
|
+
*/
|
|
31
|
+
export declare function refuseMoreOutput(name: string, out: OutputCollector): void;
|
|
32
|
+
/** The exchange state a continuable table-in-out turn reads and updates. */
|
|
33
|
+
export interface ContinuationState {
|
|
34
|
+
/**
|
|
35
|
+
* Whether the last reply said HAVE_MORE_OUTPUT, so the next input must be a
|
|
36
|
+
* tick. Carried in the HTTP state token (see protocol/state-serializer.ts).
|
|
37
|
+
*/
|
|
38
|
+
morePending?: boolean;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Run one table-in-out exchange turn under the continued-output rules.
|
|
42
|
+
*
|
|
43
|
+
* Classifies the input (a tick or real input), refuses the inputs the protocol
|
|
44
|
+
* forbids, calls `run(tick)` -- which calls `process()` for real input and
|
|
45
|
+
* `resume()` for a tick -- and records from the emitted reply whether output is
|
|
46
|
+
* now pending.
|
|
47
|
+
*
|
|
48
|
+
* `resumable` is whether the function implements `resume()`: one that does not
|
|
49
|
+
* may not say more.
|
|
50
|
+
*/
|
|
51
|
+
export declare function continuationTurn(name: string, eState: ContinuationState, input: VgiBatch, out: OutputCollector, resumable: boolean, run: (tick: boolean) => Promise<void>): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Refuse, at definition, a continuable function the client cannot drive.
|
|
54
|
+
*
|
|
55
|
+
* `resume()` continues from the function's state alone, so it needs an
|
|
56
|
+
* `initialState` (the state is what the HTTP token carries between turns).
|
|
57
|
+
* `maxWorkers: 1` runs the function on one connection shared by every
|
|
58
|
+
* pipeline, which cannot leave output pending while another's input waits.
|
|
59
|
+
*/
|
|
60
|
+
export declare function checkResumeContract(name: string, config: {
|
|
61
|
+
resume?: unknown;
|
|
62
|
+
initialState?: unknown;
|
|
63
|
+
maxWorkers?: number;
|
|
64
|
+
}): void;
|
|
65
|
+
/**
|
|
66
|
+
* Check `inputRowsPerCall`: a positive integer, on a blended row-transform
|
|
67
|
+
* function only (the extension refuses it at bind too).
|
|
68
|
+
*/
|
|
69
|
+
export declare function checkInputRowsPerCall(name: string, value: unknown, blended: boolean): number | undefined;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type VgiSchema } from "../arrow/index.js";
|
|
2
|
+
import type { BindRequest, BindResponse } from "../protocol/types.js";
|
|
3
|
+
export declare const SCALAR_PROJECTION_PROFILE = "vgi.expression.duckdb.scalar.v1";
|
|
4
|
+
export interface ProjectionProposal {
|
|
5
|
+
bindCall: BindRequest;
|
|
6
|
+
bindResult: BindResponse;
|
|
7
|
+
expressions: Uint8Array[];
|
|
8
|
+
resultSchema: VgiSchema;
|
|
9
|
+
}
|
|
10
|
+
export interface ProjectionAcceptance {
|
|
11
|
+
acceptedIndices: number[];
|
|
12
|
+
bindResult: BindResponse | null;
|
|
13
|
+
}
|
|
14
|
+
/** Strict envelope boundary for the projection RPC and its original bind records. */
|
|
15
|
+
export declare function projectionRecord(bytes: Uint8Array, expected: VgiSchema): Record<string, any>;
|
|
16
|
+
export declare function validateProjectionOffer(result: BindResponse): void;
|
|
17
|
+
export declare function validateProjectionProposal(p: ProjectionProposal): void;
|
|
18
|
+
export declare function validateProjectionAcceptance(p: ProjectionProposal, r: ProjectionAcceptance): void;
|
|
@@ -6,6 +6,7 @@ import type { ArgumentConstraints } from "../arguments/argument-spec.js";
|
|
|
6
6
|
import { type PushdownFilters } from "../filter-pushdown/index.js";
|
|
7
7
|
import { FunctionStability } from "../types.js";
|
|
8
8
|
import { BoundStorage } from "./storage.js";
|
|
9
|
+
import { PARENT_ROW_METADATA_KEY } from "../util/parent-rows.js";
|
|
9
10
|
export interface TableInOutBindParams<TArgs = Record<string, any>> {
|
|
10
11
|
args: TArgs;
|
|
11
12
|
bindCall: BindRequest;
|
|
@@ -80,6 +81,22 @@ export interface TableInOutConfig<TArgs = Record<string, any>, TState = null> {
|
|
|
80
81
|
initialState?: (params: TableInOutProcessParams<TArgs>) => TState;
|
|
81
82
|
/** Process: transform input batch, emit output via out */
|
|
82
83
|
process?: (params: TableInOutProcessParams<TArgs>, state: TState, batch: VgiBatch, out: OutputCollector) => void | Promise<void>;
|
|
84
|
+
/**
|
|
85
|
+
* Resume: emit the next reply for the last input batch (continued output).
|
|
86
|
+
*
|
|
87
|
+
* One input batch can produce several replies: `process()` emits the first
|
|
88
|
+
* with {@link moreOutputMetadata}`(true)`, and the framework then calls
|
|
89
|
+
* `resume()`, with no input, for each next reply until one is emitted
|
|
90
|
+
* without it. Like `process()`, each call emits exactly one batch.
|
|
91
|
+
*
|
|
92
|
+
* `resume()` continues from `state` alone, so a function that defines it
|
|
93
|
+
* must define `initialState`. Mutate the state in place: it survives between
|
|
94
|
+
* calls on every transport -- over HTTP inside the stream's state token -- so
|
|
95
|
+
* keep it small (positions to resume from, never buffered output). Not
|
|
96
|
+
* allowed with `maxWorkers: 1`, which runs on one connection shared by every
|
|
97
|
+
* pipeline and so cannot leave output pending.
|
|
98
|
+
*/
|
|
99
|
+
resume?: (params: TableInOutProcessParams<TArgs>, state: TState, out: OutputCollector) => void | Promise<void>;
|
|
83
100
|
/** Finalize: emit final batches after all input processed.
|
|
84
101
|
* Receives all worker states collected from storage (matches Python's finish(params, states)). */
|
|
85
102
|
finalize?: (params: TableInOutProcessParams<TArgs>, states: TState[]) => VgiBatch[] | Promise<VgiBatch[]>;
|
|
@@ -95,10 +112,7 @@ export interface TableInOutConfig<TArgs = Record<string, any>, TState = null> {
|
|
|
95
112
|
requiredSecrets?: string[];
|
|
96
113
|
}
|
|
97
114
|
export declare function defineTableInOutFunction<TArgs = Record<string, any>, TState = null>(config: TableInOutConfig<TArgs, TState>): VgiFunction;
|
|
98
|
-
|
|
99
|
-
* little-endian int32[] mapping each output row to the input row that
|
|
100
|
-
* produced it. Shared by string with the C++ extension and vgi-python. */
|
|
101
|
-
export declare const PARENT_ROW_METADATA_KEY = "vgi_rpc.parent_row#b64";
|
|
115
|
+
export { PARENT_ROW_METADATA_KEY };
|
|
102
116
|
/**
|
|
103
117
|
* Fold per-output-row provenance into an emit metadata map.
|
|
104
118
|
*
|
|
@@ -128,7 +142,7 @@ export declare function parentRowsMetadata(parentRows: number[], outputRows: num
|
|
|
128
142
|
* positionally for varargs).
|
|
129
143
|
*/
|
|
130
144
|
export type RowTransformProcessParams<TArgs = Record<string, any>> = TableInOutProcessParams<TArgs>;
|
|
131
|
-
export interface RowTransformConfig<TArgs = Record<string, any
|
|
145
|
+
export interface RowTransformConfig<TArgs = Record<string, any>, TState = null> {
|
|
132
146
|
name: string;
|
|
133
147
|
description?: string;
|
|
134
148
|
/**
|
|
@@ -176,8 +190,38 @@ export interface RowTransformConfig<TArgs = Record<string, any>> {
|
|
|
176
190
|
* per-row map (DuckDB forbids FinalExecute under correlated LATERAL, one of
|
|
177
191
|
* the call shapes blended must serve). Accumulating functions use a classic
|
|
178
192
|
* TableInput table-in-out or a TableBufferingFunction.
|
|
193
|
+
*
|
|
194
|
+
* `state` is the stream's state from {@link initialState} (`null` without
|
|
195
|
+
* one); a function that continues its output keeps its resume position there.
|
|
196
|
+
*/
|
|
197
|
+
process: (params: RowTransformProcessParams<TArgs>, batch: VgiBatch, out: OutputCollector, state: TState) => void | Promise<void>;
|
|
198
|
+
/**
|
|
199
|
+
* The stream's initial state, needed only by a function with {@link resume}:
|
|
200
|
+
* where the next reply resumes. Mutate it in place; it survives between
|
|
201
|
+
* calls on every transport (over HTTP inside the stream's state token), so
|
|
202
|
+
* keep it small: positions to resume from, never buffered output rows.
|
|
203
|
+
*/
|
|
204
|
+
initialState?: (params: RowTransformProcessParams<TArgs>) => TState;
|
|
205
|
+
/**
|
|
206
|
+
* Continued output: emit the next reply for the last input batch.
|
|
207
|
+
*
|
|
208
|
+
* Large output for one input batch (an upstream API paged across many
|
|
209
|
+
* requests) need not be built into one batch: `process()` emits the first
|
|
210
|
+
* reply with {@link moreOutputMetadata}`(true)`, and the framework calls
|
|
211
|
+
* `resume()`, with no input, for each next reply until one is emitted
|
|
212
|
+
* without it. Each call emits exactly one batch, whose parent rows index the
|
|
213
|
+
* input batch `process()` received. Requires {@link initialState}; not
|
|
214
|
+
* allowed with `maxWorkers: 1`.
|
|
215
|
+
*/
|
|
216
|
+
resume?: (params: RowTransformProcessParams<TArgs>, state: TState, out: OutputCollector) => void | Promise<void>;
|
|
217
|
+
/**
|
|
218
|
+
* The most input rows one worker call receives: the client's batched-LATERAL
|
|
219
|
+
* operator splits each input chunk (after dedup) into calls of at most this
|
|
220
|
+
* many rows, in order. Unset sends a whole chunk per call. A positive
|
|
221
|
+
* integer. Surfaces as `FunctionInfo.input_rows_per_call`; mirrors
|
|
222
|
+
* vgi-python's `Meta.input_rows_per_call`.
|
|
179
223
|
*/
|
|
180
|
-
|
|
224
|
+
inputRowsPerCall?: number;
|
|
181
225
|
projectionPushdown?: boolean;
|
|
182
226
|
filterPushdown?: boolean;
|
|
183
227
|
autoApplyFilters?: boolean;
|
|
@@ -200,4 +244,4 @@ export interface RowTransformConfig<TArgs = Record<string, any>> {
|
|
|
200
244
|
* the worker's overload resolution matches blended overloads by INPUT-COLUMN
|
|
201
245
|
* count (the positional args are not on the wire). Map-shaped, no finalize.
|
|
202
246
|
*/
|
|
203
|
-
export declare function defineRowTransformFunction<TArgs = Record<string, any
|
|
247
|
+
export declare function defineRowTransformFunction<TArgs = Record<string, any>, TState = null>(config: RowTransformConfig<TArgs, TState>): VgiFunction;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type VgiSchema, type VgiBatch, type VgiDataType } from "../arrow/index.js";
|
|
2
2
|
import type { OutputCollector } from "@query-farm/vgi-rpc";
|
|
3
3
|
import type { PlanResult, TableFunctionPlanRequest } from "../protocol/serializers/splits.js";
|
|
4
|
-
import type { BindRequest, InitRequest, GlobalInitResponse, TableCardinality } from "../protocol/types.js";
|
|
4
|
+
import type { BindRequest, BindRepeatability, InitRequest, GlobalInitResponse, TableCardinality } from "../protocol/types.js";
|
|
5
5
|
import type { VgiFunction, FunctionExample } from "./types.js";
|
|
6
6
|
import { type ArgumentConstraints } from "../arguments/argument-spec.js";
|
|
7
7
|
import { type PushdownFilters } from "../filter-pushdown/index.js";
|
|
@@ -81,16 +81,21 @@ export interface TableFunctionConfig<TArgs = Record<string, any>, TState = null>
|
|
|
81
81
|
onBind: (params: TableBindParams<TArgs>) => {
|
|
82
82
|
outputSchema: VgiSchema;
|
|
83
83
|
opaqueData?: Uint8Array;
|
|
84
|
+
projectionExpressionProfiles?: string[];
|
|
85
|
+
repeatability?: BindRepeatability;
|
|
84
86
|
lookupSecretTypes?: string[];
|
|
85
87
|
lookupScopes?: string[];
|
|
86
88
|
lookupNames?: string[];
|
|
87
89
|
} | Promise<{
|
|
88
90
|
outputSchema: VgiSchema;
|
|
89
91
|
opaqueData?: Uint8Array;
|
|
92
|
+
projectionExpressionProfiles?: string[];
|
|
93
|
+
repeatability?: BindRepeatability;
|
|
90
94
|
lookupSecretTypes?: string[];
|
|
91
95
|
lookupScopes?: string[];
|
|
92
96
|
lookupNames?: string[];
|
|
93
97
|
}>;
|
|
98
|
+
projection?: (params: TableBindParams<TArgs>, proposal: import("./projection.js").ProjectionProposal) => import("./projection.js").ProjectionAcceptance | Promise<import("./projection.js").ProjectionAcceptance>;
|
|
94
99
|
/** Init (optional). May be async — common when storage is HTTP-backed. */
|
|
95
100
|
onInit?: (params: {
|
|
96
101
|
args: TArgs;
|
|
@@ -13,6 +13,12 @@ export interface HandlerState<T = any> {
|
|
|
13
13
|
* rebuilds the filters this one left.
|
|
14
14
|
*/
|
|
15
15
|
filterHistory?: import("../filter-pushdown/history.js").FilterDeltaHistory;
|
|
16
|
+
/**
|
|
17
|
+
* A table-in-out exchange's continued-output flag: the last reply said
|
|
18
|
+
* HAVE_MORE_OUTPUT, so the next input must be a continuation tick. Carried
|
|
19
|
+
* in the HTTP cursor like `filterHistory`.
|
|
20
|
+
*/
|
|
21
|
+
morePending?: boolean;
|
|
16
22
|
[key: string]: any;
|
|
17
23
|
}
|
|
18
24
|
export interface FunctionExample {
|
|
@@ -86,6 +92,13 @@ export interface FunctionMeta {
|
|
|
86
92
|
* ResolvedMetadata.input_from_args.
|
|
87
93
|
*/
|
|
88
94
|
inputFromArgs?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Blended only: the most input rows one worker call receives; the client
|
|
97
|
+
* splits each input chunk into calls of at most this many rows. Unset sends
|
|
98
|
+
* a whole chunk per call. Set by {@link defineRowTransformFunction}'s
|
|
99
|
+
* `inputRowsPerCall`; surfaces as FunctionInfo.input_rows_per_call.
|
|
100
|
+
*/
|
|
101
|
+
inputRowsPerCall?: number;
|
|
89
102
|
/**
|
|
90
103
|
* table_buffering: force ParallelSink=false in the C++ operator
|
|
91
104
|
* (single-thread, source-ordered ingest).
|
|
@@ -190,6 +203,13 @@ export interface StreamHandlers {
|
|
|
190
203
|
* from DuckDB's Top-N optimizer).
|
|
191
204
|
*/
|
|
192
205
|
onTick?: (state: any, tickMetadata: Map<string, string> | undefined) => void | Promise<void>;
|
|
206
|
+
/**
|
|
207
|
+
* A table-in-out exchange, which may continue one input's output across
|
|
208
|
+
* replies (see functions/continuation.ts). It keeps `morePending` on its
|
|
209
|
+
* handler state, which the dispatcher carries in the HTTP state token. Every
|
|
210
|
+
* other stream's reply is refused if it says HAVE_MORE_OUTPUT.
|
|
211
|
+
*/
|
|
212
|
+
continuesOutput?: boolean;
|
|
193
213
|
}
|
|
194
214
|
/**
|
|
195
215
|
* A resolved, registered VGI function definition.
|
|
@@ -216,6 +236,7 @@ export interface VgiFunction {
|
|
|
216
236
|
* function is not split-capable: the whole scan is one unit of work, and the
|
|
217
237
|
* framework answers with a single empty-payload split.
|
|
218
238
|
*/
|
|
239
|
+
projection?(proposal: import("./projection.js").ProjectionProposal): import("./projection.js").ProjectionAcceptance | Promise<import("./projection.js").ProjectionAcceptance>;
|
|
219
240
|
plan?(request: import("../protocol/serializers/splits.js").TableFunctionPlanRequest): import("../protocol/serializers/splits.js").PlanResult | Promise<import("../protocol/serializers/splits.js").PlanResult>;
|
|
220
241
|
/**
|
|
221
242
|
* Per-column statistics for this table function's output given the user's
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export type ArgumentMonotonicity = "UNKNOWN" | "CONSTANT" | "NON_DECREASING" | "STRICTLY_INCREASING" | "NON_INCREASING" | "STRICTLY_DECREASING";
|
|
2
|
+
export type BindRepeatability = "UNKNOWN" | "STABLE_WITHIN_QUERY";
|
|
2
3
|
export type DistinctDependence = "DISTINCT_DEPENDENT" | "NOT_DISTINCT_DEPENDENT";
|
|
3
4
|
export type FunctionStability = "CONSISTENT" | "VOLATILE" | "CONSISTENT_WITHIN_QUERY";
|
|
4
5
|
export type FunctionType = "SCALAR" | "TABLE" | "TABLE_BUFFERING" | "AGGREGATE";
|
|
5
6
|
export type IndexConstraintType = "NONE" | "UNIQUE" | "PRIMARY";
|
|
6
7
|
export type InvocationFunctionType = "AGGREGATE" | "SCALAR" | "TABLE" | "TABLE_BUFFERING";
|
|
8
|
+
export type LayoutCoverage = "ALL_ROWS" | "FUTURE_WRITES";
|
|
7
9
|
export type MacroType = "SCALAR" | "TABLE";
|
|
8
10
|
export type NullHandling = "DEFAULT" | "SPECIAL";
|
|
9
11
|
export type OnConflict = "ERROR" | "IGNORE" | "REPLACE";
|
|
@@ -28,11 +30,24 @@ export interface CatalogInfo {
|
|
|
28
30
|
releases: CatalogDataVersionRelease[];
|
|
29
31
|
source_url?: string | null;
|
|
30
32
|
}
|
|
33
|
+
export interface TypedValueBatch {
|
|
34
|
+
batch: Uint8Array;
|
|
35
|
+
}
|
|
36
|
+
export interface OptionState {
|
|
37
|
+
values: Uint8Array;
|
|
38
|
+
explicit_names: string[];
|
|
39
|
+
}
|
|
31
40
|
export interface SchemaInfo {
|
|
32
41
|
comment?: string | null;
|
|
33
42
|
tags: Record<string, string>;
|
|
34
43
|
path: string[];
|
|
35
44
|
estimated_object_count?: Record<string, number> | null;
|
|
45
|
+
options?: /** @ipc-record OptionState */ Uint8Array | null;
|
|
46
|
+
}
|
|
47
|
+
export interface TableLayout {
|
|
48
|
+
partition_by: Uint8Array[];
|
|
49
|
+
sorted_by: Uint8Array[];
|
|
50
|
+
coverage: LayoutCoverage;
|
|
36
51
|
}
|
|
37
52
|
export interface TableInfo {
|
|
38
53
|
comment?: string | null;
|
|
@@ -40,11 +55,8 @@ export interface TableInfo {
|
|
|
40
55
|
name: string;
|
|
41
56
|
schema_path: string[];
|
|
42
57
|
columns: Uint8Array;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
check_constraints: string[];
|
|
46
|
-
primary_key_constraints: number[][];
|
|
47
|
-
foreign_key_constraints: Uint8Array[];
|
|
58
|
+
constraints: Uint8Array[];
|
|
59
|
+
definition_revision?: Uint8Array | null;
|
|
48
60
|
write_result_modes: Record<string, string>;
|
|
49
61
|
supports_column_statistics: boolean;
|
|
50
62
|
scan_function?: Uint8Array | null;
|
|
@@ -55,7 +67,9 @@ export interface TableInfo {
|
|
|
55
67
|
cardinality_max?: number | null;
|
|
56
68
|
column_statistics?: Uint8Array | null;
|
|
57
69
|
bind_result?: Uint8Array | null;
|
|
58
|
-
required_filters: string[][];
|
|
70
|
+
required_filters: string[][][];
|
|
71
|
+
options?: /** @ipc-record OptionState */ Uint8Array | null;
|
|
72
|
+
layout?: /** @ipc-record TableLayout */ Uint8Array | null;
|
|
59
73
|
}
|
|
60
74
|
export interface ViewInfo {
|
|
61
75
|
comment?: string | null;
|
|
@@ -64,6 +78,8 @@ export interface ViewInfo {
|
|
|
64
78
|
schema_path: string[];
|
|
65
79
|
definition: string;
|
|
66
80
|
column_comments: Record<string, string>;
|
|
81
|
+
aliases: string[];
|
|
82
|
+
security: string;
|
|
67
83
|
}
|
|
68
84
|
export interface CatalogExample {
|
|
69
85
|
sql: string;
|
|
@@ -129,30 +145,67 @@ export interface FunctionInfo {
|
|
|
129
145
|
sink_order_dependent: boolean;
|
|
130
146
|
requires_input_batch_index: boolean;
|
|
131
147
|
input_from_args: boolean;
|
|
148
|
+
input_rows_per_call?: number | null;
|
|
132
149
|
required_settings: string[];
|
|
133
150
|
required_secrets: SecretLookupEntry[];
|
|
134
151
|
}
|
|
152
|
+
export interface QueryEvaluationContext {
|
|
153
|
+
timezone: string;
|
|
154
|
+
collation: string;
|
|
155
|
+
default_order: string;
|
|
156
|
+
default_null_order: string;
|
|
157
|
+
preserve_insertion_order: boolean;
|
|
158
|
+
}
|
|
159
|
+
export interface SqlExpression {
|
|
160
|
+
sql: string;
|
|
161
|
+
profile: string;
|
|
162
|
+
schema_path: string[];
|
|
163
|
+
evaluation_context: QueryEvaluationContext;
|
|
164
|
+
}
|
|
165
|
+
export interface MacroParameter {
|
|
166
|
+
name: string;
|
|
167
|
+
declared_type?: /** @arrow-schema */ Uint8Array | null;
|
|
168
|
+
default_value?: /** @ipc-record TypedValueBatch */ Uint8Array | null;
|
|
169
|
+
default_expression?: /** @ipc-record SqlExpression */ Uint8Array | null;
|
|
170
|
+
documentation?: string | null;
|
|
171
|
+
}
|
|
172
|
+
export interface MacroOverload {
|
|
173
|
+
parameters: MacroParameter[];
|
|
174
|
+
definition: string;
|
|
175
|
+
profile: string;
|
|
176
|
+
schema_path: string[];
|
|
177
|
+
macro_type: string;
|
|
178
|
+
evaluation_context: QueryEvaluationContext;
|
|
179
|
+
}
|
|
135
180
|
export interface MacroInfo {
|
|
136
181
|
comment?: string | null;
|
|
137
182
|
tags: Record<string, string>;
|
|
138
183
|
name: string;
|
|
139
184
|
schema_path: string[];
|
|
140
185
|
macro_type: MacroType;
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
186
|
+
overloads: MacroOverload[];
|
|
187
|
+
}
|
|
188
|
+
export interface CatalogObjectRef {
|
|
189
|
+
kind: string;
|
|
190
|
+
schema_path: string[];
|
|
191
|
+
name: string;
|
|
192
|
+
owner_table?: string | null;
|
|
193
|
+
}
|
|
194
|
+
export interface IndexDefinition {
|
|
195
|
+
table: Uint8Array;
|
|
196
|
+
algorithm: string;
|
|
197
|
+
keys: Uint8Array[];
|
|
198
|
+
options: Uint8Array;
|
|
199
|
+
constraint_type: IndexConstraintType;
|
|
200
|
+
associated_constraint?: /** @ipc-record CatalogObjectRef */ Uint8Array | null;
|
|
145
201
|
}
|
|
146
202
|
export interface IndexInfo {
|
|
147
203
|
comment?: string | null;
|
|
148
204
|
tags: Record<string, string>;
|
|
149
205
|
name: string;
|
|
150
206
|
schema_path: string[];
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
constraint_type: IndexConstraintType;
|
|
154
|
-
expressions: string[];
|
|
155
|
-
options: Record<string, string>;
|
|
207
|
+
definition: Uint8Array;
|
|
208
|
+
options: Uint8Array;
|
|
156
209
|
}
|
|
157
210
|
export interface AggregateBindRequest {
|
|
158
211
|
function_name: string;
|
|
@@ -323,6 +376,20 @@ export interface BindResponse {
|
|
|
323
376
|
lookup_secret_types: string[];
|
|
324
377
|
lookup_scopes: string[];
|
|
325
378
|
lookup_names: string[];
|
|
379
|
+
projection_expression_profiles: string[];
|
|
380
|
+
repeatability: BindRepeatability;
|
|
381
|
+
}
|
|
382
|
+
export interface CatalogCapabilities {
|
|
383
|
+
read: string[];
|
|
384
|
+
ddl: string[];
|
|
385
|
+
write: string[];
|
|
386
|
+
transaction: string[];
|
|
387
|
+
}
|
|
388
|
+
export interface ClientQueryCapabilities {
|
|
389
|
+
encodings: string[];
|
|
390
|
+
semantic_profiles: string[];
|
|
391
|
+
engine_version: string;
|
|
392
|
+
max_query_bytes: number;
|
|
326
393
|
}
|
|
327
394
|
export interface ClientCapabilities {
|
|
328
395
|
engine: string;
|
|
@@ -330,13 +397,25 @@ export interface ClientCapabilities {
|
|
|
330
397
|
catalogs: string[];
|
|
331
398
|
can_stream: boolean;
|
|
332
399
|
filter_encodings: string[];
|
|
400
|
+
catalog?: /** @ipc-record CatalogCapabilities */ Uint8Array | null;
|
|
401
|
+
query_pushdown?: ClientQueryCapabilities | null;
|
|
333
402
|
}
|
|
334
403
|
export interface CatalogAttachRequest {
|
|
335
404
|
name: string;
|
|
336
405
|
options?: /** @record-batch */ Uint8Array | null;
|
|
337
406
|
data_version_spec?: string | null;
|
|
338
407
|
implementation_version?: string | null;
|
|
339
|
-
client_capabilities?: ClientCapabilities | null;
|
|
408
|
+
client_capabilities?: /** @ipc-record ClientCapabilities */ Uint8Array | null;
|
|
409
|
+
}
|
|
410
|
+
export interface QueryCapabilities {
|
|
411
|
+
encoding: string;
|
|
412
|
+
semantic_profiles: string[];
|
|
413
|
+
execution_modes: string[];
|
|
414
|
+
backend_engine: string;
|
|
415
|
+
backend_version: string;
|
|
416
|
+
capability_revision: string;
|
|
417
|
+
default_evaluation_context: QueryEvaluationContext;
|
|
418
|
+
max_query_bytes: number;
|
|
340
419
|
}
|
|
341
420
|
export interface CatalogAttachResult {
|
|
342
421
|
attach_opaque_data: Uint8Array;
|
|
@@ -345,7 +424,7 @@ export interface CatalogAttachResult {
|
|
|
345
424
|
catalog_version_frozen: boolean;
|
|
346
425
|
catalog_version: number;
|
|
347
426
|
attach_opaque_data_required: boolean;
|
|
348
|
-
default_schema
|
|
427
|
+
default_schema?: string | null;
|
|
349
428
|
settings: Uint8Array[];
|
|
350
429
|
secret_types: Uint8Array[];
|
|
351
430
|
attach_catalogs: Uint8Array[];
|
|
@@ -357,6 +436,9 @@ export interface CatalogAttachResult {
|
|
|
357
436
|
resolved_data_version?: string | null;
|
|
358
437
|
resolved_implementation_version?: string | null;
|
|
359
438
|
supports_catalog_contents: boolean;
|
|
439
|
+
catalog_capabilities?: /** @ipc-record CatalogCapabilities */ Uint8Array | null;
|
|
440
|
+
selected_capabilities?: /** @ipc-record CatalogCapabilities */ Uint8Array | null;
|
|
441
|
+
query_pushdown?: QueryCapabilities | null;
|
|
360
442
|
}
|
|
361
443
|
export interface CatalogsResponse {
|
|
362
444
|
items: CatalogInfo[];
|
|
@@ -380,36 +462,74 @@ export interface CatalogCreateRequest {
|
|
|
380
462
|
on_conflict: OnConflict;
|
|
381
463
|
options?: /** @record-batch */ Uint8Array | null;
|
|
382
464
|
}
|
|
465
|
+
export interface DependencySnapshot {
|
|
466
|
+
catalog_version: number;
|
|
467
|
+
objects: Uint8Array[];
|
|
468
|
+
dependencies: Uint8Array[];
|
|
469
|
+
}
|
|
383
470
|
export interface IndexCreateRequest {
|
|
384
471
|
attach_opaque_data: Uint8Array;
|
|
385
472
|
schema_path: string[];
|
|
386
473
|
name: string;
|
|
387
|
-
|
|
388
|
-
index_type: string;
|
|
389
|
-
constraint_type: IndexConstraintType;
|
|
390
|
-
expressions: string[];
|
|
474
|
+
definition: Uint8Array;
|
|
391
475
|
on_conflict: OnConflict;
|
|
392
|
-
options: Record<string, string>;
|
|
393
476
|
transaction_opaque_data?: Uint8Array | null;
|
|
394
477
|
}
|
|
395
478
|
export interface IndexesResponse {
|
|
396
479
|
items: IndexInfo[];
|
|
397
480
|
}
|
|
481
|
+
export interface OptionDefinitions {
|
|
482
|
+
schema: Uint8Array;
|
|
483
|
+
defaults: Uint8Array;
|
|
484
|
+
create_names: string[];
|
|
485
|
+
alter_names: string[];
|
|
486
|
+
}
|
|
398
487
|
export interface MacroCreateRequest {
|
|
399
488
|
attach_opaque_data: Uint8Array;
|
|
400
489
|
schema_path: string[];
|
|
401
490
|
name: string;
|
|
402
491
|
macro_type: MacroType;
|
|
403
|
-
|
|
404
|
-
definition: string;
|
|
492
|
+
overloads: MacroOverload[];
|
|
405
493
|
on_conflict: OnConflict;
|
|
406
|
-
parameter_default_values?: /** @record-batch */ Uint8Array | null;
|
|
407
|
-
arguments_schema?: /** @arrow-schema */ Uint8Array | null;
|
|
408
494
|
transaction_opaque_data?: Uint8Array | null;
|
|
409
495
|
}
|
|
410
496
|
export interface MacrosResponse {
|
|
411
497
|
items: MacroInfo[];
|
|
412
498
|
}
|
|
499
|
+
export interface QueryObjectReference {
|
|
500
|
+
object: CatalogObjectRef;
|
|
501
|
+
expected_schema: Uint8Array;
|
|
502
|
+
}
|
|
503
|
+
export interface CatalogQueryPrepareRequest {
|
|
504
|
+
attach_opaque_data: Uint8Array;
|
|
505
|
+
encoding: string;
|
|
506
|
+
semantic_profile: string;
|
|
507
|
+
mode: string;
|
|
508
|
+
capability_revision: string;
|
|
509
|
+
query: string;
|
|
510
|
+
parameter_schema: Uint8Array;
|
|
511
|
+
evaluation_context: QueryEvaluationContext;
|
|
512
|
+
transaction_opaque_data?: Uint8Array | null;
|
|
513
|
+
catalog_version?: number | null;
|
|
514
|
+
catalog_etag?: string | null;
|
|
515
|
+
referenced_objects: QueryObjectReference[];
|
|
516
|
+
expected_output_schema?: Uint8Array | null;
|
|
517
|
+
required_ordering: string;
|
|
518
|
+
}
|
|
519
|
+
export interface CatalogQueryPrepareResult {
|
|
520
|
+
status: string;
|
|
521
|
+
reason_code?: string | null;
|
|
522
|
+
reason_detail?: string | null;
|
|
523
|
+
prepared_query_token?: Uint8Array | null;
|
|
524
|
+
output_schema?: Uint8Array | null;
|
|
525
|
+
result_ordering?: string | null;
|
|
526
|
+
validated_catalog_version?: number | null;
|
|
527
|
+
validated_catalog_etag?: string | null;
|
|
528
|
+
context_digest?: Uint8Array | null;
|
|
529
|
+
expires_at_epoch_ms?: number | null;
|
|
530
|
+
estimated_rows?: number | null;
|
|
531
|
+
estimated_bytes?: number | null;
|
|
532
|
+
}
|
|
413
533
|
export interface FunctionsResponse {
|
|
414
534
|
items: FunctionInfo[];
|
|
415
535
|
}
|
|
@@ -422,18 +542,30 @@ export interface ViewsResponse {
|
|
|
422
542
|
export interface SchemasResponse {
|
|
423
543
|
items: SchemaInfo[];
|
|
424
544
|
}
|
|
545
|
+
export interface ConstraintsApplyRequest {
|
|
546
|
+
attach_opaque_data: Uint8Array;
|
|
547
|
+
table: Uint8Array;
|
|
548
|
+
expected_revision: Uint8Array;
|
|
549
|
+
changes: Uint8Array[];
|
|
550
|
+
transaction_opaque_data?: Uint8Array | null;
|
|
551
|
+
}
|
|
552
|
+
export interface ConstraintSnapshot {
|
|
553
|
+
table: Uint8Array;
|
|
554
|
+
definition_revision: Uint8Array;
|
|
555
|
+
constraints: Uint8Array[];
|
|
556
|
+
}
|
|
425
557
|
export interface TableCreateRequest {
|
|
426
558
|
attach_opaque_data: Uint8Array;
|
|
427
559
|
schema_path: string[];
|
|
428
560
|
name: string;
|
|
429
561
|
columns: Uint8Array;
|
|
430
562
|
on_conflict: OnConflict;
|
|
431
|
-
|
|
432
|
-
unique_constraints: number[][];
|
|
433
|
-
check_constraints: string[];
|
|
434
|
-
primary_key_constraints: number[][];
|
|
435
|
-
foreign_key_constraints: Uint8Array[];
|
|
563
|
+
constraint_definitions: Uint8Array[];
|
|
436
564
|
transaction_opaque_data?: Uint8Array | null;
|
|
565
|
+
comment?: string | null;
|
|
566
|
+
tags?: Record<string, string> | null;
|
|
567
|
+
options?: /** @ipc-record TypedValueBatch */ Uint8Array | null;
|
|
568
|
+
layout?: /** @ipc-record TableLayout */ Uint8Array | null;
|
|
437
569
|
}
|
|
438
570
|
export interface TransactionBeginResponse {
|
|
439
571
|
transaction_opaque_data?: Uint8Array | null;
|
|
@@ -442,7 +574,7 @@ export interface CatalogVersionResponse {
|
|
|
442
574
|
version: number;
|
|
443
575
|
}
|
|
444
576
|
export interface InitRequest {
|
|
445
|
-
bind_call:
|
|
577
|
+
bind_call: Uint8Array;
|
|
446
578
|
output_schema: Uint8Array;
|
|
447
579
|
bind_opaque_data?: Uint8Array | null;
|
|
448
580
|
projection_ids?: number[] | null;
|
|
@@ -495,7 +627,7 @@ export interface TableBufferingProcessResponse {
|
|
|
495
627
|
state_id: Uint8Array;
|
|
496
628
|
}
|
|
497
629
|
export interface TableFunctionCardinalityRequest {
|
|
498
|
-
bind_call:
|
|
630
|
+
bind_call: Uint8Array;
|
|
499
631
|
bind_opaque_data?: Uint8Array | null;
|
|
500
632
|
}
|
|
501
633
|
export interface TableCardinality {
|
|
@@ -503,7 +635,7 @@ export interface TableCardinality {
|
|
|
503
635
|
max?: number | null;
|
|
504
636
|
}
|
|
505
637
|
export interface TableFunctionDynamicToStringRequest {
|
|
506
|
-
bind_call:
|
|
638
|
+
bind_call: Uint8Array;
|
|
507
639
|
bind_opaque_data?: Uint8Array | null;
|
|
508
640
|
global_execution_id: Uint8Array;
|
|
509
641
|
}
|
|
@@ -512,7 +644,7 @@ export interface TableFunctionDynamicToStringResponse {
|
|
|
512
644
|
values: string[];
|
|
513
645
|
}
|
|
514
646
|
export interface TableFunctionPlanRequest {
|
|
515
|
-
bind_call:
|
|
647
|
+
bind_call: Uint8Array;
|
|
516
648
|
bind_opaque_data?: Uint8Array | null;
|
|
517
649
|
projection_ids?: number[] | null;
|
|
518
650
|
pushdown_filters?: /** @record-batch */ Uint8Array | null;
|
|
@@ -563,8 +695,18 @@ export interface PlanResponse {
|
|
|
563
695
|
start_position?: Uint8Array | null;
|
|
564
696
|
end_position?: Uint8Array | null;
|
|
565
697
|
}
|
|
698
|
+
export interface TableFunctionProjectionRequest {
|
|
699
|
+
bind_call: Uint8Array;
|
|
700
|
+
bind_result: Uint8Array;
|
|
701
|
+
expressions: Uint8Array[];
|
|
702
|
+
result_schema: Uint8Array;
|
|
703
|
+
}
|
|
704
|
+
export interface TableFunctionProjectionResponse {
|
|
705
|
+
accepted_indices: number[];
|
|
706
|
+
bind_result?: /** @ipc-record BindResponse */ Uint8Array | null;
|
|
707
|
+
}
|
|
566
708
|
export interface TableFunctionStatisticsRequest {
|
|
567
|
-
bind_call:
|
|
709
|
+
bind_call: Uint8Array;
|
|
568
710
|
bind_opaque_data?: Uint8Array | null;
|
|
569
711
|
}
|
|
570
712
|
export declare const encodeCatalogInfo: (v: CatalogInfo) => Uint8Array;
|