Java SDK for the VGI (Vector Gateway Interface) protocol — host DuckDB scalar, table, aggregate, and table-in-out functions in an external worker over Arrow IPC.
Repo Query-farm/vgi-java, read from GitHub 24 min ago. Query-farm has not joined Take My Repo.
Storage security and performance release. Breaking: aggregate state codec.
Security
AggregateFunction.serializeState / deserializeState used ObjectOutputStream / ObjectInputStream on bytes read back from shared storage (SQLite file or Cloudflare Durable Object), so anyone able to write that storage could run code in the worker. The defaults now throw and Worker.registerAggregate* refuses an aggregate that does not override both. Use the new typed, bounds-checked farm.query.vgi.aggregate.StateCodec (see CHANGELOG for the migration snippet). State stored by an earlier release is not readable; finish or cancel running queries before upgrading.VGI_SIGNING_KEY / Worker.signingKey as configured, else the host-local key file; AES-256-GCM, AAD binding shard/execution/namespace/key). The buffered init (resolved secrets) and aggregate constant arguments were stored in plaintext.Fixed
cloudflare-do (sharded per attach instead of shard_key: "").Retry-After, reusing the same attempt_id. Tunable via CfdoStorage.Options or VGI_CF_DO_* env vars.Performance
(shard, execution) in a bounded LRU: buffered process 2 → 1 call per batch, aggregate update 3 → 2.See CHANGELOG.md.
An uncommented schema is sent with comment NULL instead of an empty string (DuckDB counted "" as a comment). The example worker serves the contract schema for the vgi extension's cross-SDK conformance files. See CHANGELOG.md.
Protocol 3.3 write path (protocol version stays 3.3.0; needs the matching VGI extension):
catalog_table_scan_function_get is removed from VgiService and from the worker;catalog_table_scan_branches_get is the only scan-discovery RPC (a single-source tablecatalog_table_scan_function_get reads the branch through ScanBranchesDecoder instead.TableScanFunctionGetResponse stays as the ScanFunctionResult record.catalog_table_create now returns TableCreateResponse(created) (generated record).CatalogInterface.tableCreateReportingCreated(attachId, request) supplies it: false whenIF NOT EXISTS found an existing table, so CREATE TABLE IF NOT EXISTS ... AS SELECT notableCreateInMemoryCatalog implements it atomically.write_options carries only result_mode. WriteOptions is nowrecord WriteOptions(WriteResultMode resultMode); onConflict() / onConflictColumns()"throw" / emptyINSERT ... ON CONFLICT into a MERGE before a catalog sees it, soProtocol 3.3.0. VgiService.PROTOCOL_VERSION is now 3.3.0; peers must match major and
minor, so this release needs the matching VGI extension (protocol 3.3).
Table scan and write functions are hidden from SQL. Every function a table descriptor
names (scan, insert, update, delete) is now always sent in catalog_schema_contents_functions,
carrying the new FunctionInfo.visibility field. Write functions are always table_only; a
table's scan function is table_only unless the table sets exposeScan. table_only
functions no longer appear in duckdb_functions() and can no longer be called directly
(e.g. SELECT * FROM cat.main.items_scan() now fails); the tables they back work as before,
with their capabilities (projection / filter pushdown, required secrets, has_finalize).
This includes functions you registered as ordinary public functions: every function
registered with registerTable (or registerTableInOut) that some CatalogTable names as its
scan function becomes hidden (table_only) unless that table sets exposeScan(true). If SQL
calls such a scan directly, set exposeScan(true) on the table.
Worker.registerUnlistedTable keeps working but now lists the function as table_only
instead of omitting it, so the extension learns its capabilities. It is superseded for table
scans, which are table_only by default.
CatalogInterface.functions(attachId, path) and the static
CatalogInterface.functionInfoFor(fn, schemaPath, visibility): a code-implemented catalog
(Worker.registerCatalog) lists the functions its tables name, with protocol 3.3 visibility,
built exactly as the worker's own listing builds them (the counterpart of vgi-typescript's
functionInfoFor). Functions registered into that catalog with
Worker.registerExtraCatalog{TableFunction,TableInOut,Scalar,Aggregate}(catalog.name(), ...)
bind on its attaches. Default: no functions, as before.
CatalogColumns.withDefault(field, sql, schemaPath): declare a column default (canonical
vgi.column.default.v1 metadata).
txfix fixture: items gains items_insert / items_delete (all three write functions with
has_finalize), qty BIGINT DEFAULT 0, staged inserts / deletes on the transactional attach,
and a writes() function (one row per write call), per vgi docs/writable_tx_fixtures.md.
The example worker's return_secret_value declares vgi_example in requiredSecrets(), so
vgi_secret_types() lists it in required_by.
CatalogTable.Builder.exposeScan(boolean) and the CatalogTable.exposeScan() component
(default false): make a table's scan function an ordinary, SQL-callable catalog function.
FunctionInfo.visibility with FunctionInfo.VISIBILITY_PUBLIC / VISIBILITY_TABLE_ONLY
and FunctionInfo.withVisibility(String). The pre-3.3 FunctionInfo and CatalogTable
constructor shapes remain as compatibility constructors.
duckdb.spatial/intersects_extent@1 (DuckDB's &&) is now evaluated exactly as DuckDB 2.0 core does. Before, workers using SDK-side filtering could drop rows DuckDB keeps, or fail the scan, when a geometry had NaN or infinite coordinates or was a Z/M point with NaN X and Y:
No wire-protocol change: this is a drop-in patch release.
Protocol vgi.v3 3.2.0: filtered scan planning (TableInfo.scan_planning, pushdown_filters on catalog_table_scan_branches_get, ScanBranch row_count/column_statistics). 3.1 peers are rejected.
Java API: Worker.registerPlannedTable(stub, ScanPlanning, ScanBranchesPlanner), Worker.scanBranchesPlanner(..), ScanBranchesPlanner (DEFAULT serves the 3.1 branches), ScanBranchesResult, ScanPlanningFilters (decode(), mayMatch(statistics)), ScanBranch.withStatistics(rowCount, columnStatistics), TableInfo.scan_planning, client ScanBranchesDecoder. The generated VgiService.catalog_table_scan_branches_get gains a trailing pushdown_filters parameter (pass null from clients that cannot defer planning).
Secret ATTACH options now follow the cross-SDK spec (docs).
HKDF-SHA256(root, info "vgi.attach_secret_options.v1"); the configured signing key, HTTP sealing key or host-local key is never used directly.version(0x01) || nonce || ciphertext || tag, AAD-bound to the attach uuid.attach_opaque_data not recognized error (INVALID_ARGUMENT / opaque_data_not_recognized) instead of secrets silently reading as absent.$VGI_ATTACH_SECRET_KEY_FILE, else $XDG_RUNTIME_DIR/vgi/attach-secret-options.key, else <$TMPDIR or java.io.tmpdir>/vgi-<user>/attach-secret-options.key.AttachOptions.open(attachId): producers and exchanges keep only the attach id in their state and re-open the options (secret ones included) while producing.whoami().token_in_attach_data; CI runs vgi v2.0 22140b0.Attaches made by a 0.46.3 worker that carried secret options must be re-attached after upgrading.