@query-farm/vgi 0.23.0 → 0.24.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.
@@ -322,6 +322,8 @@ export interface CatalogAttachResult {
322
322
  comment?: string | null;
323
323
  tags: Record<string, string>;
324
324
  supports_column_statistics: boolean;
325
+ global_functions: Uint8Array[];
326
+ global_function_prefix: string;
325
327
  resolved_data_version?: string | null;
326
328
  resolved_implementation_version?: string | null;
327
329
  }
package/dist/index.js CHANGED
@@ -6242,6 +6242,8 @@ var CatalogAttachResultSchema = schema2([
6242
6242
  field2("comment", utf82(), true),
6243
6243
  field2("tags", map2(field2("key", utf82(), false), field2("value", utf82(), true), false), false),
6244
6244
  field2("supports_column_statistics", bool2(), false),
6245
+ field2("global_functions", list2(field2("item", binary2(), true)), false),
6246
+ field2("global_function_prefix", utf82(), false),
6245
6247
  field2("resolved_data_version", utf82(), true),
6246
6248
  field2("resolved_implementation_version", utf82(), true)
6247
6249
  ]);
@@ -7080,6 +7082,8 @@ class ReadOnlyCatalogInterface extends CatalogInterface {
7080
7082
  comment: this._descriptor.comment ?? null,
7081
7083
  tags: this._descriptor.tags ?? {},
7082
7084
  supports_column_statistics: true,
7085
+ global_functions: this._globalFunctionInfos().map(encodeFunctionInfo),
7086
+ global_function_prefix: this._descriptor.globalFunctionPrefix ?? "",
7083
7087
  resolved_data_version: null,
7084
7088
  resolved_implementation_version: null
7085
7089
  };
@@ -7266,56 +7270,76 @@ class ReadOnlyCatalogInterface extends CatalogInterface {
7266
7270
  if (t === "AGGREGATE_FUNCTION")
7267
7271
  return f.kind === "aggregate";
7268
7272
  return true;
7269
- }).map((f) => {
7270
- const meta = resolveMetadata(f);
7271
- const argSchema = argumentSpecsToSchema(f.argumentSpecs);
7272
- const argBytes = serializeSchema(argSchema);
7273
- const outputSchemaBytes = serializeSchema(f.defaultOutputSchema ?? schema2([]));
7274
- const requiredSecrets = (meta.requiredSecrets ?? []).map((secretType) => ({ secret_type: secretType, scope: null, secret_name: null }));
7275
- const derivedTags = {};
7276
- const tags = { ...derivedTags, ...meta.tags ?? {} };
7277
- return {
7278
- comment: null,
7279
- tags,
7280
- name: f.meta.name,
7281
- schema_name: name,
7282
- function_type: meta.functionType.toUpperCase(),
7283
- arguments: argBytes,
7284
- output_schema: outputSchemaBytes,
7285
- stability: meta.stability,
7286
- null_handling: meta.nullHandling,
7287
- description: meta.description,
7288
- examples: meta.examples.map((e) => ({
7289
- sql: e.sql,
7290
- description: e.description,
7291
- expected_output: null
7292
- })),
7293
- categories: meta.categories,
7294
- projection_pushdown: meta.projectionPushdown,
7295
- filter_pushdown: meta.filterPushdown,
7296
- sampling_pushdown: meta.samplingPushdown,
7297
- late_materialization: f.kind === "table" && f.meta.lateMaterialization === true ? true : null,
7298
- supported_expression_filters: meta.supportedExpressionFilters,
7299
- order_preservation: meta.preservesOrder,
7300
- max_workers: meta.maxWorkers ?? DEFAULT_MAX_WORKERS,
7301
- supports_batch_index: f.kind === "table_buffering" && f.meta.requiresInputBatchIndex === true || f.kind === "table" && f.meta.supportsBatchIndex === true,
7302
- partition_kind: f.kind === "table" && f.meta.partitionKind ? f.meta.partitionKind : "NOT_PARTITIONED",
7303
- order_dependent: meta.orderDependent,
7304
- distinct_dependent: meta.distinctDependent,
7305
- supports_window: false,
7306
- streaming_partitioned: false,
7307
- has_finalize: f.kind === "table_in_out" && f.meta.hasFinalize === true || f.kind === "table_buffering",
7308
- source_order_dependent: f.kind === "table_buffering" && f.meta.sourceOrderDependent === true,
7309
- sink_order_dependent: f.kind === "table_buffering" && f.meta.sinkOrderDependent === true,
7310
- requires_input_batch_index: f.kind === "table_buffering" && f.meta.requiresInputBatchIndex === true,
7311
- input_from_args: f.kind === "table_in_out" && f.meta.inputFromArgs === true,
7312
- required_settings: meta.requiredSettings,
7313
- required_secrets: requiredSecrets.map((s) => ({
7314
- secret_type: s.secret_type,
7315
- scope: s.scope,
7316
- secret_name: s.secret_name
7317
- }))
7318
- };
7273
+ }).map((f) => this._functionToInfo(f, name));
7274
+ }
7275
+ _functionToInfo(f, name) {
7276
+ const meta = resolveMetadata(f);
7277
+ const argSchema = argumentSpecsToSchema(f.argumentSpecs);
7278
+ const argBytes = serializeSchema(argSchema);
7279
+ const outputSchemaBytes = serializeSchema(f.defaultOutputSchema ?? schema2([]));
7280
+ const requiredSecrets = (meta.requiredSecrets ?? []).map((secretType) => ({ secret_type: secretType, scope: null, secret_name: null }));
7281
+ const derivedTags = {};
7282
+ const tags = { ...derivedTags, ...meta.tags ?? {} };
7283
+ return {
7284
+ comment: null,
7285
+ tags,
7286
+ name: f.meta.name,
7287
+ schema_name: name,
7288
+ function_type: meta.functionType.toUpperCase(),
7289
+ arguments: argBytes,
7290
+ output_schema: outputSchemaBytes,
7291
+ stability: meta.stability,
7292
+ null_handling: meta.nullHandling,
7293
+ description: meta.description,
7294
+ examples: meta.examples.map((e) => ({
7295
+ sql: e.sql,
7296
+ description: e.description,
7297
+ expected_output: null
7298
+ })),
7299
+ categories: meta.categories,
7300
+ projection_pushdown: meta.projectionPushdown,
7301
+ filter_pushdown: meta.filterPushdown,
7302
+ sampling_pushdown: meta.samplingPushdown,
7303
+ late_materialization: f.kind === "table" && f.meta.lateMaterialization === true ? true : null,
7304
+ supported_expression_filters: meta.supportedExpressionFilters,
7305
+ order_preservation: meta.preservesOrder,
7306
+ max_workers: meta.maxWorkers ?? DEFAULT_MAX_WORKERS,
7307
+ supports_batch_index: f.kind === "table_buffering" && f.meta.requiresInputBatchIndex === true || f.kind === "table" && f.meta.supportsBatchIndex === true,
7308
+ partition_kind: f.kind === "table" && f.meta.partitionKind ? f.meta.partitionKind : "NOT_PARTITIONED",
7309
+ order_dependent: meta.orderDependent,
7310
+ distinct_dependent: meta.distinctDependent,
7311
+ supports_window: false,
7312
+ streaming_partitioned: false,
7313
+ has_finalize: f.kind === "table_in_out" && f.meta.hasFinalize === true || f.kind === "table_buffering",
7314
+ source_order_dependent: f.kind === "table_buffering" && f.meta.sourceOrderDependent === true,
7315
+ sink_order_dependent: f.kind === "table_buffering" && f.meta.sinkOrderDependent === true,
7316
+ requires_input_batch_index: f.kind === "table_buffering" && f.meta.requiresInputBatchIndex === true,
7317
+ input_from_args: f.kind === "table_in_out" && f.meta.inputFromArgs === true,
7318
+ required_settings: meta.requiredSettings,
7319
+ required_secrets: requiredSecrets.map((s) => ({
7320
+ secret_type: s.secret_type,
7321
+ scope: s.scope,
7322
+ secret_name: s.secret_name
7323
+ }))
7324
+ };
7325
+ }
7326
+ _globalFunctionInfos() {
7327
+ const globals = this._descriptor.globalFunctions ?? [];
7328
+ if (globals.length === 0)
7329
+ return [];
7330
+ const schemaOf = new Map;
7331
+ for (const sch of this._descriptor.schemas) {
7332
+ for (const fn of sch.functions ?? []) {
7333
+ if (!schemaOf.has(fn))
7334
+ schemaOf.set(fn, sch.name);
7335
+ }
7336
+ }
7337
+ return globals.map((fn) => {
7338
+ const schemaName = schemaOf.get(fn);
7339
+ if (schemaName === undefined) {
7340
+ throw new Error(`Catalog '${this._descriptor.name}': '${fn.meta.name}' is listed in ` + `globalFunctions but is not declared in any schema.`);
7341
+ }
7342
+ return this._functionToInfo(fn, schemaName);
7319
7343
  });
7320
7344
  }
7321
7345
  schemaContentsMacros(attachOpaqueData, name, type, transactionOpaqueData) {
@@ -9845,6 +9869,8 @@ function registerCatalogAdminMethods(protocol, getCatalog, signingKey) {
9845
9869
  comment: result.comment ?? null,
9846
9870
  tags: result.tags ?? {},
9847
9871
  supports_column_statistics: result.supports_column_statistics ?? true,
9872
+ global_functions: result.global_functions ?? [],
9873
+ global_function_prefix: result.global_function_prefix ?? "",
9848
9874
  resolved_data_version: result.resolved_data_version ?? null,
9849
9875
  resolved_implementation_version: result.resolved_implementation_version ?? null
9850
9876
  }, CatalogAttachResultSchema);
@@ -11347,6 +11373,8 @@ class VgiClient {
11347
11373
  comment: inner.comment ?? null,
11348
11374
  tags: deserializeTags(inner.tags),
11349
11375
  supports_column_statistics: inner.supports_column_statistics ?? false,
11376
+ global_functions: inner.global_functions ? (Array.isArray(inner.global_functions) ? inner.global_functions : [...inner.global_functions]).map(toUint8Array) : [],
11377
+ global_function_prefix: inner.global_function_prefix ?? "",
11350
11378
  resolved_data_version: inner.resolved_data_version ?? null,
11351
11379
  resolved_implementation_version: inner.resolved_implementation_version ?? null
11352
11380
  };
@@ -12142,4 +12170,4 @@ export {
12142
12170
  ArgumentValidationError
12143
12171
  };
12144
12172
 
12145
- //# debugId=08C7854CB5C380CC64756E2164756E21
12173
+ //# debugId=F2B3478BD764EF8C64756E2164756E21