@query-farm/vgi 0.7.0 → 0.9.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/arguments/argument-spec.d.ts +49 -0
- package/dist/catalog/descriptors.d.ts +6 -0
- package/dist/catalog/interface.d.ts +34 -0
- package/dist/functions/scalar.d.ts +14 -0
- package/dist/generated/vgi-client.d.ts +1 -0
- package/dist/generated/vgi-protocol-schemas.d.ts +1 -0
- package/dist/index.core.d.ts +1 -1
- package/dist/index.js +218 -107
- package/dist/index.js.map +13 -13
- package/dist/types.d.ts +4 -0
- package/dist/worker-cf-entry.js +169 -70
- package/dist/worker-cf-entry.js.map +11 -11
- package/package.json +1 -1
- package/src/arguments/argument-spec.ts +148 -0
- package/src/catalog/descriptors.ts +6 -0
- package/src/catalog/interface.ts +55 -1
- package/src/catalog/read-only.ts +6 -0
- package/src/client/client.ts +3 -0
- package/src/functions/scalar.ts +18 -1
- package/src/generated/vgi-client.ts +2 -1
- package/src/generated/vgi-protocol-schemas.ts +16 -1
- package/src/index.core.ts +1 -1
- package/src/protocol/handlers/catalog/admin.ts +1 -0
- package/src/types.ts +14 -0
|
@@ -8,7 +8,56 @@ export interface ArgumentSpec {
|
|
|
8
8
|
isVarargs?: boolean;
|
|
9
9
|
isConst?: boolean;
|
|
10
10
|
doc?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Discovery-facing constraint metadata, pre-encoded to their surfaced UTF-8
|
|
13
|
+
* forms (presence-only — `undefined` means the constraint is absent and the
|
|
14
|
+
* corresponding field-metadata key is omitted entirely). Mirrors Python's
|
|
15
|
+
* `ArgumentSpec.default_json` / `choices_json` / `range_notation` / `pattern`
|
|
16
|
+
* so `argumentSpecsToSchema`/`schemaToArgumentSpecs` round-trip symmetrically.
|
|
17
|
+
*/
|
|
18
|
+
defaultJson?: string;
|
|
19
|
+
choicesJson?: string;
|
|
20
|
+
rangeNotation?: string;
|
|
21
|
+
pattern?: string;
|
|
11
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Raw per-argument constraint declarations, as authored on a function's
|
|
25
|
+
* argument descriptor. Encoded into the pre-computed {@link ArgumentSpec}
|
|
26
|
+
* constraint fields via {@link constraintSpecFields}.
|
|
27
|
+
*/
|
|
28
|
+
export interface ArgumentConstraints {
|
|
29
|
+
/** Closed set of allowed values (JSON-encoded into `vgi_choices`). */
|
|
30
|
+
choices?: readonly unknown[];
|
|
31
|
+
/** Inclusive lower bound (`>=`). */
|
|
32
|
+
ge?: number;
|
|
33
|
+
/** Inclusive upper bound (`<=`). */
|
|
34
|
+
le?: number;
|
|
35
|
+
/** Exclusive lower bound (`>`). */
|
|
36
|
+
gt?: number;
|
|
37
|
+
/** Exclusive upper bound (`<`). */
|
|
38
|
+
lt?: number;
|
|
39
|
+
/** Regex the value must match (surfaced as `vgi_pattern`, as-is). */
|
|
40
|
+
pattern?: string;
|
|
41
|
+
/** Default value (JSON-encoded into `vgi_default`); optional args only. */
|
|
42
|
+
default?: unknown;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Build interval notation from an argument's numeric bounds.
|
|
46
|
+
*
|
|
47
|
+
* Inclusive bounds (`ge`/`le`) render as square brackets, exclusive bounds
|
|
48
|
+
* (`gt`/`lt`) as parentheses, and an open side as `-inf`/`+inf`. Returns
|
|
49
|
+
* `undefined` when the argument has no numeric bound at all.
|
|
50
|
+
*
|
|
51
|
+
* Examples: `ge=0,le=10` -> `"[0, 10]"`; `gt=0` -> `"(0, +inf)"`;
|
|
52
|
+
* `ge=1,lt=10` -> `"[1, 10)"`.
|
|
53
|
+
*/
|
|
54
|
+
export declare function formatRange(ge?: number, le?: number, gt?: number, lt?: number): string | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Encode raw {@link ArgumentConstraints} into the pre-computed constraint
|
|
57
|
+
* fields of an {@link ArgumentSpec} (presence-only — absent constraints yield
|
|
58
|
+
* no field). Mirrors Python's `_constraint_kwargs`.
|
|
59
|
+
*/
|
|
60
|
+
export declare function constraintSpecFields(constraints: ArgumentConstraints | undefined): Pick<ArgumentSpec, "defaultJson" | "choicesJson" | "rangeNotation" | "pattern">;
|
|
12
61
|
/**
|
|
13
62
|
* Convert ArgumentSpecs to an Arrow Schema with VGI metadata keys.
|
|
14
63
|
* Positional arguments come first (in order), named arguments follow.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { VgiSchema, VgiDataType } from "../arrow/index.js";
|
|
2
|
+
import type { AttachCatalogInfo } from "./interface.js";
|
|
2
3
|
import type { VgiFunction } from "../functions/types.js";
|
|
3
4
|
import type { Arguments } from "../arguments/arguments.js";
|
|
4
5
|
import type { ColumnStatistics } from "../util/statistics.js";
|
|
@@ -142,6 +143,11 @@ export interface CatalogDescriptor {
|
|
|
142
143
|
schemas: SchemaDescriptor[];
|
|
143
144
|
settings?: SettingDescriptor[];
|
|
144
145
|
secretTypes?: SecretTypeDescriptor[];
|
|
146
|
+
/**
|
|
147
|
+
* Companion catalogs (lakehouse federation) the client should ATTACH when this
|
|
148
|
+
* VGI catalog attaches. Surfaced via `catalog_attach.attach_catalogs`.
|
|
149
|
+
*/
|
|
150
|
+
attachCatalogs?: AttachCatalogInfo[];
|
|
145
151
|
comment?: string;
|
|
146
152
|
tags?: Record<string, string>;
|
|
147
153
|
/**
|
|
@@ -56,6 +56,31 @@ export interface CopyFromFormatInfo {
|
|
|
56
56
|
}
|
|
57
57
|
/** Encode a CopyFromFormatInfo to Arrow IPC bytes (single-row batch). */
|
|
58
58
|
export declare const encodeCopyFromFormatInfo: (v: CopyFromFormatInfo) => Uint8Array;
|
|
59
|
+
/**
|
|
60
|
+
* A companion catalog the client should ATTACH when this VGI catalog attaches
|
|
61
|
+
* (lakehouse federation). Serialized into `CatalogAttachResult.attach_catalogs`;
|
|
62
|
+
* the C++ VGI extension attaches each at VGI-attach time so multi-branch
|
|
63
|
+
* catalog-table branches can resolve tables in a companion DuckLake / Iceberg /
|
|
64
|
+
* Postgres / DuckDB.
|
|
65
|
+
*/
|
|
66
|
+
export interface AttachCatalogInfo {
|
|
67
|
+
/** ATTACH alias; also a catalog-table ScanBranch's `sourceCatalog`. */
|
|
68
|
+
alias: string;
|
|
69
|
+
/** ATTACH target — a path or DSN (e.g. `ducklake:sqlite:/data/meta.sqlite`). */
|
|
70
|
+
target: string;
|
|
71
|
+
/** DuckDB db type; empty => inferred from the target scheme prefix. */
|
|
72
|
+
db_type?: string;
|
|
73
|
+
/** Extra ATTACH options forwarded verbatim (e.g. DuckLake DATA_PATH). */
|
|
74
|
+
options?: Record<string, string>;
|
|
75
|
+
/** Attach hidden (excluded from duckdb_databases()); still resolvable. */
|
|
76
|
+
hidden?: boolean;
|
|
77
|
+
/** When true, attach failure fails the whole VGI ATTACH. */
|
|
78
|
+
required?: boolean;
|
|
79
|
+
/** Optional named secret to inject into the companion's ATTACH options. */
|
|
80
|
+
secret_ref?: string;
|
|
81
|
+
}
|
|
82
|
+
/** Encode an AttachCatalogInfo to Arrow IPC bytes (single-row batch). */
|
|
83
|
+
export declare const encodeAttachCatalogInfo: (v: AttachCatalogInfo) => Uint8Array;
|
|
59
84
|
import { type VgiDataType } from "../arrow/index.js";
|
|
60
85
|
/**
|
|
61
86
|
* Result from `tableScanFunctionGet` — tells the VGI DuckDB extension which
|
|
@@ -124,6 +149,15 @@ export interface ScanBranchInput {
|
|
|
124
149
|
branchFilter?: string | null;
|
|
125
150
|
/** Declares this branch as the INSERT target (at most one per table). */
|
|
126
151
|
writable?: boolean;
|
|
152
|
+
/**
|
|
153
|
+
* Catalog-table branch (lakehouse federation): leave `functionName` empty and
|
|
154
|
+
* set these to scan the base table
|
|
155
|
+
* `sourceCatalog.sourceSchema.sourceTable` in a companion catalog instead of
|
|
156
|
+
* calling a table function.
|
|
157
|
+
*/
|
|
158
|
+
sourceCatalog?: string | null;
|
|
159
|
+
sourceSchema?: string | null;
|
|
160
|
+
sourceTable?: string | null;
|
|
127
161
|
}
|
|
128
162
|
/**
|
|
129
163
|
* Build a multi-branch `ScanBranchesResult` wire dict from explicit branch
|
|
@@ -25,6 +25,20 @@ export interface ScalarParameterDef {
|
|
|
25
25
|
varargs?: boolean;
|
|
26
26
|
/** Human-readable per-argument description (surfaced as `vgi_doc`). */
|
|
27
27
|
doc?: string;
|
|
28
|
+
/** Closed set of allowed values (surfaced as `vgi_choices`). */
|
|
29
|
+
choices?: readonly unknown[];
|
|
30
|
+
/** Inclusive lower bound, `>=` (folded into `vgi_range`). */
|
|
31
|
+
ge?: number;
|
|
32
|
+
/** Inclusive upper bound, `<=` (folded into `vgi_range`). */
|
|
33
|
+
le?: number;
|
|
34
|
+
/** Exclusive lower bound, `>` (folded into `vgi_range`). */
|
|
35
|
+
gt?: number;
|
|
36
|
+
/** Exclusive upper bound, `<` (folded into `vgi_range`). */
|
|
37
|
+
lt?: number;
|
|
38
|
+
/** Regex the value must match (surfaced as `vgi_pattern`). */
|
|
39
|
+
pattern?: string;
|
|
40
|
+
/** Default value (surfaced as `vgi_default`, JSON-encoded). */
|
|
41
|
+
default?: unknown;
|
|
28
42
|
}
|
|
29
43
|
/**
|
|
30
44
|
* The typed compute row for a scalar function: one property per declared
|
|
@@ -304,6 +304,7 @@ export interface CatalogAttachResult {
|
|
|
304
304
|
default_schema: string;
|
|
305
305
|
settings: Uint8Array[];
|
|
306
306
|
secret_types: Uint8Array[];
|
|
307
|
+
attach_catalogs: Uint8Array[];
|
|
307
308
|
comment?: string | null;
|
|
308
309
|
tags: Record<string, string>;
|
|
309
310
|
supports_column_statistics: boolean;
|
|
@@ -9,6 +9,7 @@ export declare const CopyFromFormatInfoSchema: import("../index.core.js").VgiSch
|
|
|
9
9
|
export declare const ScanFunctionResultSchema: import("../index.core.js").VgiSchema;
|
|
10
10
|
export declare const ScanBranchesResultSchema: import("../index.core.js").VgiSchema;
|
|
11
11
|
export declare const ScanBranchSchema: import("../index.core.js").VgiSchema;
|
|
12
|
+
export declare const AttachCatalogInfoSchema: import("../index.core.js").VgiSchema;
|
|
12
13
|
export declare const AggregateBindResultSchema: import("../index.core.js").VgiSchema;
|
|
13
14
|
export declare const AggregateCombineResultSchema: import("../index.core.js").VgiSchema;
|
|
14
15
|
export declare const AggregateDestructorResultSchema: import("../index.core.js").VgiSchema;
|
package/dist/index.core.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export { FunctionRegistry } from "./functions/registry.js";
|
|
|
14
14
|
export { FunctionType, FunctionStability, NullHandling, OrderPreservation, OrderDependence, DistinctDependence, TableInOutPhase, DEFAULT_MAX_WORKERS, } from "./types.js";
|
|
15
15
|
export type { BindRequest, BindResponse, CopyFromContext, CopyToContext, InitRequest, GlobalInitResponse, TableCardinality, } from "./protocol/types.js";
|
|
16
16
|
export { Arguments } from "./arguments/arguments.js";
|
|
17
|
-
export { type ArgumentSpec, argumentSpecsToSchema, schemaToArgumentSpecs, macroArgumentsSchema, macroParameterDocsFromSchema } from "./arguments/argument-spec.js";
|
|
17
|
+
export { type ArgumentSpec, type ArgumentConstraints, argumentSpecsToSchema, schemaToArgumentSpecs, macroArgumentsSchema, macroParameterDocsFromSchema, formatRange, constraintSpecFields } from "./arguments/argument-spec.js";
|
|
18
18
|
export { VgiError, RowCountMismatchError, FunctionNotFoundError, CatalogReadOnlyError, CatalogNotFoundError, CatalogAlreadyExistsError, ArgumentValidationError, NoCatalogError, } from "./errors.js";
|
|
19
19
|
export type { ResolvedMetadata, ParameterInfo } from "./metadata/types.js";
|
|
20
20
|
export { CatalogFunctionType } from "./metadata/types.js";
|
package/dist/index.js
CHANGED
|
@@ -2600,6 +2600,10 @@ var VGI_VARARGS_TRUE = "true";
|
|
|
2600
2600
|
var VGI_CONST_KEY = "vgi_const";
|
|
2601
2601
|
var VGI_CONST_TRUE = "true";
|
|
2602
2602
|
var VGI_DOC_KEY = "vgi_doc";
|
|
2603
|
+
var VGI_DEFAULT_KEY = "vgi_default";
|
|
2604
|
+
var VGI_CHOICES_KEY = "vgi_choices";
|
|
2605
|
+
var VGI_RANGE_KEY = "vgi_range";
|
|
2606
|
+
var VGI_PATTERN_KEY = "vgi_pattern";
|
|
2603
2607
|
var DEFAULT_MAX_WORKERS = 99999;
|
|
2604
2608
|
|
|
2605
2609
|
// src/errors.ts
|
|
@@ -2659,6 +2663,180 @@ class NoCatalogError extends VgiError {
|
|
|
2659
2663
|
}
|
|
2660
2664
|
}
|
|
2661
2665
|
|
|
2666
|
+
// src/arguments/argument-spec.ts
|
|
2667
|
+
init_arrow();
|
|
2668
|
+
function safeJson(value) {
|
|
2669
|
+
try {
|
|
2670
|
+
const encoded = JSON.stringify(value);
|
|
2671
|
+
if (encoded === undefined) {
|
|
2672
|
+
return JSON.stringify(String(value));
|
|
2673
|
+
}
|
|
2674
|
+
return encoded;
|
|
2675
|
+
} catch {
|
|
2676
|
+
return JSON.stringify(String(value));
|
|
2677
|
+
}
|
|
2678
|
+
}
|
|
2679
|
+
function formatRange(ge, le, gt, lt) {
|
|
2680
|
+
if (ge === undefined && le === undefined && gt === undefined && lt === undefined) {
|
|
2681
|
+
return;
|
|
2682
|
+
}
|
|
2683
|
+
let low;
|
|
2684
|
+
if (gt !== undefined) {
|
|
2685
|
+
low = `(${gt}`;
|
|
2686
|
+
} else if (ge !== undefined) {
|
|
2687
|
+
low = `[${ge}`;
|
|
2688
|
+
} else {
|
|
2689
|
+
low = "(-inf";
|
|
2690
|
+
}
|
|
2691
|
+
let high;
|
|
2692
|
+
if (lt !== undefined) {
|
|
2693
|
+
high = `${lt})`;
|
|
2694
|
+
} else if (le !== undefined) {
|
|
2695
|
+
high = `${le}]`;
|
|
2696
|
+
} else {
|
|
2697
|
+
high = "+inf)";
|
|
2698
|
+
}
|
|
2699
|
+
return `${low}, ${high}`;
|
|
2700
|
+
}
|
|
2701
|
+
function constraintSpecFields(constraints) {
|
|
2702
|
+
const fields = {};
|
|
2703
|
+
if (constraints === undefined)
|
|
2704
|
+
return fields;
|
|
2705
|
+
if ("default" in constraints && constraints.default !== undefined) {
|
|
2706
|
+
fields.defaultJson = safeJson(constraints.default);
|
|
2707
|
+
}
|
|
2708
|
+
if (constraints.choices !== undefined) {
|
|
2709
|
+
fields.choicesJson = safeJson([...constraints.choices]);
|
|
2710
|
+
}
|
|
2711
|
+
const range = formatRange(constraints.ge, constraints.le, constraints.gt, constraints.lt);
|
|
2712
|
+
if (range !== undefined) {
|
|
2713
|
+
fields.rangeNotation = range;
|
|
2714
|
+
}
|
|
2715
|
+
if (constraints.pattern !== undefined) {
|
|
2716
|
+
fields.pattern = constraints.pattern;
|
|
2717
|
+
}
|
|
2718
|
+
return fields;
|
|
2719
|
+
}
|
|
2720
|
+
function argumentSpecSortKey(spec) {
|
|
2721
|
+
if (typeof spec.position === "number") {
|
|
2722
|
+
return [0, spec.position];
|
|
2723
|
+
}
|
|
2724
|
+
return [1, spec.position];
|
|
2725
|
+
}
|
|
2726
|
+
function argumentSpecsToSchema(specs) {
|
|
2727
|
+
const sorted = [...specs].sort((a, b) => {
|
|
2728
|
+
const ka = argumentSpecSortKey(a);
|
|
2729
|
+
const kb = argumentSpecSortKey(b);
|
|
2730
|
+
if (ka[0] !== kb[0])
|
|
2731
|
+
return ka[0] - kb[0];
|
|
2732
|
+
if (typeof ka[1] === "number" && typeof kb[1] === "number") {
|
|
2733
|
+
return ka[1] - kb[1];
|
|
2734
|
+
}
|
|
2735
|
+
return String(ka[1]).localeCompare(String(kb[1]));
|
|
2736
|
+
});
|
|
2737
|
+
const fields = [];
|
|
2738
|
+
for (const spec of sorted) {
|
|
2739
|
+
const metadata = new Map;
|
|
2740
|
+
if (typeof spec.position === "string") {
|
|
2741
|
+
metadata.set(VGI_ARG_KEY, VGI_ARG_NAMED);
|
|
2742
|
+
}
|
|
2743
|
+
if (spec.isTableInput) {
|
|
2744
|
+
metadata.set(VGI_TYPE_KEY, VGI_TYPE_TABLE);
|
|
2745
|
+
} else if (spec.isAnyType) {
|
|
2746
|
+
metadata.set(VGI_TYPE_KEY, VGI_TYPE_ANY);
|
|
2747
|
+
}
|
|
2748
|
+
if (spec.isVarargs) {
|
|
2749
|
+
metadata.set(VGI_VARARGS_KEY, VGI_VARARGS_TRUE);
|
|
2750
|
+
}
|
|
2751
|
+
if (spec.isConst) {
|
|
2752
|
+
metadata.set(VGI_CONST_KEY, VGI_CONST_TRUE);
|
|
2753
|
+
}
|
|
2754
|
+
if (spec.doc) {
|
|
2755
|
+
metadata.set(VGI_DOC_KEY, spec.doc);
|
|
2756
|
+
}
|
|
2757
|
+
if (spec.defaultJson !== undefined) {
|
|
2758
|
+
metadata.set(VGI_DEFAULT_KEY, spec.defaultJson);
|
|
2759
|
+
}
|
|
2760
|
+
if (spec.choicesJson !== undefined) {
|
|
2761
|
+
metadata.set(VGI_CHOICES_KEY, spec.choicesJson);
|
|
2762
|
+
}
|
|
2763
|
+
if (spec.rangeNotation !== undefined) {
|
|
2764
|
+
metadata.set(VGI_RANGE_KEY, spec.rangeNotation);
|
|
2765
|
+
}
|
|
2766
|
+
if (spec.pattern !== undefined) {
|
|
2767
|
+
metadata.set(VGI_PATTERN_KEY, spec.pattern);
|
|
2768
|
+
}
|
|
2769
|
+
const field3 = field2(spec.name, spec.arrowType, true, metadata.size > 0 ? metadata : undefined);
|
|
2770
|
+
fields.push(field3);
|
|
2771
|
+
}
|
|
2772
|
+
return schema2(fields);
|
|
2773
|
+
}
|
|
2774
|
+
function macroArgumentsSchema(parameters, parameterDefaultValues, parameterDocs) {
|
|
2775
|
+
const docs = parameterDocs ?? {};
|
|
2776
|
+
const defaultTypes = new Map;
|
|
2777
|
+
if (parameterDefaultValues && parameterDefaultValues.length > 0) {
|
|
2778
|
+
const batch = deserializeBatch(parameterDefaultValues);
|
|
2779
|
+
for (const f of batch.schema.fields) {
|
|
2780
|
+
defaultTypes.set(f.name, f.type);
|
|
2781
|
+
}
|
|
2782
|
+
}
|
|
2783
|
+
const fields = [];
|
|
2784
|
+
for (const name of parameters) {
|
|
2785
|
+
const metadata = new Map;
|
|
2786
|
+
const doc = docs[name];
|
|
2787
|
+
if (doc) {
|
|
2788
|
+
metadata.set(VGI_DOC_KEY, doc);
|
|
2789
|
+
}
|
|
2790
|
+
const fieldType = defaultTypes.get(name) ?? nullType2();
|
|
2791
|
+
fields.push(field2(name, fieldType, true, metadata.size > 0 ? metadata : undefined));
|
|
2792
|
+
}
|
|
2793
|
+
return schema2(fields);
|
|
2794
|
+
}
|
|
2795
|
+
function macroParameterDocsFromSchema(schema3) {
|
|
2796
|
+
const docs = {};
|
|
2797
|
+
for (const field3 of schema3.fields) {
|
|
2798
|
+
const doc = field3.metadata.get(VGI_DOC_KEY);
|
|
2799
|
+
if (doc) {
|
|
2800
|
+
docs[field3.name] = doc;
|
|
2801
|
+
}
|
|
2802
|
+
}
|
|
2803
|
+
return docs;
|
|
2804
|
+
}
|
|
2805
|
+
function schemaToArgumentSpecs(schema3) {
|
|
2806
|
+
const specs = [];
|
|
2807
|
+
let positionIndex = 0;
|
|
2808
|
+
for (const field3 of schema3.fields) {
|
|
2809
|
+
const metadata = field3.metadata;
|
|
2810
|
+
const isNamed = metadata.get(VGI_ARG_KEY) === VGI_ARG_NAMED;
|
|
2811
|
+
const position = isNamed ? field3.name : positionIndex++;
|
|
2812
|
+
const vgiType = metadata.get(VGI_TYPE_KEY);
|
|
2813
|
+
const isTableInput = vgiType === VGI_TYPE_TABLE;
|
|
2814
|
+
const isAnyType = vgiType === VGI_TYPE_ANY;
|
|
2815
|
+
const isVarargs = metadata.get(VGI_VARARGS_KEY) === VGI_VARARGS_TRUE;
|
|
2816
|
+
const isConst = metadata.get(VGI_CONST_KEY) === VGI_CONST_TRUE;
|
|
2817
|
+
const doc = metadata.get(VGI_DOC_KEY) ?? "";
|
|
2818
|
+
const defaultJson = metadata.get(VGI_DEFAULT_KEY);
|
|
2819
|
+
const choicesJson = metadata.get(VGI_CHOICES_KEY);
|
|
2820
|
+
const rangeNotation = metadata.get(VGI_RANGE_KEY);
|
|
2821
|
+
const pattern = metadata.get(VGI_PATTERN_KEY);
|
|
2822
|
+
specs.push({
|
|
2823
|
+
name: field3.name,
|
|
2824
|
+
position,
|
|
2825
|
+
arrowType: field3.type,
|
|
2826
|
+
isTableInput,
|
|
2827
|
+
isAnyType,
|
|
2828
|
+
isVarargs,
|
|
2829
|
+
isConst,
|
|
2830
|
+
doc,
|
|
2831
|
+
defaultJson,
|
|
2832
|
+
choicesJson,
|
|
2833
|
+
rangeNotation,
|
|
2834
|
+
pattern
|
|
2835
|
+
});
|
|
2836
|
+
}
|
|
2837
|
+
return specs;
|
|
2838
|
+
}
|
|
2839
|
+
|
|
2662
2840
|
// src/util/arrow/index.ts
|
|
2663
2841
|
init_arrow();
|
|
2664
2842
|
|
|
@@ -2676,7 +2854,8 @@ function defineScalarFunction(config) {
|
|
|
2676
2854
|
isAnyType: isAny,
|
|
2677
2855
|
isConst: p.const,
|
|
2678
2856
|
isVarargs: p.varargs,
|
|
2679
|
-
doc: p.doc
|
|
2857
|
+
doc: p.doc,
|
|
2858
|
+
...constraintSpecFields(p)
|
|
2680
2859
|
});
|
|
2681
2860
|
}
|
|
2682
2861
|
} else {
|
|
@@ -5584,7 +5763,19 @@ var ScanBranchSchema = schema2([
|
|
|
5584
5763
|
field2("function_name", utf82(), false),
|
|
5585
5764
|
field2("arguments", binary2(), false),
|
|
5586
5765
|
field2("branch_filter", utf82(), true),
|
|
5587
|
-
field2("writable", bool2(), false)
|
|
5766
|
+
field2("writable", bool2(), false),
|
|
5767
|
+
field2("source_catalog", utf82(), true),
|
|
5768
|
+
field2("source_schema", utf82(), true),
|
|
5769
|
+
field2("source_table", utf82(), true)
|
|
5770
|
+
]);
|
|
5771
|
+
var AttachCatalogInfoSchema = schema2([
|
|
5772
|
+
field2("alias", utf82(), false),
|
|
5773
|
+
field2("target", utf82(), false),
|
|
5774
|
+
field2("db_type", utf82(), false),
|
|
5775
|
+
field2("options", map2(field2("key", utf82(), false), field2("value", utf82(), true), false), false),
|
|
5776
|
+
field2("hidden", bool2(), false),
|
|
5777
|
+
field2("required", bool2(), false),
|
|
5778
|
+
field2("secret_ref", utf82(), false)
|
|
5588
5779
|
]);
|
|
5589
5780
|
var AggregateBindResultSchema = schema2([
|
|
5590
5781
|
field2("output_schema", binary2(), false),
|
|
@@ -5628,6 +5819,7 @@ var CatalogAttachResultSchema = schema2([
|
|
|
5628
5819
|
field2("default_schema", utf82(), false),
|
|
5629
5820
|
field2("settings", list2(field2("item", binary2(), true)), false),
|
|
5630
5821
|
field2("secret_types", list2(field2("item", binary2(), true)), false),
|
|
5822
|
+
field2("attach_catalogs", list2(field2("item", binary2(), true)), false),
|
|
5631
5823
|
field2("comment", utf82(), true),
|
|
5632
5824
|
field2("tags", map2(field2("key", utf82(), false), field2("value", utf82(), true), false), false),
|
|
5633
5825
|
field2("supports_column_statistics", bool2(), false),
|
|
@@ -6090,6 +6282,15 @@ var encodeCopyFromFormatInfo = (v) => encodeASD(CopyFromFormatInfoSchema, {
|
|
|
6090
6282
|
description: v.description ?? "",
|
|
6091
6283
|
ordered: v.ordered ?? false
|
|
6092
6284
|
});
|
|
6285
|
+
var encodeAttachCatalogInfo = (v) => encodeASD(AttachCatalogInfoSchema, {
|
|
6286
|
+
alias: v.alias,
|
|
6287
|
+
target: v.target,
|
|
6288
|
+
db_type: v.db_type ?? "",
|
|
6289
|
+
options: v.options ?? {},
|
|
6290
|
+
hidden: v.hidden ?? false,
|
|
6291
|
+
required: v.required ?? false,
|
|
6292
|
+
secret_ref: v.secret_ref ?? ""
|
|
6293
|
+
});
|
|
6093
6294
|
function decodeScanFunctionResult(inner) {
|
|
6094
6295
|
const argsBytes = inner.arguments;
|
|
6095
6296
|
const positionalArguments = [];
|
|
@@ -6123,7 +6324,10 @@ function singleBranchResult(legacy) {
|
|
|
6123
6324
|
function_name: [legacy.function_name],
|
|
6124
6325
|
arguments: [toUint8Array(legacy.arguments)],
|
|
6125
6326
|
branch_filter: [null],
|
|
6126
|
-
writable: [false]
|
|
6327
|
+
writable: [false],
|
|
6328
|
+
source_catalog: [null],
|
|
6329
|
+
source_schema: [null],
|
|
6330
|
+
source_table: [null]
|
|
6127
6331
|
}, ScanBranchSchema);
|
|
6128
6332
|
return {
|
|
6129
6333
|
branches: [serializeBatch(branchBatch)],
|
|
@@ -6152,7 +6356,10 @@ function buildScanBranchesResult(branches, requiredExtensions = []) {
|
|
|
6152
6356
|
function_name: [branch.functionName],
|
|
6153
6357
|
arguments: [serializeBranchArguments(branch)],
|
|
6154
6358
|
branch_filter: [branch.branchFilter ?? null],
|
|
6155
|
-
writable: [branch.writable ?? false]
|
|
6359
|
+
writable: [branch.writable ?? false],
|
|
6360
|
+
source_catalog: [branch.sourceCatalog ?? null],
|
|
6361
|
+
source_schema: [branch.sourceSchema ?? null],
|
|
6362
|
+
source_table: [branch.sourceTable ?? null]
|
|
6156
6363
|
}, ScanBranchSchema);
|
|
6157
6364
|
return serializeBatch(branchBatch);
|
|
6158
6365
|
});
|
|
@@ -6294,108 +6501,6 @@ function serializeColumnStatistics(stats, _cacheMaxAgeSeconds) {
|
|
|
6294
6501
|
return serializeBatch(buildStatisticsBatch(stats));
|
|
6295
6502
|
}
|
|
6296
6503
|
|
|
6297
|
-
// src/arguments/argument-spec.ts
|
|
6298
|
-
init_arrow();
|
|
6299
|
-
function argumentSpecSortKey(spec) {
|
|
6300
|
-
if (typeof spec.position === "number") {
|
|
6301
|
-
return [0, spec.position];
|
|
6302
|
-
}
|
|
6303
|
-
return [1, spec.position];
|
|
6304
|
-
}
|
|
6305
|
-
function argumentSpecsToSchema(specs) {
|
|
6306
|
-
const sorted = [...specs].sort((a, b) => {
|
|
6307
|
-
const ka = argumentSpecSortKey(a);
|
|
6308
|
-
const kb = argumentSpecSortKey(b);
|
|
6309
|
-
if (ka[0] !== kb[0])
|
|
6310
|
-
return ka[0] - kb[0];
|
|
6311
|
-
if (typeof ka[1] === "number" && typeof kb[1] === "number") {
|
|
6312
|
-
return ka[1] - kb[1];
|
|
6313
|
-
}
|
|
6314
|
-
return String(ka[1]).localeCompare(String(kb[1]));
|
|
6315
|
-
});
|
|
6316
|
-
const fields = [];
|
|
6317
|
-
for (const spec of sorted) {
|
|
6318
|
-
const metadata = new Map;
|
|
6319
|
-
if (typeof spec.position === "string") {
|
|
6320
|
-
metadata.set(VGI_ARG_KEY, VGI_ARG_NAMED);
|
|
6321
|
-
}
|
|
6322
|
-
if (spec.isTableInput) {
|
|
6323
|
-
metadata.set(VGI_TYPE_KEY, VGI_TYPE_TABLE);
|
|
6324
|
-
} else if (spec.isAnyType) {
|
|
6325
|
-
metadata.set(VGI_TYPE_KEY, VGI_TYPE_ANY);
|
|
6326
|
-
}
|
|
6327
|
-
if (spec.isVarargs) {
|
|
6328
|
-
metadata.set(VGI_VARARGS_KEY, VGI_VARARGS_TRUE);
|
|
6329
|
-
}
|
|
6330
|
-
if (spec.isConst) {
|
|
6331
|
-
metadata.set(VGI_CONST_KEY, VGI_CONST_TRUE);
|
|
6332
|
-
}
|
|
6333
|
-
if (spec.doc) {
|
|
6334
|
-
metadata.set(VGI_DOC_KEY, spec.doc);
|
|
6335
|
-
}
|
|
6336
|
-
const field3 = field2(spec.name, spec.arrowType, true, metadata.size > 0 ? metadata : undefined);
|
|
6337
|
-
fields.push(field3);
|
|
6338
|
-
}
|
|
6339
|
-
return schema2(fields);
|
|
6340
|
-
}
|
|
6341
|
-
function macroArgumentsSchema(parameters, parameterDefaultValues, parameterDocs) {
|
|
6342
|
-
const docs = parameterDocs ?? {};
|
|
6343
|
-
const defaultTypes = new Map;
|
|
6344
|
-
if (parameterDefaultValues && parameterDefaultValues.length > 0) {
|
|
6345
|
-
const batch = deserializeBatch(parameterDefaultValues);
|
|
6346
|
-
for (const f of batch.schema.fields) {
|
|
6347
|
-
defaultTypes.set(f.name, f.type);
|
|
6348
|
-
}
|
|
6349
|
-
}
|
|
6350
|
-
const fields = [];
|
|
6351
|
-
for (const name of parameters) {
|
|
6352
|
-
const metadata = new Map;
|
|
6353
|
-
const doc = docs[name];
|
|
6354
|
-
if (doc) {
|
|
6355
|
-
metadata.set(VGI_DOC_KEY, doc);
|
|
6356
|
-
}
|
|
6357
|
-
const fieldType = defaultTypes.get(name) ?? nullType2();
|
|
6358
|
-
fields.push(field2(name, fieldType, true, metadata.size > 0 ? metadata : undefined));
|
|
6359
|
-
}
|
|
6360
|
-
return schema2(fields);
|
|
6361
|
-
}
|
|
6362
|
-
function macroParameterDocsFromSchema(schema3) {
|
|
6363
|
-
const docs = {};
|
|
6364
|
-
for (const field3 of schema3.fields) {
|
|
6365
|
-
const doc = field3.metadata.get(VGI_DOC_KEY);
|
|
6366
|
-
if (doc) {
|
|
6367
|
-
docs[field3.name] = doc;
|
|
6368
|
-
}
|
|
6369
|
-
}
|
|
6370
|
-
return docs;
|
|
6371
|
-
}
|
|
6372
|
-
function schemaToArgumentSpecs(schema3) {
|
|
6373
|
-
const specs = [];
|
|
6374
|
-
let positionIndex = 0;
|
|
6375
|
-
for (const field3 of schema3.fields) {
|
|
6376
|
-
const metadata = field3.metadata;
|
|
6377
|
-
const isNamed = metadata.get(VGI_ARG_KEY) === VGI_ARG_NAMED;
|
|
6378
|
-
const position = isNamed ? field3.name : positionIndex++;
|
|
6379
|
-
const vgiType = metadata.get(VGI_TYPE_KEY);
|
|
6380
|
-
const isTableInput = vgiType === VGI_TYPE_TABLE;
|
|
6381
|
-
const isAnyType = vgiType === VGI_TYPE_ANY;
|
|
6382
|
-
const isVarargs = metadata.get(VGI_VARARGS_KEY) === VGI_VARARGS_TRUE;
|
|
6383
|
-
const isConst = metadata.get(VGI_CONST_KEY) === VGI_CONST_TRUE;
|
|
6384
|
-
const doc = metadata.get(VGI_DOC_KEY) ?? "";
|
|
6385
|
-
specs.push({
|
|
6386
|
-
name: field3.name,
|
|
6387
|
-
position,
|
|
6388
|
-
arrowType: field3.type,
|
|
6389
|
-
isTableInput,
|
|
6390
|
-
isAnyType,
|
|
6391
|
-
isVarargs,
|
|
6392
|
-
isConst,
|
|
6393
|
-
doc
|
|
6394
|
-
});
|
|
6395
|
-
}
|
|
6396
|
-
return specs;
|
|
6397
|
-
}
|
|
6398
|
-
|
|
6399
6504
|
// src/metadata/types.ts
|
|
6400
6505
|
var CatalogFunctionType;
|
|
6401
6506
|
((CatalogFunctionType2) => {
|
|
@@ -6525,6 +6630,7 @@ class ReadOnlyCatalogInterface extends CatalogInterface {
|
|
|
6525
6630
|
this._attachments.set(name, attachOpaqueData);
|
|
6526
6631
|
const settings = (this._descriptor.settings ?? []).map((s) => serializeSetting(s));
|
|
6527
6632
|
const secretTypes = (this._descriptor.secretTypes ?? []).map((s) => serializeSecretType(s));
|
|
6633
|
+
const attachCatalogs = (this._descriptor.attachCatalogs ?? []).map((c) => encodeAttachCatalogInfo(c));
|
|
6528
6634
|
const hasTimeTravel = this._descriptor.schemas.some((s) => s.tables?.some((t) => t.supportsTimeTravel) ?? false);
|
|
6529
6635
|
return {
|
|
6530
6636
|
attach_opaque_data: attachOpaqueData,
|
|
@@ -6536,6 +6642,7 @@ class ReadOnlyCatalogInterface extends CatalogInterface {
|
|
|
6536
6642
|
default_schema: this._descriptor.defaultSchema ?? "main",
|
|
6537
6643
|
settings,
|
|
6538
6644
|
secret_types: secretTypes,
|
|
6645
|
+
attach_catalogs: attachCatalogs,
|
|
6539
6646
|
comment: this._descriptor.comment ?? null,
|
|
6540
6647
|
tags: this._descriptor.tags ?? {},
|
|
6541
6648
|
supports_column_statistics: true,
|
|
@@ -9166,6 +9273,7 @@ function registerCatalogAdminMethods(protocol, getCatalog, signingKey) {
|
|
|
9166
9273
|
default_schema: result.default_schema ?? "main",
|
|
9167
9274
|
settings: result.settings ?? [],
|
|
9168
9275
|
secret_types: result.secret_types ?? [],
|
|
9276
|
+
attach_catalogs: result.attach_catalogs ?? [],
|
|
9169
9277
|
comment: result.comment ?? null,
|
|
9170
9278
|
tags: result.tags ?? {},
|
|
9171
9279
|
supports_column_statistics: result.supports_column_statistics ?? true,
|
|
@@ -10256,6 +10364,7 @@ class VgiClient {
|
|
|
10256
10364
|
default_schema: inner.default_schema ?? "main",
|
|
10257
10365
|
settings: inner.settings ? (Array.isArray(inner.settings) ? inner.settings : [...inner.settings]).map(toUint8Array) : [],
|
|
10258
10366
|
secret_types: inner.secret_types ? (Array.isArray(inner.secret_types) ? inner.secret_types : [...inner.secret_types]).map(toUint8Array) : [],
|
|
10367
|
+
attach_catalogs: inner.attach_catalogs ? (Array.isArray(inner.attach_catalogs) ? inner.attach_catalogs : [...inner.attach_catalogs]).map(toUint8Array) : [],
|
|
10259
10368
|
comment: inner.comment ?? null,
|
|
10260
10369
|
tags: deserializeTags(inner.tags),
|
|
10261
10370
|
supports_column_statistics: inner.supports_column_statistics ?? false,
|
|
@@ -10759,6 +10868,7 @@ export {
|
|
|
10759
10868
|
fromBrandedNumber,
|
|
10760
10869
|
fromBrandedBigInt,
|
|
10761
10870
|
fromBranded,
|
|
10871
|
+
formatRange,
|
|
10762
10872
|
formatPushedFilters,
|
|
10763
10873
|
float642 as float64,
|
|
10764
10874
|
float323 as float32,
|
|
@@ -10807,6 +10917,7 @@ export {
|
|
|
10807
10917
|
dateMillisecond2 as dateMillisecond,
|
|
10808
10918
|
dateDay2 as dateDay,
|
|
10809
10919
|
date2 as date,
|
|
10920
|
+
constraintSpecFields,
|
|
10810
10921
|
columnFromArray,
|
|
10811
10922
|
codecFor,
|
|
10812
10923
|
bytes,
|
|
@@ -10885,4 +10996,4 @@ export {
|
|
|
10885
10996
|
ArgumentValidationError
|
|
10886
10997
|
};
|
|
10887
10998
|
|
|
10888
|
-
//# debugId=
|
|
10999
|
+
//# debugId=B8E8A46EBC37A19064756E2164756E21
|