@query-farm/vgi 0.45.0 → 0.46.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 +8 -1
- package/dist/arrow/impl-flechette/canonical.d.ts +1 -1
- package/dist/arrow/impl-flechette/schema.d.ts +19 -5
- package/dist/client/client.d.ts +20 -1
- package/dist/client-entry.js +54 -13
- package/dist/client-entry.js.map +8 -6
- package/dist/functions/continuation.d.ts +69 -0
- package/dist/functions/table-in-out.d.ts +51 -7
- package/dist/functions/types.d.ts +20 -0
- package/dist/generated/vgi-client.d.ts +1 -0
- package/dist/generated/vgi-protocol-schemas.d.ts +1 -1
- package/dist/index.core.d.ts +1 -0
- package/dist/index.js +244 -59
- package/dist/index.js.map +14 -12
- package/dist/serve-entry.js +35 -5
- package/dist/serve-entry.js.map +8 -7
- package/dist/util/parent-rows.d.ts +8 -0
- package/dist/worker-cf-entry.d.ts +1 -1
- package/dist/worker-cf-entry.js +197 -47
- package/dist/worker-cf-entry.js.map +14 -12
- package/package.json +4 -4
- package/src/arrow/impl-flechette/canonical.ts +7 -5
- package/src/catalog/read-only.ts +6 -0
- package/src/client/client.ts +80 -11
- package/src/filter-pushdown/collector.ts +17 -1
- package/src/functions/continuation.ts +202 -0
- package/src/functions/table-in-out.ts +131 -56
- package/src/functions/types.ts +20 -0
- package/src/generated/vgi-client.ts +2 -1
- package/src/generated/vgi-protocol-schemas.ts +3 -2
- package/src/index.core.ts +6 -0
- package/src/protocol/handlers/function.ts +12 -0
- package/src/protocol/state-serializer.ts +7 -1
- package/src/util/parent-rows.ts +41 -0
- package/src/worker-cf-entry.ts +3 -0
package/dist/serve-entry.js
CHANGED
|
@@ -3172,7 +3172,8 @@ var EXCHANGE_STATE_SCHEMA = schema2([
|
|
|
3172
3172
|
field2("opaque_data", binary2(), true),
|
|
3173
3173
|
field2("is_producer", bool2(), false),
|
|
3174
3174
|
field2("user_state", binary2(), true),
|
|
3175
|
-
field2("filter_history", binary2(), true)
|
|
3175
|
+
field2("filter_history", binary2(), true),
|
|
3176
|
+
field2("more_pending", bool2(), false)
|
|
3176
3177
|
]);
|
|
3177
3178
|
var TEXT_ENCODER = new TextEncoder;
|
|
3178
3179
|
var TEXT_DECODER = new TextDecoder;
|
|
@@ -3181,6 +3182,7 @@ var FLAG_PRODUCER = 1;
|
|
|
3181
3182
|
var FLAG_OPAQUE_DATA = 2;
|
|
3182
3183
|
var FLAG_USER_STATE = 4;
|
|
3183
3184
|
var FLAG_FILTER_HISTORY = 8;
|
|
3185
|
+
var FLAG_MORE_PENDING = 16;
|
|
3184
3186
|
var LIST_CHILD_NAME = "item";
|
|
3185
3187
|
var emptyListElementType = () => utf82();
|
|
3186
3188
|
function inferElementType(values) {
|
|
@@ -3286,7 +3288,7 @@ var arrowStateSerializer = {
|
|
|
3286
3288
|
const opaqueData = state.opaqueData != null ? toUint8Array(state.opaqueData) : null;
|
|
3287
3289
|
const userState = serializeUserState(state.userState);
|
|
3288
3290
|
const filterHistory = encodeFilterHistory(state.filterHistory);
|
|
3289
|
-
const flags = (state.isProducer ? FLAG_PRODUCER : 0) | (opaqueData ? FLAG_OPAQUE_DATA : 0) | (userState ? FLAG_USER_STATE : 0) | (filterHistory ? FLAG_FILTER_HISTORY : 0);
|
|
3291
|
+
const flags = (state.isProducer ? FLAG_PRODUCER : 0) | (opaqueData ? FLAG_OPAQUE_DATA : 0) | (userState ? FLAG_USER_STATE : 0) | (filterHistory ? FLAG_FILTER_HISTORY : 0) | (state.morePending ? FLAG_MORE_PENDING : 0);
|
|
3290
3292
|
const chunks = [functionName, initRequest, executionId];
|
|
3291
3293
|
if (opaqueData)
|
|
3292
3294
|
chunks.push(opaqueData);
|
|
@@ -3347,7 +3349,8 @@ var arrowStateSerializer = {
|
|
|
3347
3349
|
isProducer,
|
|
3348
3350
|
__isProducer: isProducer,
|
|
3349
3351
|
userState: deserializeUserState(userStateBytes),
|
|
3350
|
-
filterHistory: decodeFilterHistory(filterHistoryBytes)
|
|
3352
|
+
filterHistory: decodeFilterHistory(filterHistoryBytes),
|
|
3353
|
+
morePending: (flags & FLAG_MORE_PENDING) !== 0
|
|
3351
3354
|
};
|
|
3352
3355
|
}
|
|
3353
3356
|
};
|
|
@@ -4606,13 +4609,32 @@ function createVgiProtocol(service) {
|
|
|
4606
4609
|
return registerVgiService(new Protocol(VGI_PROTOCOL_NAME, { protocolVersion: VGI_PROTOCOL_VERSION }), service);
|
|
4607
4610
|
}
|
|
4608
4611
|
|
|
4612
|
+
// src/functions/continuation.ts
|
|
4613
|
+
var STATUS_KEY = "vgi.status";
|
|
4614
|
+
var HAVE_MORE_OUTPUT = "HAVE_MORE_OUTPUT";
|
|
4615
|
+
function replyMetadata(out) {
|
|
4616
|
+
const idx = out.dataBatchIdx;
|
|
4617
|
+
if (idx == null)
|
|
4618
|
+
return null;
|
|
4619
|
+
const emitted = out.batches[idx];
|
|
4620
|
+
const md = new Map(emitted.batch.metadata ?? []);
|
|
4621
|
+
for (const [k, v] of emitted.metadata ?? [])
|
|
4622
|
+
md.set(k, v);
|
|
4623
|
+
return md;
|
|
4624
|
+
}
|
|
4625
|
+
function refuseMoreOutput(name, out) {
|
|
4626
|
+
if (replyMetadata(out)?.get(STATUS_KEY) === HAVE_MORE_OUTPUT) {
|
|
4627
|
+
throw new Error(`${name}: HAVE_MORE_OUTPUT (moreOutputMetadata) is only valid in a table-in-out ` + `function's process() or resume()`);
|
|
4628
|
+
}
|
|
4629
|
+
}
|
|
4630
|
+
|
|
4609
4631
|
// src/util/statistics.ts
|
|
4610
4632
|
function serializeColumnStatistics(stats, _cacheMaxAgeSeconds) {
|
|
4611
4633
|
return serializeBatch(buildStatisticsBatch(stats));
|
|
4612
4634
|
}
|
|
4613
4635
|
|
|
4614
4636
|
// src/generated/vgi-protocol-schemas.ts
|
|
4615
|
-
var VGI_CATALOG_CONTRACT_HASH = "
|
|
4637
|
+
var VGI_CATALOG_CONTRACT_HASH = "0aa39285365f5f4326ce85c4d41d2705ea992dee41cf98d07640a2767b6ac3fb";
|
|
4616
4638
|
var CatalogInfoSchema = schema2([
|
|
4617
4639
|
field2("name", utf82(), false),
|
|
4618
4640
|
field2("implementation_version", utf82(), true),
|
|
@@ -4698,6 +4720,7 @@ var FunctionInfoSchema = schema2([
|
|
|
4698
4720
|
field2("sink_order_dependent", bool2(), false),
|
|
4699
4721
|
field2("requires_input_batch_index", bool2(), false),
|
|
4700
4722
|
field2("input_from_args", bool2(), false),
|
|
4723
|
+
field2("input_rows_per_call", int642(), true),
|
|
4701
4724
|
field2("required_settings", list2(field2("item", utf82(), true)), false),
|
|
4702
4725
|
field2("required_secrets", list2(field2("item", struct2([field2("secret_type", utf82(), false), field2("scope", utf82(), true), field2("secret_name", utf82(), true)]), true)), false)
|
|
4703
4726
|
]);
|
|
@@ -6856,6 +6879,9 @@ function functionHandlers(config) {
|
|
|
6856
6879
|
if (state.userState != null && handlerState?.state !== undefined) {
|
|
6857
6880
|
handlerState.state = state.userState;
|
|
6858
6881
|
}
|
|
6882
|
+
if (handlers.continuesOutput) {
|
|
6883
|
+
handlerState.morePending = state.morePending === true;
|
|
6884
|
+
}
|
|
6859
6885
|
}
|
|
6860
6886
|
if (state.isProducer && handlers.producerFn) {
|
|
6861
6887
|
out.finish = () => {
|
|
@@ -6868,10 +6894,14 @@ function functionHandlers(config) {
|
|
|
6868
6894
|
} else if (handlers.exchangeFn) {
|
|
6869
6895
|
await handlers.exchangeFn(handlerState, input, out);
|
|
6870
6896
|
}
|
|
6897
|
+
if (!handlers.continuesOutput) {
|
|
6898
|
+
refuseMoreOutput(state.functionName, out);
|
|
6899
|
+
}
|
|
6871
6900
|
if (handlerState?.state !== undefined) {
|
|
6872
6901
|
state.userState = handlerState.state;
|
|
6873
6902
|
}
|
|
6874
6903
|
state.filterHistory = handlerState?.filterHistory ?? null;
|
|
6904
|
+
state.morePending = handlerState?.morePending === true;
|
|
6875
6905
|
},
|
|
6876
6906
|
headerInit: (params, state, ctx) => {
|
|
6877
6907
|
if (!state._initResponse) {
|
|
@@ -9592,4 +9622,4 @@ export {
|
|
|
9592
9622
|
serveVgiWorker
|
|
9593
9623
|
};
|
|
9594
9624
|
|
|
9595
|
-
//# debugId=
|
|
9625
|
+
//# debugId=C0E67975BCC50FF364756E2164756E21
|