@query-farm/vgi 0.48.5 → 0.49.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 +1 -1
- package/dist/catalog/composite.d.ts +2 -0
- package/dist/catalog/descriptors.d.ts +11 -0
- package/dist/catalog/interface.d.ts +39 -2
- package/dist/catalog/scan-planning.d.ts +76 -0
- package/dist/client-entry.js +32 -4
- package/dist/client-entry.js.map +8 -7
- package/dist/generated/vgi-client.d.ts +1 -0
- package/dist/generated/vgi-protocol-schemas.d.ts +1 -1
- package/dist/generated/vgi-service.d.ts +5 -1
- package/dist/index.core.d.ts +1 -0
- package/dist/index.js +301 -18
- package/dist/index.js.map +15 -14
- package/dist/protocol/dispatch.d.ts +2 -2
- package/dist/serve-entry.js +1552 -8
- package/dist/serve-entry.js.map +15 -10
- package/dist/worker-cf-entry.d.ts +2 -2
- package/dist/worker-cf-entry.js +327 -11
- package/dist/worker-cf-entry.js.map +16 -15
- package/package.json +1 -1
- package/src/catalog/column-metadata.ts +7 -0
- package/src/catalog/composite.ts +5 -0
- package/src/catalog/descriptors.ts +11 -0
- package/src/catalog/interface.ts +78 -2
- package/src/catalog/read-only.ts +14 -1
- package/src/catalog/scan-planning.ts +314 -0
- package/src/generated/vgi-client.ts +2 -1
- package/src/generated/vgi-protocol-schemas.ts +6 -2
- package/src/generated/vgi-service.ts +7 -2
- package/src/index.core.ts +11 -0
- package/src/protocol/dispatch.ts +2 -2
- package/src/protocol/handlers/catalog/table.ts +19 -8
- package/src/worker-cf-entry.ts +9 -0
package/src/index.core.ts
CHANGED
|
@@ -272,6 +272,17 @@ export {
|
|
|
272
272
|
|
|
273
273
|
// Column statistics (for inlining on TableInfo.column_statistics).
|
|
274
274
|
export { type ColumnStatistics, serializeColumnStatistics } from "./util/statistics.js";
|
|
275
|
+
// Protocol 3.2 filtered scan planning (TableInfo.scan_planning, tableScanBranchesPlan).
|
|
276
|
+
export {
|
|
277
|
+
ScanPlanningFilters,
|
|
278
|
+
filtersMayMatch,
|
|
279
|
+
validateScanPlanning,
|
|
280
|
+
SCAN_PLANNING_BIND,
|
|
281
|
+
SCAN_PLANNING_FILTERED,
|
|
282
|
+
SCAN_PLANNING_MODES,
|
|
283
|
+
type ScanPlanningMode,
|
|
284
|
+
type ScanCandidateStatistics,
|
|
285
|
+
} from "./catalog/scan-planning.js";
|
|
275
286
|
|
|
276
287
|
// Byte utilities
|
|
277
288
|
export { toUint8Array } from "./util/bytes.js";
|
package/src/protocol/dispatch.ts
CHANGED
|
@@ -80,11 +80,11 @@ export { VGI_PROTOCOL_NAME };
|
|
|
80
80
|
* hash covers method names, types and the params/result/header schemas only
|
|
81
81
|
* (WIRE_PROTOCOL.md §14).
|
|
82
82
|
*
|
|
83
|
-
* It changes only with vgi.v3's protocol version (currently 3.
|
|
83
|
+
* It changes only with vgi.v3's protocol version (currently 3.2.0). Asserted
|
|
84
84
|
* by src/protocol/__tests__/vgi-v3-hash.test.ts; if that test fails, the
|
|
85
85
|
* surface drifted from the reference -- fix the schemas, do not bump this.
|
|
86
86
|
*/
|
|
87
|
-
export const VGI_V3_PROTOCOL_HASH = "
|
|
87
|
+
export const VGI_V3_PROTOCOL_HASH = "171ac8263bf22ffdd5dd4ac2c3d3c4e1dc186a7ceba45d386f324af8c9c6fced";
|
|
88
88
|
|
|
89
89
|
/**
|
|
90
90
|
* This worker's `vgi.v3` implementation: the generated UNIMPLEMENTED default
|
|
@@ -13,6 +13,8 @@ import {
|
|
|
13
13
|
ScanFunctionResultSchema,
|
|
14
14
|
} from "../../../generated/vgi-protocol-schemas.js";
|
|
15
15
|
import { toUint8Array } from "../../../util/bytes.js";
|
|
16
|
+
import { deserializeSchema } from "../../../arrow/index.js";
|
|
17
|
+
import { ScanPlanningFilters } from "../../../catalog/scan-planning.js";
|
|
16
18
|
import { requireCreateColumns } from "../../../catalog/unconstrained-columns.js";
|
|
17
19
|
import { CONSTRAINT_CREATE, CONSTRAINT_ENFORCE, CONSTRAINT_MUTATE, readConstraintRecord } from "../../../catalog/constraints.js";
|
|
18
20
|
import { decodeCatalogObjectRef } from "../../../generated/vgi-protocol-types.js";
|
|
@@ -201,16 +203,25 @@ export function catalogTableHandlers(getCatalog: GetCatalog, signingKey?: Uint8A
|
|
|
201
203
|
// catalog_table_scan_branches_get — branches-aware variant of
|
|
202
204
|
// scan_function_get. The branches-aware C++ extension calls this for every
|
|
203
205
|
// table scan; single-source catalogs synthesise a one-branch result.
|
|
206
|
+
//
|
|
207
|
+
// Protocol 3.2: always dispatches to tableScanBranchesPlan with the
|
|
208
|
+
// `pushdown_filters` wrapped as a ScanPlanningFilters (decoded lazily against
|
|
209
|
+
// the table's declared columns); its default returns tableScanBranchesGet.
|
|
204
210
|
const catalogTableScanBranchesGet = catalogHandler(keys, async (params) => {
|
|
205
211
|
const cat = getCatalog();
|
|
206
|
-
const
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
212
|
+
const attach = toUint8Array(params.attach_opaque_data);
|
|
213
|
+
const tx = params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined;
|
|
214
|
+
const schemaPath = params.schema_path;
|
|
215
|
+
const name = params.name;
|
|
216
|
+
const atUnit = params.at_unit;
|
|
217
|
+
const atValue = params.at_value;
|
|
218
|
+
const filters = params.pushdown_filters != null
|
|
219
|
+
? new ScanPlanningFilters(toUint8Array(params.pushdown_filters), async () => {
|
|
220
|
+
const info = await cat.tableGet(attach, schemaPath, name, atUnit, atValue, tx);
|
|
221
|
+
return info && info.columns.length ? deserializeSchema(toUint8Array(info.columns)) : null;
|
|
222
|
+
})
|
|
223
|
+
: null;
|
|
224
|
+
const branchesResult = await cat.tableScanBranchesPlan(attach, schemaPath, name, atUnit, atValue, tx, filters);
|
|
214
225
|
return wrapResult(branchesResult, ScanBranchesResultSchema);
|
|
215
226
|
});
|
|
216
227
|
|
package/src/worker-cf-entry.ts
CHANGED
|
@@ -63,6 +63,12 @@ export {
|
|
|
63
63
|
serializeAttachOptionSpec,
|
|
64
64
|
serializeAttachOptionSpecs,
|
|
65
65
|
serializeColumnStatistics,
|
|
66
|
+
// Multi-branch scans and protocol 3.2 filtered scan planning.
|
|
67
|
+
buildScanBranchesResult,
|
|
68
|
+
ScanPlanningFilters,
|
|
69
|
+
filtersMayMatch,
|
|
70
|
+
SCAN_PLANNING_BIND,
|
|
71
|
+
SCAN_PLANNING_FILTERED,
|
|
66
72
|
BindResultSchema,
|
|
67
73
|
ScanFunctionResultSchema,
|
|
68
74
|
// Resolved-secret selection (the batch is keyed by secret NAME, not type).
|
|
@@ -83,6 +89,9 @@ export type {
|
|
|
83
89
|
CacheScope,
|
|
84
90
|
AttachOptionSpec,
|
|
85
91
|
ColumnStatistics,
|
|
92
|
+
ScanBranchInput,
|
|
93
|
+
ScanPlanningMode,
|
|
94
|
+
ScanCandidateStatistics,
|
|
86
95
|
CatalogAttachResult,
|
|
87
96
|
CatalogDescriptor,
|
|
88
97
|
CatalogInfo,
|