@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/dist/index.js CHANGED
@@ -4625,6 +4625,41 @@ function replayFilterHistory(filters, history) {
4625
4625
 
4626
4626
  // src/filter-pushdown/collector.ts
4627
4627
  init_arrow();
4628
+
4629
+ // src/util/parent-rows.ts
4630
+ var PARENT_ROW_METADATA_KEY = "vgi_rpc.parent_row#b64";
4631
+ function encodeParentRows(parentRows) {
4632
+ const raw = new Uint8Array(parentRows.length * 4);
4633
+ const dv = new DataView(raw.buffer);
4634
+ for (let i = 0;i < parentRows.length; i++) {
4635
+ dv.setInt32(i * 4, parentRows[i], true);
4636
+ }
4637
+ if (typeof globalThis.Buffer !== "undefined") {
4638
+ return globalThis.Buffer.from(raw).toString("base64");
4639
+ }
4640
+ let bin = "";
4641
+ for (let i = 0;i < raw.length; i++)
4642
+ bin += String.fromCharCode(raw[i]);
4643
+ return globalThis.btoa(bin);
4644
+ }
4645
+ function decodeParentRows(encoded) {
4646
+ let raw;
4647
+ if (typeof globalThis.Buffer !== "undefined") {
4648
+ raw = new Uint8Array(globalThis.Buffer.from(encoded, "base64"));
4649
+ } else {
4650
+ const bin = globalThis.atob(encoded);
4651
+ raw = new Uint8Array(bin.length);
4652
+ for (let i = 0;i < bin.length; i++)
4653
+ raw[i] = bin.charCodeAt(i);
4654
+ }
4655
+ const dv = new DataView(raw.buffer, raw.byteOffset, raw.byteLength);
4656
+ const out = new Int32Array(raw.byteLength >> 2);
4657
+ for (let i = 0;i < out.length; i++)
4658
+ out[i] = dv.getInt32(i * 4, true);
4659
+ return out;
4660
+ }
4661
+
4662
+ // src/filter-pushdown/collector.ts
4628
4663
  function formatPushedFilters(filters) {
4629
4664
  if (!filters || filters.filters.length === 0)
4630
4665
  return "(none)";
@@ -4711,6 +4746,22 @@ class FilteringOutputCollector {
4711
4746
  } else {
4712
4747
  batch = batchFromColumns(batchOrColumns, this.inner.outputSchema);
4713
4748
  }
4749
+ const encoded = metadata?.get(PARENT_ROW_METADATA_KEY);
4750
+ if (encoded !== undefined && batch.numRows > 0 && this.filters.filters.length > 0) {
4751
+ const mask = this.filters.evaluate(batch);
4752
+ const parents = decodeParentRows(encoded);
4753
+ const kept = [];
4754
+ for (let i = 0;i < parents.length; i++)
4755
+ if (mask[i])
4756
+ kept.push(parents[i]);
4757
+ const md = new Map(metadata);
4758
+ if (kept.length > 0)
4759
+ md.set(PARENT_ROW_METADATA_KEY, encodeParentRows(kept));
4760
+ else
4761
+ md.delete(PARENT_ROW_METADATA_KEY);
4762
+ this.inner.emit(filterBatch(batch, mask), md);
4763
+ return;
4764
+ }
4714
4765
  const filtered = this.filters.apply(batch);
4715
4766
  this.inner.emit(filtered, metadata);
4716
4767
  }
@@ -6006,7 +6057,8 @@ var EXCHANGE_STATE_SCHEMA = schema2([
6006
6057
  field2("opaque_data", binary2(), true),
6007
6058
  field2("is_producer", bool2(), false),
6008
6059
  field2("user_state", binary2(), true),
6009
- field2("filter_history", binary2(), true)
6060
+ field2("filter_history", binary2(), true),
6061
+ field2("more_pending", bool2(), false)
6010
6062
  ]);
6011
6063
  var TEXT_ENCODER = new TextEncoder;
6012
6064
  var TEXT_DECODER = new TextDecoder;
@@ -6015,6 +6067,7 @@ var FLAG_PRODUCER = 1;
6015
6067
  var FLAG_OPAQUE_DATA = 2;
6016
6068
  var FLAG_USER_STATE = 4;
6017
6069
  var FLAG_FILTER_HISTORY = 8;
6070
+ var FLAG_MORE_PENDING = 16;
6018
6071
  var LIST_CHILD_NAME = "item";
6019
6072
  var emptyListElementType = () => utf82();
6020
6073
  function inferElementType(values) {
@@ -6120,7 +6173,7 @@ var arrowStateSerializer = {
6120
6173
  const opaqueData = state.opaqueData != null ? toUint8Array(state.opaqueData) : null;
6121
6174
  const userState = serializeUserState(state.userState);
6122
6175
  const filterHistory = encodeFilterHistory(state.filterHistory);
6123
- const flags = (state.isProducer ? FLAG_PRODUCER : 0) | (opaqueData ? FLAG_OPAQUE_DATA : 0) | (userState ? FLAG_USER_STATE : 0) | (filterHistory ? FLAG_FILTER_HISTORY : 0);
6176
+ 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);
6124
6177
  const chunks = [functionName, initRequest, executionId];
6125
6178
  if (opaqueData)
6126
6179
  chunks.push(opaqueData);
@@ -6181,15 +6234,99 @@ var arrowStateSerializer = {
6181
6234
  isProducer,
6182
6235
  __isProducer: isProducer,
6183
6236
  userState: deserializeUserState(userStateBytes),
6184
- filterHistory: decodeFilterHistory(filterHistoryBytes)
6237
+ filterHistory: decodeFilterHistory(filterHistoryBytes),
6238
+ morePending: (flags & FLAG_MORE_PENDING) !== 0
6185
6239
  };
6186
6240
  }
6187
6241
  };
6188
6242
 
6243
+ // src/functions/continuation.ts
6244
+ var STATUS_KEY = "vgi.status";
6245
+ var HAVE_MORE_OUTPUT = "HAVE_MORE_OUTPUT";
6246
+ var CONTINUE = "CONTINUE";
6247
+ var CACHE_KEY_PREFIX = "vgi.cache.";
6248
+ function moreOutputMetadata(more, extra) {
6249
+ const md = new Map(extra ?? []);
6250
+ if (more)
6251
+ md.set(STATUS_KEY, HAVE_MORE_OUTPUT);
6252
+ return md;
6253
+ }
6254
+ function replyMetadata(out) {
6255
+ const idx = out.dataBatchIdx;
6256
+ if (idx == null)
6257
+ return null;
6258
+ const emitted = out.batches[idx];
6259
+ const md = new Map(emitted.batch.metadata ?? []);
6260
+ for (const [k, v] of emitted.metadata ?? [])
6261
+ md.set(k, v);
6262
+ return md;
6263
+ }
6264
+ function refuseMoreOutput(name, out) {
6265
+ if (replyMetadata(out)?.get(STATUS_KEY) === HAVE_MORE_OUTPUT) {
6266
+ throw new Error(`${name}: HAVE_MORE_OUTPUT (moreOutputMetadata) is only valid in a table-in-out ` + `function's process() or resume()`);
6267
+ }
6268
+ }
6269
+ async function continuationTurn(name, eState, input, out, resumable, run) {
6270
+ const inputStatus = input?.metadata?.get(STATUS_KEY) ?? out.inputMetadata?.get(STATUS_KEY);
6271
+ const tick = inputStatus === CONTINUE;
6272
+ if (tick && !eState.morePending) {
6273
+ throw new Error(`${name}: continuation tick received, but no output is pending`);
6274
+ }
6275
+ if (tick && input.numRows !== 0) {
6276
+ throw new Error(`${name}: a continuation tick must have no rows, got ${input.numRows}`);
6277
+ }
6278
+ if (!tick && eState.morePending) {
6279
+ throw new Error(`${name}: input received while output is pending; expected a continuation tick`);
6280
+ }
6281
+ await run(tick);
6282
+ const md = replyMetadata(out);
6283
+ if (md == null) {
6284
+ throw new Error(tick ? `${name}: resume() must emit a batch for every continuation tick` : `${name}: process() must emit a batch for every input batch (No data batch was emitted)`);
6285
+ }
6286
+ const more = md.get(STATUS_KEY) === HAVE_MORE_OUTPUT;
6287
+ if (more && !resumable) {
6288
+ throw new Error(`${name}: emitted HAVE_MORE_OUTPUT but does not implement resume()`);
6289
+ }
6290
+ if (tick) {
6291
+ for (const key of md.keys()) {
6292
+ if (key.startsWith(CACHE_KEY_PREFIX)) {
6293
+ throw new Error(`${name}: cache control is only valid on an input's first reply, ` + `not on one answering a continuation tick (${key})`);
6294
+ }
6295
+ }
6296
+ }
6297
+ eState.morePending = more;
6298
+ }
6299
+ function checkResumeContract(name, config) {
6300
+ if (config.resume == null)
6301
+ return;
6302
+ if (typeof config.resume !== "function") {
6303
+ throw new Error(`${name}: resume must be a function`);
6304
+ }
6305
+ if (config.maxWorkers === 1) {
6306
+ throw new Error(`${name}: resume() (continued output) is not supported with maxWorkers: 1; ` + `the client runs such a function on one shared connection.`);
6307
+ }
6308
+ if (config.initialState == null) {
6309
+ throw new Error(`${name}: resume() continues from its state alone, so the function must ` + `declare an initialState holding where to resume.`);
6310
+ }
6311
+ }
6312
+ function checkInputRowsPerCall(name, value, blended) {
6313
+ if (value == null)
6314
+ return;
6315
+ if (!blended) {
6316
+ throw new Error(`${name}: inputRowsPerCall applies only to a blended row-transform function, ` + `whose per-row input the client can split into calls`);
6317
+ }
6318
+ if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 1) {
6319
+ throw new Error(`${name}: inputRowsPerCall must be a positive integer, got ${String(value)}`);
6320
+ }
6321
+ return value;
6322
+ }
6323
+
6189
6324
  // src/functions/table-in-out.ts
6190
6325
  var STREAMING_FINALIZE_KEY = new Uint8Array(0);
6191
6326
  function defineTableInOutFunction(config) {
6192
6327
  assertArrowTypes(config.args, `defineTableInOutFunction("${config.name}"): args`);
6328
+ checkResumeContract(config.name, config);
6329
+ checkInputRowsPerCall(config.name, config.inputRowsPerCall, false);
6193
6330
  const specs = [];
6194
6331
  let posIdx = 0;
6195
6332
  if (config.args) {
@@ -6371,20 +6508,27 @@ function defineTableInOutFunction(config) {
6371
6508
  return {
6372
6509
  outputSchema,
6373
6510
  inputSchema: request.bind_call.input_schema,
6374
- exchangeInit: () => ({ state, processParams, filterHistory: carriedFilterHistory }),
6511
+ continuesOutput: true,
6512
+ exchangeInit: () => ({ state, processParams, filterHistory: carriedFilterHistory, morePending: false }),
6375
6513
  exchangeFn: async (eState, input, out) => {
6376
- applyRevalidationValidators(eState.processParams, input);
6377
- applyDynamicFilterUpdate(eState, input);
6378
- let wrappedOut = makeMetadataBakingCollector(out);
6379
- if (projIds) {
6380
- wrappedOut = makeSchemaReconcilingCollector(wrappedOut, outputSchema);
6381
- }
6382
- const currentFilters = eState.processParams.pushdownFilters;
6383
- if (config.autoApplyFilters && currentFilters) {
6384
- wrappedOut = new FilteringOutputCollector(wrappedOut, currentFilters);
6385
- }
6386
- await processFn(eState.processParams, eState.state, input, wrappedOut);
6387
- if (eState.state != null) {
6514
+ await continuationTurn(config.name, eState, input, out, config.resume != null, async (tick) => {
6515
+ applyRevalidationValidators(eState.processParams, input);
6516
+ applyDynamicFilterUpdate(eState, input);
6517
+ let wrappedOut = makeMetadataBakingCollector(out);
6518
+ if (projIds) {
6519
+ wrappedOut = makeSchemaReconcilingCollector(wrappedOut, outputSchema);
6520
+ }
6521
+ const currentFilters = eState.processParams.pushdownFilters;
6522
+ if (config.autoApplyFilters && currentFilters) {
6523
+ wrappedOut = new FilteringOutputCollector(wrappedOut, currentFilters);
6524
+ }
6525
+ if (tick) {
6526
+ await config.resume(eState.processParams, eState.state, wrappedOut);
6527
+ } else {
6528
+ await processFn(eState.processParams, eState.state, input, wrappedOut);
6529
+ }
6530
+ });
6531
+ if (config.finalize && eState.state != null) {
6388
6532
  const serialized = serializeUserState(eState.state);
6389
6533
  if (serialized != null) {
6390
6534
  await boundStorage.put(serialized);
@@ -6462,7 +6606,6 @@ function makeSchemaReconcilingCollector(inner, targetSchema) {
6462
6606
  }
6463
6607
  });
6464
6608
  }
6465
- var PARENT_ROW_METADATA_KEY = "vgi_rpc.parent_row#b64";
6466
6609
  function parentRowsMetadata(parentRows, outputRows, extra) {
6467
6610
  if (parentRows.length !== outputRows) {
6468
6611
  throw new Error(`parentRowsMetadata: length ${parentRows.length} != output rows ${outputRows}; ` + `parentRows must carry exactly one input-row index per emitted output row`);
@@ -6471,28 +6614,16 @@ function parentRowsMetadata(parentRows, outputRows, extra) {
6471
6614
  if (outputRows === 0) {
6472
6615
  return md;
6473
6616
  }
6474
- const raw = new Uint8Array(parentRows.length * 4);
6475
- const dv = new DataView(raw.buffer);
6476
- for (let i = 0;i < parentRows.length; i++) {
6477
- dv.setInt32(i * 4, parentRows[i], true);
6478
- }
6479
- md.set(PARENT_ROW_METADATA_KEY, base64Encode(raw));
6617
+ md.set(PARENT_ROW_METADATA_KEY, encodeParentRows(parentRows));
6480
6618
  return md;
6481
6619
  }
6482
- function base64Encode(bytes) {
6483
- if (typeof globalThis.Buffer !== "undefined") {
6484
- return globalThis.Buffer.from(bytes).toString("base64");
6485
- }
6486
- let bin = "";
6487
- for (let i = 0;i < bytes.length; i++)
6488
- bin += String.fromCharCode(bytes[i]);
6489
- return globalThis.btoa(bin);
6490
- }
6491
6620
  function defineRowTransformFunction(config) {
6492
6621
  const numPositional = Object.keys(config.args ?? {}).length + (config.varargs ? 1 : 0);
6493
6622
  if (numPositional === 0) {
6494
6623
  throw new Error(`${config.name}: a blended row-transform function needs at least one ` + `positional arg (its per-row input column); found none.`);
6495
6624
  }
6625
+ checkResumeContract(config.name, config);
6626
+ const inputRowsPerCall = checkInputRowsPerCall(config.name, config.inputRowsPerCall, true);
6496
6627
  const specs = [];
6497
6628
  let posIdx = 0;
6498
6629
  if (config.args) {
@@ -6546,7 +6677,8 @@ function defineRowTransformFunction(config) {
6546
6677
  requiredSettings: config.requiredSettings,
6547
6678
  requiredSecrets: config.requiredSecrets,
6548
6679
  hasFinalize: false,
6549
- inputFromArgs: true
6680
+ inputFromArgs: true,
6681
+ inputRowsPerCall
6550
6682
  };
6551
6683
  function extractArgs(request) {
6552
6684
  const args = {};
@@ -6631,22 +6763,30 @@ function defineRowTransformFunction(config) {
6631
6763
  if (request.bind_call.input_schema == null) {
6632
6764
  throw new Error(`${config.name}: is a table-in-out function (its positional args are ` + `per-row input columns) but no input schema was supplied -- call it ` + `via table_in_out_function(input=...), not table_function().`);
6633
6765
  }
6766
+ const state = config.initialState ? config.initialState(processParams) : null;
6634
6767
  return {
6635
6768
  outputSchema,
6636
6769
  inputSchema: request.bind_call.input_schema,
6637
- exchangeInit: () => ({ state: null, processParams, filterHistory: carriedFilterHistory }),
6770
+ continuesOutput: true,
6771
+ exchangeInit: () => ({ state, processParams, filterHistory: carriedFilterHistory, morePending: false }),
6638
6772
  exchangeFn: async (eState, input, out) => {
6639
- applyRevalidationValidators(eState.processParams, input);
6640
- applyDynamicFilterUpdate(eState, input);
6641
- let wrappedOut = makeMetadataBakingCollector(out);
6642
- if (projIds) {
6643
- wrappedOut = makeSchemaReconcilingCollector(wrappedOut, outputSchema);
6644
- }
6645
- const currentFilters = eState.processParams.pushdownFilters;
6646
- if (config.autoApplyFilters && currentFilters) {
6647
- wrappedOut = new FilteringOutputCollector(wrappedOut, currentFilters);
6648
- }
6649
- await config.process(eState.processParams, input, wrappedOut);
6773
+ await continuationTurn(config.name, eState, input, out, config.resume != null, async (tick) => {
6774
+ applyRevalidationValidators(eState.processParams, input);
6775
+ applyDynamicFilterUpdate(eState, input);
6776
+ let wrappedOut = makeMetadataBakingCollector(out);
6777
+ if (projIds) {
6778
+ wrappedOut = makeSchemaReconcilingCollector(wrappedOut, outputSchema);
6779
+ }
6780
+ const currentFilters = eState.processParams.pushdownFilters;
6781
+ if (config.autoApplyFilters && currentFilters) {
6782
+ wrappedOut = new FilteringOutputCollector(wrappedOut, currentFilters);
6783
+ }
6784
+ if (tick) {
6785
+ await config.resume(eState.processParams, eState.state, wrappedOut);
6786
+ } else {
6787
+ await config.process(eState.processParams, input, wrappedOut, eState.state);
6788
+ }
6789
+ });
6650
6790
  }
6651
6791
  };
6652
6792
  }
@@ -7421,7 +7561,7 @@ function decodeASDCollection(schema, bytes) {
7421
7561
 
7422
7562
  // src/generated/vgi-protocol-schemas.ts
7423
7563
  init_arrow();
7424
- var VGI_CATALOG_CONTRACT_HASH = "121e8fe1c074bce00a6d0fcec49d7a90f05e45498cd9ca8a5a3b4a9ae2377a2d";
7564
+ var VGI_CATALOG_CONTRACT_HASH = "0aa39285365f5f4326ce85c4d41d2705ea992dee41cf98d07640a2767b6ac3fb";
7425
7565
  var CatalogInfoSchema = schema2([
7426
7566
  field2("name", utf82(), false),
7427
7567
  field2("implementation_version", utf82(), true),
@@ -7507,6 +7647,7 @@ var FunctionInfoSchema = schema2([
7507
7647
  field2("sink_order_dependent", bool2(), false),
7508
7648
  field2("requires_input_batch_index", bool2(), false),
7509
7649
  field2("input_from_args", bool2(), false),
7650
+ field2("input_rows_per_call", int642(), true),
7510
7651
  field2("required_settings", list2(field2("item", utf82(), true)), false),
7511
7652
  field2("required_secrets", list2(field2("item", struct2([field2("secret_type", utf82(), false), field2("scope", utf82(), true), field2("secret_name", utf82(), true)]), true)), false)
7512
7653
  ]);
@@ -9420,6 +9561,7 @@ class ReadOnlyCatalogInterface extends CatalogInterface {
9420
9561
  sink_order_dependent: f.kind === "table_buffering" && f.meta.sinkOrderDependent === true,
9421
9562
  requires_input_batch_index: f.kind === "table_buffering" && f.meta.requiresInputBatchIndex === true,
9422
9563
  input_from_args: f.kind === "table_in_out" && f.meta.inputFromArgs === true,
9564
+ input_rows_per_call: f.kind === "table_in_out" && f.meta.inputFromArgs === true ? f.meta.inputRowsPerCall ?? null : null,
9423
9565
  required_settings: meta.requiredSettings,
9424
9566
  required_secrets: requiredSecrets.map((s) => ({
9425
9567
  secret_type: s.secret_type,
@@ -12961,6 +13103,9 @@ function functionHandlers(config) {
12961
13103
  if (state.userState != null && handlerState?.state !== undefined) {
12962
13104
  handlerState.state = state.userState;
12963
13105
  }
13106
+ if (handlers.continuesOutput) {
13107
+ handlerState.morePending = state.morePending === true;
13108
+ }
12964
13109
  }
12965
13110
  if (state.isProducer && handlers.producerFn) {
12966
13111
  out.finish = () => {
@@ -12973,10 +13118,14 @@ function functionHandlers(config) {
12973
13118
  } else if (handlers.exchangeFn) {
12974
13119
  await handlers.exchangeFn(handlerState, input, out);
12975
13120
  }
13121
+ if (!handlers.continuesOutput) {
13122
+ refuseMoreOutput(state.functionName, out);
13123
+ }
12976
13124
  if (handlerState?.state !== undefined) {
12977
13125
  state.userState = handlerState.state;
12978
13126
  }
12979
13127
  state.filterHistory = handlerState?.filterHistory ?? null;
13128
+ state.morePending = handlerState?.morePending === true;
12980
13129
  },
12981
13130
  headerInit: (params, state, ctx) => {
12982
13131
  if (!state._initResponse) {
@@ -15128,6 +15277,42 @@ function toAsyncIterator(input) {
15128
15277
  function onConflictName(onConflict) {
15129
15278
  return String(onConflict).toUpperCase();
15130
15279
  }
15280
+ function isNotModified(md) {
15281
+ const v = md.get(CACHE_NOT_MODIFIED_KEY);
15282
+ return v != null && v !== "0" && v.toLowerCase() !== "false";
15283
+ }
15284
+ async function* exchangeContinued(session, functionName, input) {
15285
+ const raw = session;
15286
+ if (typeof raw.exchangeRaw !== "function") {
15287
+ throw new VgiClientError(`tableInOutFunction(${functionName}): the transport's stream session has no exchangeRaw(), ` + `which continued output needs to read each reply's vgi.status`);
15288
+ }
15289
+ const exchangeRaw = raw.exchangeRaw.bind(session);
15290
+ let tick = false;
15291
+ let reply = await exchangeRaw({ batch: input, metadata: new Map });
15292
+ for (;; ) {
15293
+ if (reply === null) {
15294
+ if (tick) {
15295
+ throw new VgiClientError(`tableInOutFunction(${functionName}): the worker ended the stream while output was pending`);
15296
+ }
15297
+ return;
15298
+ }
15299
+ const md = new Map([...reply.batch.metadata ?? [], ...reply.metadata]);
15300
+ const more = md.get(STATUS_KEY) === HAVE_MORE_OUTPUT;
15301
+ if (isNotModified(md) && (more || tick)) {
15302
+ throw new VgiClientError(`tableInOutFunction(${functionName}): the worker answered not_modified on a continued reply ` + `(${tick ? "answering a continuation tick" : "one saying HAVE_MORE_OUTPUT"}); ` + `not_modified must be an input's only reply`);
15303
+ }
15304
+ const rows = [...iterRows(reply.batch)];
15305
+ if (rows.length > 0)
15306
+ yield rows;
15307
+ if (!more)
15308
+ return;
15309
+ tick = true;
15310
+ reply = await exchangeRaw({
15311
+ batch: emptyBatch(input.schema),
15312
+ metadata: new Map([[STATUS_KEY, CONTINUE]])
15313
+ });
15314
+ }
15315
+ }
15131
15316
 
15132
15317
  class VgiClient {
15133
15318
  rpc;
@@ -15292,13 +15477,9 @@ class VgiClient {
15292
15477
  joinKeys: opts.joinKeys
15293
15478
  });
15294
15479
  try {
15295
- const outRows = await inputSession.exchange([...iterRows(firstBatch)]);
15296
- if (outRows.length > 0)
15297
- yield outRows;
15480
+ yield* exchangeContinued(inputSession, opts.functionName, firstBatch);
15298
15481
  for await (const batch of { [Symbol.asyncIterator]: () => inputIter }) {
15299
- const result = await inputSession.exchange([...iterRows(batch)]);
15300
- if (result.length > 0)
15301
- yield result;
15482
+ yield* exchangeContinued(inputSession, opts.functionName, batch);
15302
15483
  }
15303
15484
  } finally {
15304
15485
  inputSession.close();
@@ -15343,13 +15524,13 @@ class VgiClient {
15343
15524
  });
15344
15525
  const outputSchema = bindResp.output_schema;
15345
15526
  try {
15346
- const outRows = await inputSession.exchange([...iterRows(firstBatch)]);
15347
- if (outRows.length > 0)
15348
- yield batchFromRows(outRows, outputSchema);
15527
+ for await (const rows of exchangeContinued(inputSession, opts.functionName, firstBatch)) {
15528
+ yield batchFromRows(rows, outputSchema);
15529
+ }
15349
15530
  for await (const batch of { [Symbol.asyncIterator]: () => inputIter }) {
15350
- const result = await inputSession.exchange([...iterRows(batch)]);
15351
- if (result.length > 0)
15352
- yield batchFromRows(result, outputSchema);
15531
+ for await (const rows of exchangeContinued(inputSession, opts.functionName, batch)) {
15532
+ yield batchFromRows(rows, outputSchema);
15533
+ }
15353
15534
  }
15354
15535
  } finally {
15355
15536
  inputSession.close();
@@ -16427,6 +16608,7 @@ export {
16427
16608
  CACHE_STALE_IF_ERROR_KEY,
16428
16609
  CACHE_STALE_WHILE_REVALIDATE_KEY,
16429
16610
  CACHE_TTL_KEY,
16611
+ CONTINUE,
16430
16612
  CatalogAlreadyExistsError,
16431
16613
  CatalogFunctionType,
16432
16614
  CatalogInterface,
@@ -16449,6 +16631,7 @@ export {
16449
16631
  GROUP_COLUMN_NAME,
16450
16632
  GrantKeys2 as GrantKeys,
16451
16633
  GrantRefusedError,
16634
+ HAVE_MORE_OUTPUT,
16452
16635
  INTROSPECT_PRINCIPALS_ENV,
16453
16636
  IdentityUnavailableError,
16454
16637
  IntervalUnit2 as IntervalUnit,
@@ -16468,6 +16651,7 @@ export {
16468
16651
  S3CatalogObjectStorage,
16469
16652
  S3CatalogPublicationRepository,
16470
16653
  SEAL_ATTACH_REQUEST_SCHEMA,
16654
+ STATUS_KEY,
16471
16655
  ScanFunctionResultSchema,
16472
16656
  SealAttachDeniedError,
16473
16657
  StatusError,
@@ -16615,6 +16799,7 @@ export {
16615
16799
  map2 as map,
16616
16800
  metadatasToArrow,
16617
16801
  mintAttachTicket,
16802
+ moreOutputMetadata,
16618
16803
  normalizeSchemaPath,
16619
16804
  nullType2 as nullType,
16620
16805
  openAttachTicket,
@@ -16669,4 +16854,4 @@ export {
16669
16854
  utf82 as utf8
16670
16855
  };
16671
16856
 
16672
- //# debugId=0EC791465ED38B7C64756E2164756E21
16857
+ //# debugId=C8BFA3B7418F103264756E2164756E21