@query-farm/vgi 0.18.0 → 0.19.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 (38) hide show
  1. package/dist/arrow/impl-arrowjs/index.d.ts +1 -0
  2. package/dist/arrow/impl-arrowjs/metadata.d.ts +12 -0
  3. package/dist/arrow/impl-flechette/index.d.ts +1 -0
  4. package/dist/arrow/impl-flechette/metadata.d.ts +13 -0
  5. package/dist/arrow/index.d.ts +1 -1
  6. package/dist/client-entry.js +15 -4
  7. package/dist/client-entry.js.map +9 -8
  8. package/dist/functions/scalar.d.ts +10 -0
  9. package/dist/functions/table-in-out.d.ts +121 -0
  10. package/dist/functions/types.d.ts +12 -0
  11. package/dist/generated/vgi-client.d.ts +2 -0
  12. package/dist/index.core.d.ts +1 -1
  13. package/dist/index.js +295 -11
  14. package/dist/index.js.map +16 -15
  15. package/dist/protocol/types.d.ts +12 -0
  16. package/dist/serve-entry.js +13 -3
  17. package/dist/serve-entry.js.map +8 -7
  18. package/dist/worker-cf-entry.js +173 -16
  19. package/dist/worker-cf-entry.js.map +14 -13
  20. package/dist/worker.d.ts +1 -1
  21. package/package.json +4 -3
  22. package/src/arrow/impl-arrowjs/index.ts +1 -0
  23. package/src/arrow/impl-arrowjs/metadata.ts +20 -0
  24. package/src/arrow/impl-flechette/index.ts +1 -0
  25. package/src/arrow/impl-flechette/metadata.ts +25 -0
  26. package/src/arrow/index.ts +2 -0
  27. package/src/catalog/read-only.ts +9 -0
  28. package/src/client/client.ts +1 -0
  29. package/src/functions/registry.ts +53 -5
  30. package/src/functions/scalar.ts +17 -1
  31. package/src/functions/table-in-out.ts +480 -4
  32. package/src/functions/types.ts +12 -0
  33. package/src/generated/vgi-client.ts +3 -1
  34. package/src/generated/vgi-protocol-schemas.ts +2 -1
  35. package/src/index.core.ts +11 -1
  36. package/src/protocol/serializers/init.ts +7 -0
  37. package/src/protocol/types.ts +12 -0
  38. package/src/worker.ts +1 -1
@@ -7,5 +7,6 @@ export { iterRows, batchToScalarDict, batchToSecretDict, safeNumber, decodeDictV
7
7
  export { filterBatch } from "./filter.js";
8
8
  export { projectSchema, projectBatch } from "./project.js";
9
9
  export { readCanonicalValue } from "./canonical.js";
10
+ export { withBatchMetadata } from "./metadata.js";
10
11
  export { serializeSchema, deserializeSchema, serializeBatch, deserializeBatch, } from "./ipc.js";
11
12
  export { buildStatisticsBatch, type ColumnStatistics } from "./statistics.js";
@@ -0,0 +1,12 @@
1
+ import type { VgiBatch } from "../types.js";
2
+ /**
3
+ * Re-emit a batch with a different per-record-batch metadata map (same schema
4
+ * + data, no copy). The @query-farm/apache-arrow fork's RecordBatch carries
5
+ * the map through IPC as the Message's `custom_metadata` field.
6
+ *
7
+ * Mirrors vgi-rpc's arrow facade helper of the same name — needed here so a
8
+ * worker can bake metadata into the batch object itself (vgi-rpc's HTTP
9
+ * exchange dispatch drops the separate emit-metadata argument for 0-row
10
+ * batches; a batch-carried map survives).
11
+ */
12
+ export declare function withBatchMetadata(batch: VgiBatch, metadata: Map<string, string>): VgiBatch;
@@ -7,5 +7,6 @@ export { iterRows, batchToScalarDict, batchToSecretDict, safeNumber, decodeDictV
7
7
  export { filterBatch } from "./filter.js";
8
8
  export { projectSchema, projectBatch } from "./project.js";
9
9
  export { readCanonicalValue } from "./canonical.js";
10
+ export { withBatchMetadata } from "./metadata.js";
10
11
  export { serializeSchema, deserializeSchema, serializeBatch, deserializeBatch, } from "./ipc.js";
11
12
  export { buildStatisticsBatch, type ColumnStatistics } from "./statistics.js";
@@ -0,0 +1,13 @@
1
+ import type { VgiBatch } from "../types.js";
2
+ /**
3
+ * Re-emit a batch with a different per-record-batch metadata map (same schema
4
+ * + data). Shallow-clones the flechette Table so the caller's reference is
5
+ * not mutated, then pins the map so that:
6
+ * - `batch.metadata` surfaces it to consumer code (matching arrow-js's
7
+ * RecordBatch.metadata getter behavior), and
8
+ * - the patched flechette encoder picks it up via `_vgiRecordMetadata` and
9
+ * emits it as the IPC Message's `custom_metadata` field.
10
+ *
11
+ * Mirrors vgi-rpc's arrow facade helper of the same name.
12
+ */
13
+ export declare function withBatchMetadata(batch: VgiBatch, metadata: Map<string, string>): VgiBatch;
@@ -1,6 +1,6 @@
1
1
  export type { VgiTypeId, VgiDataType, VgiField, VgiSchema, VgiColumn, VgiColumnData, VgiBatch, VgiBackendInfo, TaggedUnion, } from "./types.js";
2
2
  export { TypeId, isNull, isInt, isFloat, isBinary, isUtf8, isBool, isDecimal, isDate, isTime, isTimestamp, isInterval, isList, isStruct, isUnion, isFixedSizeBinary, isFixedSizeList, isMap, isDuration, isDictionary, isBatch, } from "./predicates.js";
3
- export { backend, emptyBatch, batchFromRows, batchFromColumns, columnFromArray, iterRows, batchToScalarDict, batchToSecretDict, safeNumber, decodeDictValue, filterBatch, projectSchema, projectBatch, readCanonicalValue, serializeSchema, deserializeSchema, serializeBatch, deserializeBatch, buildStatisticsBatch, } from "#arrow-impl";
3
+ export { backend, emptyBatch, batchFromRows, batchFromColumns, columnFromArray, iterRows, batchToScalarDict, batchToSecretDict, safeNumber, decodeDictValue, filterBatch, projectSchema, projectBatch, withBatchMetadata, readCanonicalValue, serializeSchema, deserializeSchema, serializeBatch, deserializeBatch, buildStatisticsBatch, } from "#arrow-impl";
4
4
  export type { ColumnStatistics } from "#arrow-impl";
5
5
  export { schema, field, nullType, bool, int, int8, int16, int32, int64, uint8, uint16, uint32, uint64, float16, float32, float64, utf8, binary, fixedSizeBinary, decimal, decimal128, decimal256, date, dateDay, dateMillisecond, time, timeSecond, timeMillisecond, timeMicrosecond, timeNanosecond, timestamp, duration, interval, timestampSeconds, timestampMillis, timestampMicros, timestampNanos, durationSeconds, durationMillis, durationMicros, durationNanos, list, fixedSizeList, struct, map, dictionary, union, sparseUnion, denseUnion, TimeUnit, DateUnit, IntervalUnit, UnionMode, } from "./schema-types.js";
6
6
  export type { NullDescriptor, BoolType, IntType, Int8Type, Int16Type, Int32Type, Int64Type, Uint8Type, Uint16Type, Uint32Type, Uint64Type, FloatType, Utf8Type, LargeUtf8Type, BinaryType, LargeBinaryType, FixedSizeBinaryType, DecimalType, Date32Type, Date64Type, Time32Type, Time64Type, TimestampType, DurationType, IntervalType, ListType, FixedSizeListType, StructType, MapType, DictionaryType, UnionType, TypedField, TUnit, } from "./codec/type-descriptors.js";
@@ -61,6 +61,7 @@ function isDictionary(t) {
61
61
  // src/arrow/impl-arrowjs/index.ts
62
62
  var exports_impl_arrowjs = {};
63
63
  __export(exports_impl_arrowjs, {
64
+ withBatchMetadata: () => withBatchMetadata,
64
65
  utf8: () => utf8,
65
66
  union: () => union,
66
67
  uint8: () => uint8,
@@ -1590,6 +1591,12 @@ function projectBatch(projectionIds, batch) {
1590
1591
  });
1591
1592
  return new RecordBatch3(projectedSchema, data);
1592
1593
  }
1594
+ // src/arrow/impl-arrowjs/metadata.ts
1595
+ import { RecordBatch as RecordBatch4 } from "@query-farm/apache-arrow";
1596
+ function withBatchMetadata(batch, metadata) {
1597
+ const a = batch;
1598
+ return new RecordBatch4(a.schema, a.data, metadata);
1599
+ }
1593
1600
  // src/arrow/impl-arrowjs/ipc.ts
1594
1601
  import {
1595
1602
  Schema as Schema4,
@@ -1634,7 +1641,7 @@ import {
1634
1641
  Field as Field3,
1635
1642
  Null,
1636
1643
  makeData as makeData5,
1637
- RecordBatch as RecordBatch5,
1644
+ RecordBatch as RecordBatch6,
1638
1645
  Struct as Struct5,
1639
1646
  SparseUnion,
1640
1647
  Schema as Schema5,
@@ -1746,7 +1753,7 @@ function assemble(columnNames, minData, maxData, hasNull, hasNotNull, distinctCo
1746
1753
  ];
1747
1754
  const structType = new Struct5(schema2.fields);
1748
1755
  const data = makeData5({ type: structType, length: n, children, nullCount: 0 });
1749
- return new RecordBatch5(schema2, data);
1756
+ return new RecordBatch6(schema2, data);
1750
1757
  }
1751
1758
 
1752
1759
  // src/arrow/impl-arrowjs/index.ts
@@ -2075,6 +2082,7 @@ var INIT_REQUEST_SCHEMA = schema2([
2075
2082
  field2("phase", utf82(), true),
2076
2083
  field2("execution_id", binary2(), true),
2077
2084
  field2("init_opaque_data", binary2(), true),
2085
+ field2("substream_id", binary2(), true),
2078
2086
  field2("order_by_column_name", utf82(), true),
2079
2087
  field2("order_by_direction", utf82(), true),
2080
2088
  field2("order_by_null_order", utf82(), true),
@@ -2101,6 +2109,7 @@ function serializeInitRequest(req) {
2101
2109
  phase: req.phase ?? null,
2102
2110
  execution_id: req.execution_id ?? null,
2103
2111
  init_opaque_data: req.init_opaque_data ?? null,
2112
+ substream_id: req.substream_id ?? null,
2104
2113
  order_by_column_name: req.order_by_column_name ?? null,
2105
2114
  order_by_direction: req.order_by_direction ?? null,
2106
2115
  order_by_null_order: req.order_by_null_order ?? null,
@@ -2341,6 +2350,7 @@ var FunctionInfoSchema = schema2([
2341
2350
  field2("source_order_dependent", bool2(), false),
2342
2351
  field2("sink_order_dependent", bool2(), false),
2343
2352
  field2("requires_input_batch_index", bool2(), false),
2353
+ field2("input_from_args", bool2(), false),
2344
2354
  field2("required_settings", list2(field2("item", utf82(), true)), false),
2345
2355
  field2("required_secrets", list2(field2("item", struct2([field2("secret_type", utf82(), false), field2("scope", utf82(), true), field2("secret_name", utf82(), true)]), true)), false)
2346
2356
  ]);
@@ -3109,7 +3119,8 @@ class VgiClient {
3109
3119
  tablesample_percentage: ts?.percentage ?? null,
3110
3120
  tablesample_seed: ts?.seed == null ? null : BigInt(ts.seed),
3111
3121
  execution_id: opts?.executionId ?? null,
3112
- init_opaque_data: null
3122
+ init_opaque_data: null,
3123
+ substream_id: null
3113
3124
  };
3114
3125
  const initBatch = serializeInitRequest(initRequest);
3115
3126
  const session = await this.rpc.stream("init", wrapRequest(initBatch));
@@ -3906,4 +3917,4 @@ export {
3906
3917
  ArgumentValidationError
3907
3918
  };
3908
3919
 
3909
- //# debugId=02E1D95AF7E1275C64756E2164756E21
3920
+ //# debugId=7B4A06FF3B2070C464756E2164756E21