@query-farm/vgi 0.47.2 → 0.48.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.
@@ -671,6 +671,9 @@ export interface ScanSplit {
671
671
  estimated_rows?: number | null;
672
672
  rows_exact: boolean;
673
673
  estimated_bytes?: number | null;
674
+ key_value?: /** @record-batch */ Uint8Array | null;
675
+ range_index?: number | null;
676
+ column_bounds?: /** @record-batch */ Uint8Array | null;
674
677
  partition_bounds?: /** @record-batch */ Uint8Array | null;
675
678
  column_statistics?: Uint8Array | null;
676
679
  location_ids?: number[] | null;
@@ -689,6 +692,8 @@ export interface PlanResponse {
689
692
  catalog_version?: number | null;
690
693
  scope: string;
691
694
  locations?: string[] | null;
695
+ key_grouping?: Uint8Array | null;
696
+ range_partitioning?: Uint8Array | null;
692
697
  partitioning?: Uint8Array[] | null;
693
698
  sort_order?: Uint8Array[] | null;
694
699
  cache_max_age_seconds?: number | null;
@@ -8,6 +8,11 @@ export declare const FunctionInfoSchema: import("../index.core.js").VgiSchema;
8
8
  export declare const MacroInfoSchema: import("../index.core.js").VgiSchema;
9
9
  export declare const IndexInfoSchema: import("../index.core.js").VgiSchema;
10
10
  export declare const CopyFromFormatInfoSchema: import("../index.core.js").VgiSchema;
11
+ export declare const FieldPathSchema: import("../index.core.js").VgiSchema;
12
+ export declare const TransformSpecSchema: import("../index.core.js").VgiSchema;
13
+ export declare const KeyGroupingSchema: import("../index.core.js").VgiSchema;
14
+ export declare const RangeKeySchema: import("../index.core.js").VgiSchema;
15
+ export declare const RangePartitioningSchema: import("../index.core.js").VgiSchema;
11
16
  export declare const MacroParameterSchema: import("../index.core.js").VgiSchema;
12
17
  export declare const MacroOverloadSchema: import("../index.core.js").VgiSchema;
13
18
  export declare const ClientQueryCapabilitiesSchema: import("../index.core.js").VgiSchema;
@@ -1,5 +1,62 @@
1
1
  import type { CatalogAttachResult, CatalogCapabilities, CatalogContentsResponse, CatalogObjectRef, CatalogQueryPrepareRequest, CatalogQueryPrepareResult, ClientQueryCapabilities, ConstraintSnapshot, ConstraintsApplyRequest, DependencySnapshot, IndexDefinition, MacroOverload, MacroParameter, OptionDefinitions, OptionState, QueryCapabilities, QueryEvaluationContext, QueryObjectReference, SqlExpression, TableLayout } from "./vgi-client.js";
2
2
  export type { CatalogAttachResult, CatalogCapabilities, CatalogContentsResponse, CatalogObjectRef, CatalogQueryPrepareRequest, CatalogQueryPrepareResult, ClientQueryCapabilities, ConstraintSnapshot, ConstraintsApplyRequest, DependencySnapshot, IndexDefinition, MacroOverload, MacroParameter, OptionDefinitions, OptionState, QueryCapabilities, QueryEvaluationContext, QueryObjectReference, SqlExpression, TableLayout };
3
+ /** One raw, component-preserving field reference used by a transform. */
4
+ export interface FieldPath {
5
+ components: string[];
6
+ }
7
+ /** `FieldPath` has no defaulted fields, so its init is the record itself. */
8
+ export type FieldPathInit = FieldPath;
9
+ /** Build a complete `FieldPath`, filling the protocol defaults, in wire order. */
10
+ export declare function buildFieldPath(init: FieldPathInit): FieldPath;
11
+ export declare const encodeFieldPath: (v: FieldPath) => Uint8Array;
12
+ export declare const decodeFieldPath: (b: Uint8Array) => FieldPath;
13
+ /** A versioned, registry-defined partition transform. `id` identifies normative semantics (for example `vgi.identity/1` or `iceberg.bucket/1`). `inputs` contains serialized :class:`FieldPath` records. `parameters` is either absent or a one-row Arrow batch, which permits any number of named, typed parameters without admitting arbitrary recursive expressions. */
14
+ export interface TransformSpec {
15
+ id: string;
16
+ inputs: Uint8Array[];
17
+ parameters?: Uint8Array | null;
18
+ }
19
+ /** Fields of `TransformSpec` that have a protocol default. */
20
+ export type TransformSpecDefaultedField = "inputs" | "parameters";
21
+ /** `TransformSpec` with every field that has a protocol default optional. */
22
+ export type TransformSpecInit = Omit<TransformSpec, TransformSpecDefaultedField> & Partial<Pick<TransformSpec, TransformSpecDefaultedField>>;
23
+ /** Build a complete `TransformSpec`, filling the protocol defaults, in wire order. */
24
+ export declare function buildTransformSpec(init: TransformSpecInit): TransformSpec;
25
+ export declare const encodeTransformSpec: (v: TransformSpec) => Uint8Array;
26
+ export declare const decodeTransformSpec: (b: Uint8Array) => TransformSpec;
27
+ /** Transforms whose exact result tuple is constant within every split. */
28
+ export interface KeyGrouping {
29
+ keys: Uint8Array[];
30
+ }
31
+ /** `KeyGrouping` has no defaulted fields, so its init is the record itself. */
32
+ export type KeyGroupingInit = KeyGrouping;
33
+ /** Build a complete `KeyGrouping`, filling the protocol defaults, in wire order. */
34
+ export declare function buildKeyGrouping(init: KeyGroupingInit): KeyGrouping;
35
+ export declare const encodeKeyGrouping: (v: KeyGrouping) => Uint8Array;
36
+ export declare const decodeKeyGrouping: (b: Uint8Array) => KeyGrouping;
37
+ /** One transform and comparator component of a range key. */
38
+ export interface RangeKey {
39
+ transform: Uint8Array;
40
+ direction: string;
41
+ null_order: string;
42
+ }
43
+ /** `RangeKey` has no defaulted fields, so its init is the record itself. */
44
+ export type RangeKeyInit = RangeKey;
45
+ /** Build a complete `RangeKey`, filling the protocol defaults, in wire order. */
46
+ export declare function buildRangeKey(init: RangeKeyInit): RangeKey;
47
+ export declare const encodeRangeKey: (v: RangeKey) => Uint8Array;
48
+ export declare const decodeRangeKey: (b: Uint8Array) => RangeKey;
49
+ /** Exact half-open range distribution shared by all splits in a plan. `N` split-point rows define `N + 1` ranges. Values equal to point `i` belong to range `i + 1`. Each split names its range with :attr:`ScanSplit.range_index`. */
50
+ export interface RangePartitioning {
51
+ keys: Uint8Array[];
52
+ split_points: Uint8Array;
53
+ }
54
+ /** `RangePartitioning` has no defaulted fields, so its init is the record itself. */
55
+ export type RangePartitioningInit = RangePartitioning;
56
+ /** Build a complete `RangePartitioning`, filling the protocol defaults, in wire order. */
57
+ export declare function buildRangePartitioning(init: RangePartitioningInit): RangePartitioning;
58
+ export declare const encodeRangePartitioning: (v: RangePartitioning) => Uint8Array;
59
+ export declare const decodeRangePartitioning: (b: Uint8Array) => RangePartitioning;
3
60
  /** Fields of `MacroParameter` that have a protocol default. */
4
61
  export type MacroParameterDefaultedField = "declared_type" | "default_value" | "default_expression" | "documentation";
5
62
  /** `MacroParameter` with every field that has a protocol default optional. */
@@ -3,7 +3,7 @@ import { type VgiSchema } from "../arrow/index.js";
3
3
  /** The protocol's wire name: the `vgi_rpc.protocol` routing key and the HTTP path segment. */
4
4
  export declare const VGI_PROTOCOL_NAME = "vgi.v3";
5
5
  /** The protocol's semver, stamped on every request by a client of this protocol. */
6
- export declare const VGI_PROTOCOL_VERSION = "3.0.0";
6
+ export declare const VGI_PROTOCOL_VERSION = "3.1.0";
7
7
  /** What a unary handler returns: the result row, now or later. */
8
8
  export type VgiReply<T> = T | ExternalRef | Promise<T | ExternalRef>;
9
9
  /** The result of a unary method with no `result` column. */
@@ -16,6 +16,8 @@ export { CompositeCatalogInterface } from "./catalog/composite.js";
16
16
  export { FunctionRegistry } from "./functions/registry.js";
17
17
  export { FunctionType, FunctionStability, NullHandling, ArgumentMonotonicity, OrderPreservation, OrderDependence, DistinctDependence, TableInOutPhase, DEFAULT_MAX_WORKERS, } from "./types.js";
18
18
  export type { BindRequest, BindResponse, BindRepeatability, CopyFromContext, CopyToContext, InitRequest, GlobalInitResponse, TableCardinality, } from "./protocol/types.js";
19
+ export type { ScanSplit, PlanResult, TableFunctionPlanRequest, } from "./protocol/serializers/splits.js";
20
+ export { type FieldPath, type FieldPathInit, buildFieldPath, encodeFieldPath, decodeFieldPath, type TransformSpec, type TransformSpecInit, buildTransformSpec, encodeTransformSpec, decodeTransformSpec, type KeyGrouping, type KeyGroupingInit, buildKeyGrouping, encodeKeyGrouping, decodeKeyGrouping, type RangeKey, type RangeKeyInit, buildRangeKey, encodeRangeKey, decodeRangeKey, type RangePartitioning, type RangePartitioningInit, buildRangePartitioning, encodeRangePartitioning, decodeRangePartitioning, } from "./generated/vgi-protocol-types.js";
19
21
  export { Arguments } from "./arguments/arguments.js";
20
22
  export { type ArgumentSpec, type ArgumentConstraints, argumentSpecsToSchema, schemaToArgumentSpecs, macroArgumentsSchema, macroParameterDocsFromSchema, formatRange, constraintSpecFields } from "./arguments/argument-spec.js";
21
23
  export { VgiError, RowCountMismatchError, FunctionNotFoundError, CatalogReadOnlyError, CatalogNotFoundError, CatalogAlreadyExistsError, ArgumentValidationError, NoCatalogError, } from "./errors.js";
package/dist/index.js CHANGED
@@ -5795,6 +5795,20 @@ function deserializeBindResponse(params) {
5795
5795
  }
5796
5796
  // src/protocol/serializers/init.ts
5797
5797
  init_arrow();
5798
+
5799
+ // src/protocol/types.ts
5800
+ var OrderByDirection;
5801
+ ((OrderByDirection) => {
5802
+ OrderByDirection["ASC"] = "ASC";
5803
+ OrderByDirection["DESC"] = "DESC";
5804
+ })(OrderByDirection ||= {});
5805
+ var OrderByNullOrder;
5806
+ ((OrderByNullOrder) => {
5807
+ OrderByNullOrder["NULLS_FIRST"] = "NULLS_FIRST";
5808
+ OrderByNullOrder["NULLS_LAST"] = "NULLS_LAST";
5809
+ })(OrderByNullOrder ||= {});
5810
+
5811
+ // src/protocol/serializers/init.ts
5798
5812
  var INIT_REQUEST_SCHEMA = schema2([
5799
5813
  field2("bind_call", binary2(), false),
5800
5814
  field2("output_schema", binary2(), false),
@@ -7707,6 +7721,26 @@ var CopyFromFormatInfoSchema = schema2([
7707
7721
  field2("description", utf82(), false),
7708
7722
  field2("ordered", bool2(), false)
7709
7723
  ]);
7724
+ var FieldPathSchema = schema2([
7725
+ field2("components", list2(field2("item", utf82(), true)), false)
7726
+ ]);
7727
+ var TransformSpecSchema = schema2([
7728
+ field2("id", utf82(), false),
7729
+ field2("inputs", list2(field2("item", binary2(), true)), false),
7730
+ field2("parameters", binary2(), true)
7731
+ ]);
7732
+ var KeyGroupingSchema = schema2([
7733
+ field2("keys", list2(field2("item", binary2(), true)), false)
7734
+ ]);
7735
+ var RangeKeySchema = schema2([
7736
+ field2("transform", binary2(), false),
7737
+ field2("direction", dictionary2(utf82(), int162()), false),
7738
+ field2("null_order", dictionary2(utf82(), int162()), false)
7739
+ ]);
7740
+ var RangePartitioningSchema = schema2([
7741
+ field2("keys", list2(field2("item", binary2(), true)), false),
7742
+ field2("split_points", binary2(), false)
7743
+ ]);
7710
7744
  var MacroParameterSchema = schema2([
7711
7745
  field2("name", utf82(), false),
7712
7746
  field2("declared_type", binary2(), true),
@@ -7937,6 +7971,9 @@ var ScanSplitSchema = schema2([
7937
7971
  field2("estimated_rows", int642(), true),
7938
7972
  field2("rows_exact", bool2(), false),
7939
7973
  field2("estimated_bytes", int642(), true),
7974
+ field2("key_value", binary2(), true),
7975
+ field2("range_index", int642(), true),
7976
+ field2("column_bounds", binary2(), true),
7940
7977
  field2("partition_bounds", binary2(), true),
7941
7978
  field2("column_statistics", binary2(), true),
7942
7979
  field2("location_ids", list2(field2("item", int642(), true)), true),
@@ -8412,6 +8449,8 @@ var TableFunctionPlanResultSchema = schema2([
8412
8449
  field2("catalog_version", int642(), true),
8413
8450
  field2("scope", utf82(), false),
8414
8451
  field2("locations", list2(field2("item", utf82(), true)), true),
8452
+ field2("key_grouping", binary2(), true),
8453
+ field2("range_partitioning", binary2(), true),
8415
8454
  field2("partitioning", list2(field2("item", binary2(), true)), true),
8416
8455
  field2("sort_order", list2(field2("item", binary2(), true)), true),
8417
8456
  field2("cache_max_age_seconds", int642(), true),
@@ -8879,6 +8918,46 @@ var TableFunctionStatisticsParamsSchema = schema2([
8879
8918
  ]);
8880
8919
 
8881
8920
  // src/generated/vgi-protocol-types.ts
8921
+ function buildFieldPath(init) {
8922
+ return {
8923
+ components: init.components
8924
+ };
8925
+ }
8926
+ var encodeFieldPath = (v) => encodeASD(FieldPathSchema, v);
8927
+ var decodeFieldPath = (b) => decodeASD(FieldPathSchema, b);
8928
+ function buildTransformSpec(init) {
8929
+ return {
8930
+ id: init.id,
8931
+ inputs: init.inputs ?? [],
8932
+ parameters: init.parameters ?? null
8933
+ };
8934
+ }
8935
+ var encodeTransformSpec = (v) => encodeASD(TransformSpecSchema, v);
8936
+ var decodeTransformSpec = (b) => decodeASD(TransformSpecSchema, b);
8937
+ function buildKeyGrouping(init) {
8938
+ return {
8939
+ keys: init.keys
8940
+ };
8941
+ }
8942
+ var encodeKeyGrouping = (v) => encodeASD(KeyGroupingSchema, v);
8943
+ var decodeKeyGrouping = (b) => decodeASD(KeyGroupingSchema, b);
8944
+ function buildRangeKey(init) {
8945
+ return {
8946
+ transform: init.transform,
8947
+ direction: init.direction,
8948
+ null_order: init.null_order
8949
+ };
8950
+ }
8951
+ var encodeRangeKey = (v) => encodeASD(RangeKeySchema, v);
8952
+ var decodeRangeKey = (b) => decodeASD(RangeKeySchema, b);
8953
+ function buildRangePartitioning(init) {
8954
+ return {
8955
+ keys: init.keys,
8956
+ split_points: init.split_points
8957
+ };
8958
+ }
8959
+ var encodeRangePartitioning = (v) => encodeASD(RangePartitioningSchema, v);
8960
+ var decodeRangePartitioning = (b) => decodeASD(RangePartitioningSchema, b);
8882
8961
  function buildMacroOverload(init) {
8883
8962
  return {
8884
8963
  parameters: init.parameters,
@@ -13439,7 +13518,7 @@ import {
13439
13518
  Protocol
13440
13519
  } from "@query-farm/vgi-rpc";
13441
13520
  var VGI_PROTOCOL_NAME = "vgi.v3";
13442
- var VGI_PROTOCOL_VERSION = "3.0.0";
13521
+ var VGI_PROTOCOL_VERSION = "3.1.0";
13443
13522
  function exchangeStream(callbacks) {
13444
13523
  return { kind: "exchange", ...callbacks };
13445
13524
  }
@@ -15179,14 +15258,40 @@ function deserializePlanRequest(params) {
15179
15258
  projectionIds = [...raw].map(Number);
15180
15259
  }
15181
15260
  const asBigInt = (v) => v == null ? null : typeof v === "bigint" ? v : BigInt(Number(v));
15261
+ const asBytes = (v) => v == null ? null : toUint8Array2(v);
15262
+ const asBytesList = (v) => {
15263
+ if (v == null)
15264
+ return null;
15265
+ const values = Array.isArray(v) ? v : v && typeof v[Symbol.iterator] === "function" ? [...v] : [];
15266
+ return values.filter((entry) => entry != null).map(toUint8Array2);
15267
+ };
15268
+ const enumValue = (v, values) => {
15269
+ if (v == null)
15270
+ return null;
15271
+ const text = String(v);
15272
+ return values.includes(text) ? text : null;
15273
+ };
15182
15274
  return {
15183
15275
  bind_call: bindCall,
15184
- bind_opaque_data: params.bind_opaque_data ? toUint8Array2(params.bind_opaque_data) : null,
15276
+ bind_opaque_data: asBytes(params.bind_opaque_data),
15185
15277
  projection_ids: projectionIds,
15186
- pushdown_filters: params.pushdown_filters ? toUint8Array2(params.pushdown_filters) : null,
15278
+ pushdown_filters: asBytes(params.pushdown_filters),
15279
+ join_keys: asBytesList(params.join_keys),
15280
+ row_limit: asBigInt(params.row_limit),
15187
15281
  target_split_bytes: asBigInt(params.target_split_bytes),
15188
15282
  min_splits: asBigInt(params.min_splits),
15189
- cursor: params.cursor ? toUint8Array2(params.cursor) : null
15283
+ max_splits_per_response: asBigInt(params.max_splits_per_response),
15284
+ cursor: asBytes(params.cursor),
15285
+ refined_filters: asBytes(params.refined_filters),
15286
+ filters_complete: params.filters_complete == null ? true : Boolean(params.filters_complete),
15287
+ start_position: asBytes(params.start_position),
15288
+ end_position: asBytes(params.end_position),
15289
+ order_by_column_name: params.order_by_column_name == null ? null : String(params.order_by_column_name),
15290
+ order_by_direction: enumValue(params.order_by_direction, Object.values(OrderByDirection)),
15291
+ order_by_null_order: enumValue(params.order_by_null_order, Object.values(OrderByNullOrder)),
15292
+ order_by_limit: asBigInt(params.order_by_limit),
15293
+ tablesample_percentage: params.tablesample_percentage == null ? null : Number(params.tablesample_percentage),
15294
+ tablesample_seed: asBigInt(params.tablesample_seed)
15190
15295
  };
15191
15296
  }
15192
15297
  function fingerprintInputs(bindCallBytes) {
@@ -15206,6 +15311,9 @@ function scanSplitRow(split, token) {
15206
15311
  estimated_rows: asBigInt(split.estimatedRows),
15207
15312
  rows_exact: split.rowsExact === true,
15208
15313
  estimated_bytes: asBigInt(split.estimatedBytes),
15314
+ key_value: split.keyValue ?? null,
15315
+ range_index: asBigInt(split.rangeIndex),
15316
+ column_bounds: split.columnBounds ?? null,
15209
15317
  partition_bounds: split.partitionBounds ?? null,
15210
15318
  column_statistics: split.columnStatistics ?? null,
15211
15319
  location_ids: split.locationIds ?? null,
@@ -15226,12 +15334,14 @@ function planResponseRow(result, splitBlobs) {
15226
15334
  estimated_total_bytes: asBigInt(result.estimatedTotalBytes),
15227
15335
  catalog_version: asBigInt(result.catalogVersion),
15228
15336
  scope: result.scope ?? "catalog",
15229
- locations: null,
15230
- partitioning: [],
15231
- sort_order: [],
15337
+ locations: result.locations ?? null,
15338
+ key_grouping: result.keyGrouping ?? null,
15339
+ range_partitioning: result.rangePartitioning ?? null,
15340
+ partitioning: result.partitioning ?? null,
15341
+ sort_order: result.sortOrder ?? null,
15232
15342
  cache_max_age_seconds: asBigInt(result.cacheMaxAgeSeconds),
15233
- start_position: new Uint8Array(0),
15234
- end_position: new Uint8Array(0)
15343
+ start_position: result.startPosition ?? null,
15344
+ end_position: result.endPosition ?? null
15235
15345
  };
15236
15346
  }
15237
15347
 
@@ -19311,10 +19421,15 @@ export {
19311
19421
  buildCatalogCapabilities,
19312
19422
  buildConstraintChange,
19313
19423
  buildConstraintDefinition,
19424
+ buildFieldPath,
19314
19425
  buildJoinKeysLookup,
19426
+ buildKeyGrouping,
19315
19427
  buildMacroOverload,
19428
+ buildRangeKey,
19429
+ buildRangePartitioning,
19316
19430
  buildRpcServer,
19317
19431
  buildScanBranchesResult,
19432
+ buildTransformSpec,
19318
19433
  buildVgiProtocol,
19319
19434
  bytes,
19320
19435
  cacheControlMetadata,
@@ -19341,14 +19456,19 @@ export {
19341
19456
  decodeConstraintSnapshot,
19342
19457
  decodeConstraintsApplyRequest,
19343
19458
  decodeDictValue,
19459
+ decodeFieldPath,
19344
19460
  decodeForeignKeyDefinition,
19345
19461
  decodeFunctionInfo,
19346
19462
  decodeIndexDefinition,
19463
+ decodeKeyGrouping,
19347
19464
  decodeMacroInfo,
19348
19465
  decodeMacroOverload,
19466
+ decodeRangeKey,
19467
+ decodeRangePartitioning,
19349
19468
  decodeSchemaInfo,
19350
19469
  decodeSqlExpression,
19351
19470
  decodeTableInfo,
19471
+ decodeTransformSpec,
19352
19472
  decodeViewInfo,
19353
19473
  defaultClientCapabilities,
19354
19474
  defaultExpressionMetadata,
@@ -19385,15 +19505,20 @@ export {
19385
19505
  encodeConstraintSnapshot,
19386
19506
  encodeConstraintsApplyRequest,
19387
19507
  encodeCopyFromFormatInfo,
19508
+ encodeFieldPath,
19388
19509
  encodeForeignKeyDefinition,
19389
19510
  encodeFormatOptions,
19390
19511
  encodeFunctionInfo,
19391
19512
  encodeIndexDefinition,
19513
+ encodeKeyGrouping,
19392
19514
  encodeMacroInfo,
19393
19515
  encodeMacroOverload,
19516
+ encodeRangeKey,
19517
+ encodeRangePartitioning,
19394
19518
  encodeSchemaInfo,
19395
19519
  encodeSqlExpression,
19396
19520
  encodeTableInfo,
19521
+ encodeTransformSpec,
19397
19522
  encodeViewInfo,
19398
19523
  field2 as field,
19399
19524
  filterBatch,
@@ -19514,4 +19639,4 @@ export {
19514
19639
  validateTableConstraints
19515
19640
  };
19516
19641
 
19517
- //# debugId=89F18E0425AB222A64756E2164756E21
19642
+ //# debugId=67FF9BC53B3C318564756E2164756E21