@query-farm/vgi 0.45.0 → 0.47.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.
Files changed (102) hide show
  1. package/README.md +19 -6
  2. package/dist/arrow/impl-arrowjs/index.d.ts +1 -1
  3. package/dist/arrow/impl-arrowjs/iterate.d.ts +2 -0
  4. package/dist/arrow/impl-flechette/canonical.d.ts +1 -1
  5. package/dist/arrow/impl-flechette/index.d.ts +1 -1
  6. package/dist/arrow/impl-flechette/iterate.d.ts +2 -0
  7. package/dist/arrow/impl-flechette/schema.d.ts +19 -5
  8. package/dist/arrow/index.d.ts +1 -1
  9. package/dist/catalog/column-expressions.d.ts +8 -0
  10. package/dist/catalog/column-metadata.d.ts +11 -0
  11. package/dist/catalog/composite.d.ts +2 -1
  12. package/dist/catalog/descriptors.d.ts +21 -29
  13. package/dist/catalog/interface.d.ts +15 -20
  14. package/dist/catalog/macro-overloads.d.ts +4 -0
  15. package/dist/catalog/read-only.d.ts +1 -1
  16. package/dist/catalog/unconstrained-columns.d.ts +2 -0
  17. package/dist/client/client.d.ts +38 -14
  18. package/dist/client-entry.js +806 -115
  19. package/dist/client-entry.js.map +18 -14
  20. package/dist/functions/continuation.d.ts +69 -0
  21. package/dist/functions/projection.d.ts +18 -0
  22. package/dist/functions/table-in-out.d.ts +51 -7
  23. package/dist/functions/table.d.ts +6 -1
  24. package/dist/functions/types.d.ts +21 -0
  25. package/dist/generated/vgi-client.d.ts +178 -36
  26. package/dist/generated/vgi-protocol-schemas.d.ts +51 -1
  27. package/dist/generated/vgi-protocol-types.d.ts +317 -3
  28. package/dist/generated/vgi-service.d.ts +266 -29
  29. package/dist/index.core.d.ts +3 -1
  30. package/dist/index.js +1747 -320
  31. package/dist/index.js.map +45 -37
  32. package/dist/protocol/dispatch.d.ts +9 -9
  33. package/dist/protocol/handlers/aggregate.d.ts +1 -1
  34. package/dist/protocol/handlers/catalog/index.d.ts +1 -1
  35. package/dist/protocol/handlers/catalog/metadata.d.ts +1 -0
  36. package/dist/protocol/handlers/function.d.ts +1 -1
  37. package/dist/protocol/handlers/table-buffering.d.ts +1 -1
  38. package/dist/protocol/handlers/unimplemented.d.ts +1 -1
  39. package/dist/protocol/serializers/bind.d.ts +5 -1
  40. package/dist/protocol/types.d.ts +5 -0
  41. package/dist/rpc-server.d.ts +6 -6
  42. package/dist/serve-entry.js +1607 -436
  43. package/dist/serve-entry.js.map +33 -27
  44. package/dist/util/arrow/index.d.ts +1 -1
  45. package/dist/util/parent-rows.d.ts +8 -0
  46. package/dist/worker-cf-entry.d.ts +1 -1
  47. package/dist/worker-cf-entry.js +1901 -526
  48. package/dist/worker-cf-entry.js.map +45 -37
  49. package/dist/worker.d.ts +1 -1
  50. package/package.json +8 -7
  51. package/src/arrow/impl-arrowjs/index.ts +1 -1
  52. package/src/arrow/impl-arrowjs/iterate.ts +9 -1
  53. package/src/arrow/impl-arrowjs/project.ts +1 -1
  54. package/src/arrow/impl-flechette/canonical.ts +7 -5
  55. package/src/arrow/impl-flechette/index.ts +1 -1
  56. package/src/arrow/impl-flechette/ipc.ts +12 -0
  57. package/src/arrow/impl-flechette/iterate.ts +5 -0
  58. package/src/arrow/impl-flechette/project.ts +6 -8
  59. package/src/arrow/index.ts +1 -1
  60. package/src/catalog/column-expressions.ts +224 -0
  61. package/src/catalog/column-metadata.ts +151 -0
  62. package/src/catalog/composite.ts +5 -1
  63. package/src/catalog/contents-codec.ts +6 -1
  64. package/src/catalog/descriptors.ts +21 -29
  65. package/src/catalog/interface.ts +70 -55
  66. package/src/catalog/macro-overloads.ts +44 -0
  67. package/src/catalog/read-only.ts +69 -71
  68. package/src/catalog/unconstrained-columns.ts +23 -0
  69. package/src/client/client.ts +180 -69
  70. package/src/codec/asd.ts +3 -1
  71. package/src/filter-pushdown/collector.ts +17 -1
  72. package/src/functions/continuation.ts +202 -0
  73. package/src/functions/projection.ts +207 -0
  74. package/src/functions/table-in-out.ts +131 -56
  75. package/src/functions/table.ts +10 -0
  76. package/src/functions/types.ts +21 -0
  77. package/src/generated/vgi-client.ts +200 -37
  78. package/src/generated/vgi-protocol-schemas.ts +456 -41
  79. package/src/generated/vgi-protocol-types.ts +879 -5
  80. package/src/generated/vgi-service.ts +514 -42
  81. package/src/http/client-bundle.ts +1 -1
  82. package/src/http/fetch.ts +1 -1
  83. package/src/index.core.ts +10 -0
  84. package/src/protocol/dispatch.ts +9 -9
  85. package/src/protocol/handlers/aggregate.ts +1 -1
  86. package/src/protocol/handlers/catalog/admin.ts +10 -5
  87. package/src/protocol/handlers/catalog/index.ts +2 -2
  88. package/src/protocol/handlers/catalog/macro.ts +6 -5
  89. package/src/protocol/handlers/catalog/metadata.ts +16 -0
  90. package/src/protocol/handlers/catalog/table.ts +72 -26
  91. package/src/protocol/handlers/catalog/view.ts +24 -3
  92. package/src/protocol/handlers/function.ts +79 -1
  93. package/src/protocol/handlers/table-buffering.ts +1 -1
  94. package/src/protocol/handlers/unimplemented.ts +6 -6
  95. package/src/protocol/serializers/bind.ts +17 -1
  96. package/src/protocol/state-serializer.ts +7 -1
  97. package/src/protocol/types.ts +6 -0
  98. package/src/rpc-server.ts +9 -9
  99. package/src/util/arrow/index.ts +1 -1
  100. package/src/util/parent-rows.ts +41 -0
  101. package/src/worker-cf-entry.ts +3 -0
  102. package/src/worker.ts +1 -1
@@ -37,6 +37,7 @@ __export(exports_impl_arrowjs, {
37
37
  decimal128: () => decimal128,
38
38
  decimal256: () => decimal256,
39
39
  decodeDictValue: () => decodeDictValue,
40
+ decodeMapValue: () => decodeMapValue,
40
41
  denseUnion: () => denseUnion,
41
42
  deserializeBatch: () => deserializeBatch,
42
43
  deserializeBatches: () => deserializeBatches,
@@ -1517,6 +1518,7 @@ function batchFromColumns(columns, schema, repr = "rich") {
1517
1518
  return new RecordBatch2(a, data);
1518
1519
  }
1519
1520
  // src/arrow/impl-arrowjs/iterate.ts
1521
+ import { makeVector } from "@query-farm/apache-arrow";
1520
1522
  function* iterRows(batch, repr = "rich") {
1521
1523
  const a = batch;
1522
1524
  const codecs = a.schema.fields.map((f) => codecFor(f.type));
@@ -1615,6 +1617,12 @@ function safeNumber(value) {
1615
1617
  }
1616
1618
  return value;
1617
1619
  }
1620
+ function decodeMapValue(value, index = 0) {
1621
+ if (value?.type?.typeId === 17 && value.valueOffsets && value.children) {
1622
+ return readCanonicalValue(value.type, makeVector(value), index);
1623
+ }
1624
+ return value;
1625
+ }
1618
1626
  // src/arrow/impl-arrowjs/filter.ts
1619
1627
  function filterBatch(batch, mask) {
1620
1628
  const a = batch;
@@ -1644,7 +1652,7 @@ function filterBatch(batch, mask) {
1644
1652
  }
1645
1653
  // src/arrow/impl-arrowjs/project.ts
1646
1654
  import {
1647
- RecordBatch as RecordBatch3,
1655
+ RecordBatch as RecordBatch4,
1648
1656
  Schema as Schema3,
1649
1657
  Struct as Struct4,
1650
1658
  makeData as makeData4
@@ -1667,7 +1675,7 @@ function projectSchema(projectionIds, schema) {
1667
1675
  const validIds = validateProjectionIds("projectSchema", projectionIds, a.fields.length);
1668
1676
  if (validIds.length === 0)
1669
1677
  return a;
1670
- return new Schema3(validIds.map((i) => a.fields[i]));
1678
+ return new Schema3(validIds.map((i) => a.fields[i]), a.metadata);
1671
1679
  }
1672
1680
  function projectBatch(projectionIds, batch) {
1673
1681
  const a = batch;
@@ -1688,13 +1696,13 @@ function projectBatch(projectionIds, batch) {
1688
1696
  children,
1689
1697
  nullCount: 0
1690
1698
  });
1691
- return new RecordBatch3(projectedSchema, data);
1699
+ return new RecordBatch4(projectedSchema, data);
1692
1700
  }
1693
1701
  // src/arrow/impl-arrowjs/metadata.ts
1694
- import { RecordBatch as RecordBatch4 } from "@query-farm/apache-arrow";
1702
+ import { RecordBatch as RecordBatch5 } from "@query-farm/apache-arrow";
1695
1703
  function withBatchMetadata(batch, metadata) {
1696
1704
  const a = batch;
1697
- return new RecordBatch4(a.schema, a.data, metadata);
1705
+ return new RecordBatch5(a.schema, a.data, metadata);
1698
1706
  }
1699
1707
  // src/arrow/impl-arrowjs/ipc.ts
1700
1708
  import {
@@ -1758,7 +1766,7 @@ import {
1758
1766
  Field as Field3,
1759
1767
  Null,
1760
1768
  makeData as makeData5,
1761
- RecordBatch as RecordBatch6,
1769
+ RecordBatch as RecordBatch7,
1762
1770
  Struct as Struct5,
1763
1771
  SparseUnion,
1764
1772
  Schema as Schema5,
@@ -1870,7 +1878,7 @@ function assemble(columnNames, minData, maxData, hasNull, hasNotNull, distinctCo
1870
1878
  ];
1871
1879
  const structType = new Struct5(schema.fields);
1872
1880
  const data = makeData5({ type: structType, length: n, children, nullCount: 0 });
1873
- return new RecordBatch6(schema, data);
1881
+ return new RecordBatch7(schema, data);
1874
1882
  }
1875
1883
 
1876
1884
  // src/arrow/impl-arrowjs/index.ts
@@ -1914,6 +1922,14 @@ function map2(keyField, valueField, keysSorted) {
1914
1922
  function dictionary2(valueType, indexType, ordered, id) {
1915
1923
  return dictionary(valueType, indexType, ordered, id);
1916
1924
  }
1925
+ // src/cache-control.ts
1926
+ var CACHE_NOT_MODIFIED_KEY = "vgi.cache.not_modified";
1927
+
1928
+ // src/functions/continuation.ts
1929
+ var STATUS_KEY = "vgi.status";
1930
+ var HAVE_MORE_OUTPUT = "HAVE_MORE_OUTPUT";
1931
+ var CONTINUE = "CONTINUE";
1932
+
1917
1933
  // src/arguments/arguments.ts
1918
1934
  class Arguments {
1919
1935
  positional;
@@ -2285,6 +2301,11 @@ function serializeBindRequest(req) {
2285
2301
  argument_names: req.argument_names ?? null
2286
2302
  });
2287
2303
  }
2304
+ function parseBindRepeatability(value) {
2305
+ if (value !== "UNKNOWN" && value !== "STABLE_WITHIN_QUERY")
2306
+ throw new Error("invalid bind repeatability");
2307
+ return value;
2308
+ }
2288
2309
  function deserializeBindResponse(params) {
2289
2310
  const toStrArray = (val) => {
2290
2311
  if (!val)
@@ -2294,10 +2315,12 @@ function deserializeBindResponse(params) {
2294
2315
  };
2295
2316
  return {
2296
2317
  output_schema: deserializeSchema(toUint8Array2(params.output_schema)),
2318
+ projection_expression_profiles: toStrArray(params.projection_expression_profiles),
2297
2319
  opaque_data: params.opaque_data ? toUint8Array2(params.opaque_data) : null,
2298
2320
  lookup_secret_types: toStrArray(params.lookup_secret_types),
2299
2321
  lookup_scopes: toStrArray(params.lookup_scopes),
2300
- lookup_names: toStrArray(params.lookup_names)
2322
+ lookup_names: toStrArray(params.lookup_names),
2323
+ repeatability: parseBindRepeatability(params.repeatability)
2301
2324
  };
2302
2325
  }
2303
2326
  // src/protocol/serializers/init.ts
@@ -2535,7 +2558,12 @@ function normalizeValue(raw, type) {
2535
2558
  const valueType = entries.children[1].type;
2536
2559
  const out = {};
2537
2560
  const put = (k, v) => {
2538
- out[String(k)] = normalizeValue(v, valueType);
2561
+ Object.defineProperty(out, String(k), {
2562
+ value: normalizeValue(v, valueType),
2563
+ enumerable: true,
2564
+ writable: true,
2565
+ configurable: true
2566
+ });
2539
2567
  };
2540
2568
  if (raw[Symbol.iterator]) {
2541
2569
  for (const entry of raw) {
@@ -2632,7 +2660,8 @@ var SchemaInfoSchema = schema2([
2632
2660
  field2("comment", utf82(), true),
2633
2661
  field2("tags", map2(field2("key", utf82(), false), field2("value", utf82(), true), false), false),
2634
2662
  field2("path", list2(field2("item", utf82(), true)), false),
2635
- field2("estimated_object_count", map2(field2("key", utf82(), false), field2("value", int642(), true), false), true)
2663
+ field2("estimated_object_count", map2(field2("key", utf82(), false), field2("value", int642(), true), false), true),
2664
+ field2("options", binary2(), true)
2636
2665
  ]);
2637
2666
  var TableInfoSchema = schema2([
2638
2667
  field2("comment", utf82(), true),
@@ -2640,11 +2669,8 @@ var TableInfoSchema = schema2([
2640
2669
  field2("name", utf82(), false),
2641
2670
  field2("schema_path", list2(field2("item", utf82(), true)), false),
2642
2671
  field2("columns", binary2(), false),
2643
- field2("not_null_constraints", list2(field2("item", int322(), true)), false),
2644
- field2("unique_constraints", list2(field2("item", list2(field2("item", int322(), true)), true)), false),
2645
- field2("check_constraints", list2(field2("item", utf82(), true)), false),
2646
- field2("primary_key_constraints", list2(field2("item", list2(field2("item", int322(), true)), true)), false),
2647
- field2("foreign_key_constraints", list2(field2("item", binary2(), true)), false),
2672
+ field2("constraints", list2(field2("item", binary2(), true)), false),
2673
+ field2("definition_revision", binary2(), true),
2648
2674
  field2("write_result_modes", map2(field2("key", utf82(), false), field2("value", utf82(), true), false), false),
2649
2675
  field2("supports_column_statistics", bool2(), false),
2650
2676
  field2("scan_function", binary2(), true),
@@ -2655,7 +2681,9 @@ var TableInfoSchema = schema2([
2655
2681
  field2("cardinality_max", int642(), true),
2656
2682
  field2("column_statistics", binary2(), true),
2657
2683
  field2("bind_result", binary2(), true),
2658
- field2("required_filters", list2(field2("item", list2(field2("item", utf82(), true)), true)), false)
2684
+ field2("required_filters", list2(field2("item", list2(field2("item", list2(field2("item", utf82(), true)), true)), true)), false),
2685
+ field2("options", binary2(), true),
2686
+ field2("layout", binary2(), true)
2659
2687
  ]);
2660
2688
  var ViewInfoSchema = schema2([
2661
2689
  field2("comment", utf82(), true),
@@ -2663,7 +2691,9 @@ var ViewInfoSchema = schema2([
2663
2691
  field2("name", utf82(), false),
2664
2692
  field2("schema_path", list2(field2("item", utf82(), true)), false),
2665
2693
  field2("definition", utf82(), false),
2666
- field2("column_comments", map2(field2("key", utf82(), false), field2("value", utf82(), true), false), false)
2694
+ field2("column_comments", map2(field2("key", utf82(), false), field2("value", utf82(), true), false), false),
2695
+ field2("aliases", list2(field2("item", utf82(), true)), false),
2696
+ field2("security", utf82(), false)
2667
2697
  ]);
2668
2698
  var FunctionInfoSchema = schema2([
2669
2699
  field2("comment", utf82(), true),
@@ -2705,6 +2735,7 @@ var FunctionInfoSchema = schema2([
2705
2735
  field2("sink_order_dependent", bool2(), false),
2706
2736
  field2("requires_input_batch_index", bool2(), false),
2707
2737
  field2("input_from_args", bool2(), false),
2738
+ field2("input_rows_per_call", int642(), true),
2708
2739
  field2("required_settings", list2(field2("item", utf82(), true)), false),
2709
2740
  field2("required_secrets", list2(field2("item", struct2([field2("secret_type", utf82(), false), field2("scope", utf82(), true), field2("secret_name", utf82(), true)]), true)), false)
2710
2741
  ]);
@@ -2714,21 +2745,15 @@ var MacroInfoSchema = schema2([
2714
2745
  field2("name", utf82(), false),
2715
2746
  field2("schema_path", list2(field2("item", utf82(), true)), false),
2716
2747
  field2("macro_type", dictionary2(utf82(), int162()), false),
2717
- field2("parameters", list2(field2("item", utf82(), true)), false),
2718
- field2("parameter_default_values", binary2(), true),
2719
- field2("definition", utf82(), false),
2720
- field2("arguments_schema", binary2(), true)
2748
+ field2("overloads", list2(field2("item", struct2([field2("parameters", list2(field2("item", struct2([field2("name", utf82(), false), field2("declared_type", binary2(), true), field2("default_value", binary2(), true), field2("default_expression", binary2(), true), field2("documentation", utf82(), true)]), true)), false), field2("definition", utf82(), false), field2("profile", utf82(), false), field2("schema_path", list2(field2("item", utf82(), true)), false), field2("macro_type", utf82(), false), field2("evaluation_context", struct2([field2("timezone", utf82(), false), field2("collation", utf82(), false), field2("default_order", utf82(), false), field2("default_null_order", utf82(), false), field2("preserve_insertion_order", bool2(), false)]), false)]), true)), false)
2721
2749
  ]);
2722
2750
  var IndexInfoSchema = schema2([
2723
2751
  field2("comment", utf82(), true),
2724
2752
  field2("tags", map2(field2("key", utf82(), false), field2("value", utf82(), true), false), false),
2725
2753
  field2("name", utf82(), false),
2726
2754
  field2("schema_path", list2(field2("item", utf82(), true)), false),
2727
- field2("table_name", utf82(), false),
2728
- field2("index_type", utf82(), false),
2729
- field2("constraint_type", dictionary2(utf82(), int162()), false),
2730
- field2("expressions", list2(field2("item", utf82(), true)), false),
2731
- field2("options", map2(field2("key", utf82(), false), field2("value", utf82(), true), false), false)
2755
+ field2("definition", binary2(), false),
2756
+ field2("options", binary2(), false)
2732
2757
  ]);
2733
2758
  var CopyFromFormatInfoSchema = schema2([
2734
2759
  field2("comment", utf82(), true),
@@ -2740,6 +2765,207 @@ var CopyFromFormatInfoSchema = schema2([
2740
2765
  field2("description", utf82(), false),
2741
2766
  field2("ordered", bool2(), false)
2742
2767
  ]);
2768
+ var MacroParameterSchema = schema2([
2769
+ field2("name", utf82(), false),
2770
+ field2("declared_type", binary2(), true),
2771
+ field2("default_value", binary2(), true),
2772
+ field2("default_expression", binary2(), true),
2773
+ field2("documentation", utf82(), true)
2774
+ ]);
2775
+ var MacroOverloadSchema = schema2([
2776
+ field2("parameters", list2(field2("item", struct2([field2("name", utf82(), false), field2("declared_type", binary2(), true), field2("default_value", binary2(), true), field2("default_expression", binary2(), true), field2("documentation", utf82(), true)]), true)), false),
2777
+ field2("definition", utf82(), false),
2778
+ field2("profile", utf82(), false),
2779
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
2780
+ field2("macro_type", utf82(), false),
2781
+ field2("evaluation_context", struct2([field2("timezone", utf82(), false), field2("collation", utf82(), false), field2("default_order", utf82(), false), field2("default_null_order", utf82(), false), field2("preserve_insertion_order", bool2(), false)]), false)
2782
+ ]);
2783
+ var ClientQueryCapabilitiesSchema = schema2([
2784
+ field2("encodings", list2(field2("item", utf82(), true)), false),
2785
+ field2("semantic_profiles", list2(field2("item", utf82(), true)), false),
2786
+ field2("engine_version", utf82(), false),
2787
+ field2("max_query_bytes", int642(), false)
2788
+ ]);
2789
+ var QueryCapabilitiesSchema = schema2([
2790
+ field2("encoding", utf82(), false),
2791
+ field2("semantic_profiles", list2(field2("item", utf82(), true)), false),
2792
+ field2("execution_modes", list2(field2("item", utf82(), true)), false),
2793
+ field2("backend_engine", utf82(), false),
2794
+ field2("backend_version", utf82(), false),
2795
+ field2("capability_revision", utf82(), false),
2796
+ field2("default_evaluation_context", struct2([field2("timezone", utf82(), false), field2("collation", utf82(), false), field2("default_order", utf82(), false), field2("default_null_order", utf82(), false), field2("preserve_insertion_order", bool2(), false)]), false),
2797
+ field2("max_query_bytes", int642(), false)
2798
+ ]);
2799
+ var QueryEvaluationContextSchema = schema2([
2800
+ field2("timezone", utf82(), false),
2801
+ field2("collation", utf82(), false),
2802
+ field2("default_order", utf82(), false),
2803
+ field2("default_null_order", utf82(), false),
2804
+ field2("preserve_insertion_order", bool2(), false)
2805
+ ]);
2806
+ var QueryObjectReferenceSchema = schema2([
2807
+ field2("object", struct2([field2("kind", utf82(), false), field2("schema_path", list2(field2("item", utf82(), true)), false), field2("name", utf82(), false), field2("owner_table", utf82(), true)]), false),
2808
+ field2("expected_schema", binary2(), false)
2809
+ ]);
2810
+ var CatalogQueryPrepareRequestSchema = schema2([
2811
+ field2("attach_opaque_data", binary2(), false),
2812
+ field2("encoding", utf82(), false),
2813
+ field2("semantic_profile", utf82(), false),
2814
+ field2("mode", utf82(), false),
2815
+ field2("capability_revision", utf82(), false),
2816
+ field2("query", utf82(), false),
2817
+ field2("parameter_schema", binary2(), false),
2818
+ field2("evaluation_context", struct2([field2("timezone", utf82(), false), field2("collation", utf82(), false), field2("default_order", utf82(), false), field2("default_null_order", utf82(), false), field2("preserve_insertion_order", bool2(), false)]), false),
2819
+ field2("transaction_opaque_data", binary2(), true),
2820
+ field2("catalog_version", int642(), true),
2821
+ field2("catalog_etag", utf82(), true),
2822
+ field2("referenced_objects", list2(field2("item", struct2([field2("object", struct2([field2("kind", utf82(), false), field2("schema_path", list2(field2("item", utf82(), true)), false), field2("name", utf82(), false), field2("owner_table", utf82(), true)]), false), field2("expected_schema", binary2(), false)]), true)), false),
2823
+ field2("expected_output_schema", binary2(), true),
2824
+ field2("required_ordering", utf82(), false)
2825
+ ]);
2826
+ var CatalogQueryPrepareResultSchema = schema2([
2827
+ field2("status", utf82(), false),
2828
+ field2("reason_code", utf82(), true),
2829
+ field2("reason_detail", utf82(), true),
2830
+ field2("prepared_query_token", binary2(), true),
2831
+ field2("output_schema", binary2(), true),
2832
+ field2("result_ordering", utf82(), true),
2833
+ field2("validated_catalog_version", int642(), true),
2834
+ field2("validated_catalog_etag", utf82(), true),
2835
+ field2("context_digest", binary2(), true),
2836
+ field2("expires_at_epoch_ms", int642(), true),
2837
+ field2("estimated_rows", int642(), true),
2838
+ field2("estimated_bytes", int642(), true)
2839
+ ]);
2840
+ var CatalogCapabilitiesSchema = schema2([
2841
+ field2("read", list2(field2("item", utf82(), true)), false),
2842
+ field2("ddl", list2(field2("item", utf82(), true)), false),
2843
+ field2("write", list2(field2("item", utf82(), true)), false),
2844
+ field2("transaction", list2(field2("item", utf82(), true)), false)
2845
+ ]);
2846
+ var CatalogMetadataChangesSchema = schema2([
2847
+ field2("set_comment", bool2(), false),
2848
+ field2("comment", utf82(), true),
2849
+ field2("set_tags", map2(field2("key", utf82(), false), field2("value", utf82(), true), false), false),
2850
+ field2("remove_tags", list2(field2("item", utf82(), true)), false)
2851
+ ]);
2852
+ var CatalogObjectRefSchema = schema2([
2853
+ field2("kind", utf82(), false),
2854
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
2855
+ field2("name", utf82(), false),
2856
+ field2("owner_table", utf82(), true)
2857
+ ]);
2858
+ var ObjectDependencySchema = schema2([
2859
+ field2("dependent", binary2(), false),
2860
+ field2("subject", binary2(), false),
2861
+ field2("blocks_alter", bool2(), false),
2862
+ field2("kind", utf82(), false),
2863
+ field2("subject_column_paths", list2(field2("item", list2(field2("item", utf82(), true)), true)), true),
2864
+ field2("dependent_column_path", list2(field2("item", utf82(), true)), true)
2865
+ ]);
2866
+ var DependencySnapshotSchema = schema2([
2867
+ field2("catalog_version", int642(), false),
2868
+ field2("objects", list2(field2("item", binary2(), true)), false),
2869
+ field2("dependencies", list2(field2("item", binary2(), true)), false)
2870
+ ]);
2871
+ var OptionDefinitionsSchema = schema2([
2872
+ field2("schema", binary2(), false),
2873
+ field2("defaults", binary2(), false),
2874
+ field2("create_names", list2(field2("item", utf82(), true)), false),
2875
+ field2("alter_names", list2(field2("item", utf82(), true)), false)
2876
+ ]);
2877
+ var SqlExpressionSchema = schema2([
2878
+ field2("sql", utf82(), false),
2879
+ field2("profile", utf82(), false),
2880
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
2881
+ field2("evaluation_context", struct2([field2("timezone", utf82(), false), field2("collation", utf82(), false), field2("default_order", utf82(), false), field2("default_null_order", utf82(), false), field2("preserve_insertion_order", bool2(), false)]), false)
2882
+ ]);
2883
+ var SqlStatementSchema = schema2([
2884
+ field2("sql", utf82(), false),
2885
+ field2("profile", utf82(), false),
2886
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
2887
+ field2("evaluation_context", struct2([field2("timezone", utf82(), false), field2("collation", utf82(), false), field2("default_order", utf82(), false), field2("default_null_order", utf82(), false), field2("preserve_insertion_order", bool2(), false)]), false)
2888
+ ]);
2889
+ var ForeignKeyDefinitionSchema = schema2([
2890
+ field2("referenced_table", binary2(), false),
2891
+ field2("referenced_column_paths", list2(field2("item", list2(field2("item", utf82(), true)), true)), false),
2892
+ field2("match", dictionary2(utf82(), int162()), false),
2893
+ field2("on_update", dictionary2(utf82(), int162()), false),
2894
+ field2("on_delete", dictionary2(utf82(), int162()), false)
2895
+ ]);
2896
+ var ConstraintDefinitionSchema = schema2([
2897
+ field2("kind", dictionary2(utf82(), int162()), false),
2898
+ field2("column_paths", list2(field2("item", list2(field2("item", utf82(), true)), true)), false),
2899
+ field2("declared_name", utf82(), true),
2900
+ field2("check_expression", binary2(), true),
2901
+ field2("foreign_key", binary2(), true)
2902
+ ]);
2903
+ var ConstraintInfoSchema = schema2([
2904
+ field2("ref", binary2(), false),
2905
+ field2("definition", binary2(), false),
2906
+ field2("enforcement", dictionary2(utf82(), int162()), false),
2907
+ field2("validation", dictionary2(utf82(), int162()), false),
2908
+ field2("referenced_constraint", binary2(), true)
2909
+ ]);
2910
+ var ConstraintChangeSchema = schema2([
2911
+ field2("operation", dictionary2(utf82(), int162()), false),
2912
+ field2("ref", binary2(), true),
2913
+ field2("definition", binary2(), true),
2914
+ field2("enforcement", dictionary2(utf82(), int162()), true),
2915
+ field2("validation", dictionary2(utf82(), int162()), true),
2916
+ field2("cascade", bool2(), true),
2917
+ field2("declared_name", utf82(), true)
2918
+ ]);
2919
+ var ConstraintSnapshotSchema = schema2([
2920
+ field2("table", binary2(), false),
2921
+ field2("definition_revision", binary2(), false),
2922
+ field2("constraints", list2(field2("item", binary2(), true)), false)
2923
+ ]);
2924
+ var ConstraintsApplyRequestSchema = schema2([
2925
+ field2("attach_opaque_data", binary2(), false),
2926
+ field2("table", binary2(), false),
2927
+ field2("expected_revision", binary2(), false),
2928
+ field2("changes", list2(field2("item", binary2(), true)), false),
2929
+ field2("transaction_opaque_data", binary2(), true)
2930
+ ]);
2931
+ var IndexKeySchema = schema2([
2932
+ field2("column_path", list2(field2("item", utf82(), true)), true),
2933
+ field2("expression", binary2(), true)
2934
+ ]);
2935
+ var IndexDefinitionSchema = schema2([
2936
+ field2("table", binary2(), false),
2937
+ field2("algorithm", utf82(), false),
2938
+ field2("keys", list2(field2("item", binary2(), true)), false),
2939
+ field2("options", binary2(), false),
2940
+ field2("constraint_type", dictionary2(utf82(), int162()), false),
2941
+ field2("associated_constraint", binary2(), true)
2942
+ ]);
2943
+ var SortKeySchema = schema2([
2944
+ field2("expression", binary2(), false),
2945
+ field2("direction", dictionary2(utf82(), int162()), false),
2946
+ field2("null_order", dictionary2(utf82(), int162()), false)
2947
+ ]);
2948
+ var TableLayoutSchema = schema2([
2949
+ field2("partition_by", list2(field2("item", binary2(), true)), false),
2950
+ field2("sorted_by", list2(field2("item", binary2(), true)), false),
2951
+ field2("coverage", dictionary2(utf82(), int162()), false)
2952
+ ]);
2953
+ var TableLayoutChangeSchema = schema2([
2954
+ field2("mode", dictionary2(utf82(), int162()), false),
2955
+ field2("partition_by", list2(field2("item", binary2(), true)), true),
2956
+ field2("sorted_by", list2(field2("item", binary2(), true)), true)
2957
+ ]);
2958
+ var OptionChangesSchema = schema2([
2959
+ field2("set_values", binary2(), true),
2960
+ field2("reset_names", list2(field2("item", utf82(), true)), false)
2961
+ ]);
2962
+ var OptionStateSchema = schema2([
2963
+ field2("values", binary2(), false),
2964
+ field2("explicit_names", list2(field2("item", utf82(), true)), false)
2965
+ ]);
2966
+ var RequiredFilterPathsSchema = schema2([
2967
+ field2("groups", list2(field2("item", list2(field2("item", list2(field2("item", utf82(), true)), true)), true)), false)
2968
+ ]);
2743
2969
  var ScanFunctionResultSchema = schema2([
2744
2970
  field2("function_name", utf82(), false),
2745
2971
  field2("arguments", binary2(), false),
@@ -2942,7 +3168,9 @@ var ClientCapabilitiesSchema = schema2([
2942
3168
  field2("native_formats", list2(field2("item", utf82(), true)), false),
2943
3169
  field2("catalogs", list2(field2("item", utf82(), true)), false),
2944
3170
  field2("can_stream", bool2(), false),
2945
- field2("filter_encodings", list2(field2("item", utf82(), true)), false)
3171
+ field2("filter_encodings", list2(field2("item", utf82(), true)), false),
3172
+ field2("catalog", binary2(), true),
3173
+ field2("query_pushdown", struct2([field2("encodings", list2(field2("item", utf82(), true)), false), field2("semantic_profiles", list2(field2("item", utf82(), true)), false), field2("engine_version", utf82(), false), field2("max_query_bytes", int642(), false)]), true)
2946
3174
  ]);
2947
3175
  var CopyFromContextSchema = schema2([
2948
3176
  field2("format", utf82(), false),
@@ -2962,12 +3190,8 @@ var IndexCreateRequestSchema = schema2([
2962
3190
  field2("attach_opaque_data", binary2(), false),
2963
3191
  field2("schema_path", list2(field2("item", utf82(), true)), false),
2964
3192
  field2("name", utf82(), false),
2965
- field2("table_name", utf82(), false),
2966
- field2("index_type", utf82(), false),
2967
- field2("constraint_type", dictionary2(utf82(), int162()), false),
2968
- field2("expressions", list2(field2("item", utf82(), true)), false),
3193
+ field2("definition", binary2(), false),
2969
3194
  field2("on_conflict", dictionary2(utf82(), int162()), false),
2970
- field2("options", map2(field2("key", utf82(), false), field2("value", utf82(), true), false), false),
2971
3195
  field2("transaction_opaque_data", binary2(), true)
2972
3196
  ]);
2973
3197
  var InitRequestSchema = schema2([
@@ -2996,11 +3220,8 @@ var MacroCreateRequestSchema = schema2([
2996
3220
  field2("schema_path", list2(field2("item", utf82(), true)), false),
2997
3221
  field2("name", utf82(), false),
2998
3222
  field2("macro_type", dictionary2(utf82(), int162()), false),
2999
- field2("parameters", list2(field2("item", utf82(), true)), false),
3000
- field2("definition", utf82(), false),
3223
+ field2("overloads", list2(field2("item", struct2([field2("parameters", list2(field2("item", struct2([field2("name", utf82(), false), field2("declared_type", binary2(), true), field2("default_value", binary2(), true), field2("default_expression", binary2(), true), field2("documentation", utf82(), true)]), true)), false), field2("definition", utf82(), false), field2("profile", utf82(), false), field2("schema_path", list2(field2("item", utf82(), true)), false), field2("macro_type", utf82(), false), field2("evaluation_context", struct2([field2("timezone", utf82(), false), field2("collation", utf82(), false), field2("default_order", utf82(), false), field2("default_null_order", utf82(), false), field2("preserve_insertion_order", bool2(), false)]), false)]), true)), false),
3001
3224
  field2("on_conflict", dictionary2(utf82(), int162()), false),
3002
- field2("parameter_default_values", binary2(), true),
3003
- field2("arguments_schema", binary2(), true),
3004
3225
  field2("transaction_opaque_data", binary2(), true)
3005
3226
  ]);
3006
3227
  var TableCreateRequestSchema = schema2([
@@ -3009,12 +3230,12 @@ var TableCreateRequestSchema = schema2([
3009
3230
  field2("name", utf82(), false),
3010
3231
  field2("columns", binary2(), false),
3011
3232
  field2("on_conflict", dictionary2(utf82(), int162()), false),
3012
- field2("not_null_constraints", list2(field2("item", int322(), true)), false),
3013
- field2("unique_constraints", list2(field2("item", list2(field2("item", int322(), true)), true)), false),
3014
- field2("check_constraints", list2(field2("item", utf82(), true)), false),
3015
- field2("primary_key_constraints", list2(field2("item", list2(field2("item", int322(), true)), true)), false),
3016
- field2("foreign_key_constraints", list2(field2("item", binary2(), true)), false),
3017
- field2("transaction_opaque_data", binary2(), true)
3233
+ field2("constraint_definitions", list2(field2("item", binary2(), true)), false),
3234
+ field2("transaction_opaque_data", binary2(), true),
3235
+ field2("comment", utf82(), true),
3236
+ field2("tags", map2(field2("key", utf82(), false), field2("value", utf82(), true), false), true),
3237
+ field2("options", binary2(), true),
3238
+ field2("layout", binary2(), true)
3018
3239
  ]);
3019
3240
  var TableBufferingCombineRequestSchema = schema2([
3020
3241
  field2("function_name", utf82(), false),
@@ -3071,6 +3292,12 @@ var TableFunctionPlanRequestSchema = schema2([
3071
3292
  field2("tablesample_percentage", float642(), true),
3072
3293
  field2("tablesample_seed", int642(), true)
3073
3294
  ]);
3295
+ var TableFunctionProjectionRequestSchema = schema2([
3296
+ field2("bind_call", binary2(), false),
3297
+ field2("bind_result", binary2(), false),
3298
+ field2("expressions", list2(field2("item", largeBinary2(), true)), false),
3299
+ field2("result_schema", binary2(), false)
3300
+ ]);
3074
3301
  var TableFunctionStatisticsRequestSchema = schema2([
3075
3302
  field2("bind_call", binary2(), false),
3076
3303
  field2("bind_opaque_data", binary2(), true)
@@ -3105,7 +3332,9 @@ var BindResultSchema = schema2([
3105
3332
  field2("opaque_data", binary2(), true),
3106
3333
  field2("lookup_secret_types", list2(field2("item", utf82(), true)), false),
3107
3334
  field2("lookup_scopes", list2(field2("item", utf82(), true)), false),
3108
- field2("lookup_names", list2(field2("item", utf82(), true)), false)
3335
+ field2("lookup_names", list2(field2("item", utf82(), true)), false),
3336
+ field2("projection_expression_profiles", list2(field2("item", utf82(), true)), false),
3337
+ field2("repeatability", dictionary2(utf82(), int162()), false)
3109
3338
  ]);
3110
3339
  var CatalogAttachResultSchema = schema2([
3111
3340
  field2("attach_opaque_data", binary2(), false),
@@ -3114,7 +3343,7 @@ var CatalogAttachResultSchema = schema2([
3114
3343
  field2("catalog_version_frozen", bool2(), false),
3115
3344
  field2("catalog_version", int642(), false),
3116
3345
  field2("attach_opaque_data_required", bool2(), false),
3117
- field2("default_schema", utf82(), false),
3346
+ field2("default_schema", utf82(), true),
3118
3347
  field2("settings", list2(field2("item", binary2(), true)), false),
3119
3348
  field2("secret_types", list2(field2("item", binary2(), true)), false),
3120
3349
  field2("attach_catalogs", list2(field2("item", binary2(), true)), false),
@@ -3125,7 +3354,10 @@ var CatalogAttachResultSchema = schema2([
3125
3354
  field2("global_function_prefix", utf82(), false),
3126
3355
  field2("resolved_data_version", utf82(), true),
3127
3356
  field2("resolved_implementation_version", utf82(), true),
3128
- field2("supports_catalog_contents", bool2(), false)
3357
+ field2("supports_catalog_contents", bool2(), false),
3358
+ field2("catalog_capabilities", binary2(), true),
3359
+ field2("selected_capabilities", binary2(), true),
3360
+ field2("query_pushdown", struct2([field2("encoding", utf82(), false), field2("semantic_profiles", list2(field2("item", utf82(), true)), false), field2("execution_modes", list2(field2("item", utf82(), true)), false), field2("backend_engine", utf82(), false), field2("backend_version", utf82(), false), field2("capability_revision", utf82(), false), field2("default_evaluation_context", struct2([field2("timezone", utf82(), false), field2("collation", utf82(), false), field2("default_order", utf82(), false), field2("default_null_order", utf82(), false), field2("preserve_insertion_order", bool2(), false)]), false), field2("max_query_bytes", int642(), false)]), true)
3129
3361
  ]);
3130
3362
  var CatalogCatalogsResultSchema = schema2([
3131
3363
  field2("items", list2(field2("item", binary2(), true)), false)
@@ -3144,9 +3376,20 @@ var CatalogContentsResultSchema = schema2([
3144
3376
  var CatalogCopyFromFormatsResultSchema = schema2([
3145
3377
  field2("items", list2(field2("item", binary2(), true)), false)
3146
3378
  ]);
3379
+ var CatalogDependenciesResultSchema = schema2([
3380
+ field2("catalog_version", int642(), false),
3381
+ field2("objects", list2(field2("item", binary2(), true)), false),
3382
+ field2("dependencies", list2(field2("item", binary2(), true)), false)
3383
+ ]);
3147
3384
  var CatalogIndexGetResultSchema = schema2([
3148
3385
  field2("items", list2(field2("item", binary2(), true)), false)
3149
3386
  ]);
3387
+ var CatalogIndexOptionDefinitionsResultSchema = schema2([
3388
+ field2("schema", binary2(), false),
3389
+ field2("defaults", binary2(), false),
3390
+ field2("create_names", list2(field2("item", utf82(), true)), false),
3391
+ field2("alter_names", list2(field2("item", utf82(), true)), false)
3392
+ ]);
3150
3393
  var CatalogMacroGetResultSchema = schema2([
3151
3394
  field2("items", list2(field2("item", binary2(), true)), false)
3152
3395
  ]);
@@ -3168,12 +3411,29 @@ var CatalogSchemaContentsViewsResultSchema = schema2([
3168
3411
  var CatalogSchemaGetResultSchema = schema2([
3169
3412
  field2("items", list2(field2("item", binary2(), true)), false)
3170
3413
  ]);
3414
+ var CatalogSchemaOptionDefinitionsResultSchema = schema2([
3415
+ field2("schema", binary2(), false),
3416
+ field2("defaults", binary2(), false),
3417
+ field2("create_names", list2(field2("item", utf82(), true)), false),
3418
+ field2("alter_names", list2(field2("item", utf82(), true)), false)
3419
+ ]);
3171
3420
  var CatalogSchemasResultSchema = schema2([
3172
3421
  field2("items", list2(field2("item", binary2(), true)), false)
3173
3422
  ]);
3423
+ var CatalogTableConstraintsApplyResultSchema = schema2([
3424
+ field2("table", binary2(), false),
3425
+ field2("definition_revision", binary2(), false),
3426
+ field2("constraints", list2(field2("item", binary2(), true)), false)
3427
+ ]);
3174
3428
  var CatalogTableGetResultSchema = schema2([
3175
3429
  field2("items", list2(field2("item", binary2(), true)), false)
3176
3430
  ]);
3431
+ var CatalogTableOptionDefinitionsResultSchema = schema2([
3432
+ field2("schema", binary2(), false),
3433
+ field2("defaults", binary2(), false),
3434
+ field2("create_names", list2(field2("item", utf82(), true)), false),
3435
+ field2("alter_names", list2(field2("item", utf82(), true)), false)
3436
+ ]);
3177
3437
  var CatalogTransactionBeginResultSchema = schema2([
3178
3438
  field2("transaction_opaque_data", binary2(), true)
3179
3439
  ]);
@@ -3216,6 +3476,10 @@ var TableFunctionPlanResultSchema = schema2([
3216
3476
  field2("start_position", binary2(), true),
3217
3477
  field2("end_position", binary2(), true)
3218
3478
  ]);
3479
+ var TableFunctionProjectionResultSchema = schema2([
3480
+ field2("accepted_indices", list2(field2("item", int642(), true)), false),
3481
+ field2("bind_result", binary2(), true)
3482
+ ]);
3219
3483
  var AggregateBindParamsSchema = schema2([
3220
3484
  field2("request", binary2(), false)
3221
3485
  ]);
@@ -3270,6 +3534,10 @@ var CatalogCopyFromFormatsParamsSchema = schema2([
3270
3534
  var CatalogCreateParamsSchema = schema2([
3271
3535
  field2("request", binary2(), false)
3272
3536
  ]);
3537
+ var CatalogDependenciesParamsSchema = schema2([
3538
+ field2("attach_opaque_data", binary2(), false),
3539
+ field2("transaction_opaque_data", binary2(), true)
3540
+ ]);
3273
3541
  var CatalogDetachParamsSchema = schema2([
3274
3542
  field2("attach_opaque_data", binary2(), false)
3275
3543
  ]);
@@ -3293,6 +3561,12 @@ var CatalogIndexGetParamsSchema = schema2([
3293
3561
  field2("name", utf82(), false),
3294
3562
  field2("transaction_opaque_data", binary2(), true)
3295
3563
  ]);
3564
+ var CatalogIndexOptionDefinitionsParamsSchema = schema2([
3565
+ field2("attach_opaque_data", binary2(), false),
3566
+ field2("table", binary2(), false),
3567
+ field2("algorithm", utf82(), false),
3568
+ field2("transaction_opaque_data", binary2(), true)
3569
+ ]);
3296
3570
  var CatalogMacroCreateParamsSchema = schema2([
3297
3571
  field2("request", binary2(), false)
3298
3572
  ]);
@@ -3309,6 +3583,27 @@ var CatalogMacroGetParamsSchema = schema2([
3309
3583
  field2("name", utf82(), false),
3310
3584
  field2("transaction_opaque_data", binary2(), true)
3311
3585
  ]);
3586
+ var CatalogQueryPrepareParamsSchema = schema2([
3587
+ field2("request", binary2(), false)
3588
+ ]);
3589
+ var CatalogQueryReleaseParamsSchema = schema2([
3590
+ field2("attach_opaque_data", binary2(), false),
3591
+ field2("prepared_query_token", binary2(), false),
3592
+ field2("transaction_opaque_data", binary2(), true)
3593
+ ]);
3594
+ var CatalogSchemaAlterMetadataParamsSchema = schema2([
3595
+ field2("attach_opaque_data", binary2(), false),
3596
+ field2("path", list2(field2("item", utf82(), true)), false),
3597
+ field2("changes", binary2(), false),
3598
+ field2("ignore_not_found", bool2(), false),
3599
+ field2("transaction_opaque_data", binary2(), true)
3600
+ ]);
3601
+ var CatalogSchemaAlterOptionsParamsSchema = schema2([
3602
+ field2("attach_opaque_data", binary2(), false),
3603
+ field2("path", list2(field2("item", utf82(), true)), false),
3604
+ field2("changes", binary2(), false),
3605
+ field2("transaction_opaque_data", binary2(), true)
3606
+ ]);
3312
3607
  var CatalogSchemaContentsFunctionsParamsSchema = schema2([
3313
3608
  field2("attach_opaque_data", binary2(), false),
3314
3609
  field2("path", list2(field2("item", utf82(), true)), false),
@@ -3342,7 +3637,8 @@ var CatalogSchemaCreateParamsSchema = schema2([
3342
3637
  field2("on_conflict", dictionary2(utf82(), int162()), false),
3343
3638
  field2("comment", utf82(), true),
3344
3639
  field2("tags", map2(field2("key", utf82(), false), field2("value", utf82(), true), false), true),
3345
- field2("transaction_opaque_data", binary2(), true)
3640
+ field2("transaction_opaque_data", binary2(), true),
3641
+ field2("options", binary2(), true)
3346
3642
  ]);
3347
3643
  var CatalogSchemaDropParamsSchema = schema2([
3348
3644
  field2("attach_opaque_data", binary2(), false),
@@ -3356,14 +3652,34 @@ var CatalogSchemaGetParamsSchema = schema2([
3356
3652
  field2("path", list2(field2("item", utf82(), true)), false),
3357
3653
  field2("transaction_opaque_data", binary2(), true)
3358
3654
  ]);
3655
+ var CatalogSchemaOptionDefinitionsParamsSchema = schema2([
3656
+ field2("attach_opaque_data", binary2(), false),
3657
+ field2("path", list2(field2("item", utf82(), true)), false),
3658
+ field2("transaction_opaque_data", binary2(), true)
3659
+ ]);
3359
3660
  var CatalogSchemasParamsSchema = schema2([
3360
3661
  field2("attach_opaque_data", binary2(), false),
3361
3662
  field2("transaction_opaque_data", binary2(), true)
3362
3663
  ]);
3664
+ var CatalogTableAlterLayoutParamsSchema = schema2([
3665
+ field2("attach_opaque_data", binary2(), false),
3666
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
3667
+ field2("name", utf82(), false),
3668
+ field2("changes", binary2(), false),
3669
+ field2("transaction_opaque_data", binary2(), true)
3670
+ ]);
3671
+ var CatalogTableAlterOptionsParamsSchema = schema2([
3672
+ field2("attach_opaque_data", binary2(), false),
3673
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
3674
+ field2("name", utf82(), false),
3675
+ field2("changes", binary2(), false),
3676
+ field2("transaction_opaque_data", binary2(), true)
3677
+ ]);
3363
3678
  var CatalogTableColumnAddParamsSchema = schema2([
3364
3679
  field2("attach_opaque_data", binary2(), false),
3365
3680
  field2("schema_path", list2(field2("item", utf82(), true)), false),
3366
3681
  field2("name", utf82(), false),
3682
+ field2("column_path", list2(field2("item", utf82(), true)), false),
3367
3683
  field2("column_definition", binary2(), false),
3368
3684
  field2("ignore_not_found", bool2(), false),
3369
3685
  field2("if_column_not_exists", bool2(), false),
@@ -3373,7 +3689,7 @@ var CatalogTableColumnCommentSetParamsSchema = schema2([
3373
3689
  field2("attach_opaque_data", binary2(), false),
3374
3690
  field2("schema_path", list2(field2("item", utf82(), true)), false),
3375
3691
  field2("name", utf82(), false),
3376
- field2("column_name", utf82(), false),
3692
+ field2("column_path", list2(field2("item", utf82(), true)), false),
3377
3693
  field2("comment", utf82(), true),
3378
3694
  field2("ignore_not_found", bool2(), false),
3379
3695
  field2("transaction_opaque_data", binary2(), true)
@@ -3382,7 +3698,7 @@ var CatalogTableColumnDefaultDropParamsSchema = schema2([
3382
3698
  field2("attach_opaque_data", binary2(), false),
3383
3699
  field2("schema_path", list2(field2("item", utf82(), true)), false),
3384
3700
  field2("name", utf82(), false),
3385
- field2("column_name", utf82(), false),
3701
+ field2("column_path", list2(field2("item", utf82(), true)), false),
3386
3702
  field2("ignore_not_found", bool2(), false),
3387
3703
  field2("transaction_opaque_data", binary2(), true)
3388
3704
  ]);
@@ -3390,8 +3706,8 @@ var CatalogTableColumnDefaultSetParamsSchema = schema2([
3390
3706
  field2("attach_opaque_data", binary2(), false),
3391
3707
  field2("schema_path", list2(field2("item", utf82(), true)), false),
3392
3708
  field2("name", utf82(), false),
3393
- field2("column_name", utf82(), false),
3394
- field2("expression", utf82(), false),
3709
+ field2("column_path", list2(field2("item", utf82(), true)), false),
3710
+ field2("expression", binary2(), false),
3395
3711
  field2("ignore_not_found", bool2(), false),
3396
3712
  field2("transaction_opaque_data", binary2(), true)
3397
3713
  ]);
@@ -3399,7 +3715,7 @@ var CatalogTableColumnDropParamsSchema = schema2([
3399
3715
  field2("attach_opaque_data", binary2(), false),
3400
3716
  field2("schema_path", list2(field2("item", utf82(), true)), false),
3401
3717
  field2("name", utf82(), false),
3402
- field2("column_name", utf82(), false),
3718
+ field2("column_path", list2(field2("item", utf82(), true)), false),
3403
3719
  field2("ignore_not_found", bool2(), false),
3404
3720
  field2("if_column_exists", bool2(), false),
3405
3721
  field2("cascade", bool2(), false),
@@ -3409,7 +3725,7 @@ var CatalogTableColumnRenameParamsSchema = schema2([
3409
3725
  field2("attach_opaque_data", binary2(), false),
3410
3726
  field2("schema_path", list2(field2("item", utf82(), true)), false),
3411
3727
  field2("name", utf82(), false),
3412
- field2("column_name", utf82(), false),
3728
+ field2("column_path", list2(field2("item", utf82(), true)), false),
3413
3729
  field2("new_column_name", utf82(), false),
3414
3730
  field2("ignore_not_found", bool2(), false),
3415
3731
  field2("transaction_opaque_data", binary2(), true)
@@ -3424,8 +3740,9 @@ var CatalogTableColumnTypeChangeParamsSchema = schema2([
3424
3740
  field2("attach_opaque_data", binary2(), false),
3425
3741
  field2("schema_path", list2(field2("item", utf82(), true)), false),
3426
3742
  field2("name", utf82(), false),
3743
+ field2("column_path", list2(field2("item", utf82(), true)), false),
3427
3744
  field2("column_definition", binary2(), false),
3428
- field2("expression", utf82(), true),
3745
+ field2("expression", binary2(), true),
3429
3746
  field2("ignore_not_found", bool2(), false),
3430
3747
  field2("transaction_opaque_data", binary2(), true)
3431
3748
  ]);
@@ -3437,6 +3754,9 @@ var CatalogTableCommentSetParamsSchema = schema2([
3437
3754
  field2("ignore_not_found", bool2(), false),
3438
3755
  field2("transaction_opaque_data", binary2(), true)
3439
3756
  ]);
3757
+ var CatalogTableConstraintsApplyParamsSchema = schema2([
3758
+ field2("request", binary2(), false)
3759
+ ]);
3440
3760
  var CatalogTableCreateParamsSchema = schema2([
3441
3761
  field2("request", binary2(), false)
3442
3762
  ]);
@@ -3473,7 +3793,7 @@ var CatalogTableNotNullDropParamsSchema = schema2([
3473
3793
  field2("attach_opaque_data", binary2(), false),
3474
3794
  field2("schema_path", list2(field2("item", utf82(), true)), false),
3475
3795
  field2("name", utf82(), false),
3476
- field2("column_name", utf82(), false),
3796
+ field2("column_path", list2(field2("item", utf82(), true)), false),
3477
3797
  field2("ignore_not_found", bool2(), false),
3478
3798
  field2("transaction_opaque_data", binary2(), true)
3479
3799
  ]);
@@ -3481,10 +3801,16 @@ var CatalogTableNotNullSetParamsSchema = schema2([
3481
3801
  field2("attach_opaque_data", binary2(), false),
3482
3802
  field2("schema_path", list2(field2("item", utf82(), true)), false),
3483
3803
  field2("name", utf82(), false),
3484
- field2("column_name", utf82(), false),
3804
+ field2("column_path", list2(field2("item", utf82(), true)), false),
3485
3805
  field2("ignore_not_found", bool2(), false),
3486
3806
  field2("transaction_opaque_data", binary2(), true)
3487
3807
  ]);
3808
+ var CatalogTableOptionDefinitionsParamsSchema = schema2([
3809
+ field2("attach_opaque_data", binary2(), false),
3810
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
3811
+ field2("name", utf82(), false),
3812
+ field2("transaction_opaque_data", binary2(), true)
3813
+ ]);
3488
3814
  var CatalogTableRenameParamsSchema = schema2([
3489
3815
  field2("attach_opaque_data", binary2(), false),
3490
3816
  field2("schema_path", list2(field2("item", utf82(), true)), false),
@@ -3530,6 +3856,15 @@ var CatalogVersionParamsSchema = schema2([
3530
3856
  field2("attach_opaque_data", binary2(), false),
3531
3857
  field2("transaction_opaque_data", binary2(), true)
3532
3858
  ]);
3859
+ var CatalogViewColumnCommentSetParamsSchema = schema2([
3860
+ field2("attach_opaque_data", binary2(), false),
3861
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
3862
+ field2("name", utf82(), false),
3863
+ field2("column_path", list2(field2("item", utf82(), true)), false),
3864
+ field2("comment", utf82(), true),
3865
+ field2("ignore_not_found", bool2(), false),
3866
+ field2("transaction_opaque_data", binary2(), true)
3867
+ ]);
3533
3868
  var CatalogViewCommentSetParamsSchema = schema2([
3534
3869
  field2("attach_opaque_data", binary2(), false),
3535
3870
  field2("schema_path", list2(field2("item", utf82(), true)), false),
@@ -3544,7 +3879,12 @@ var CatalogViewCreateParamsSchema = schema2([
3544
3879
  field2("name", utf82(), false),
3545
3880
  field2("definition", utf82(), false),
3546
3881
  field2("on_conflict", dictionary2(utf82(), int162()), false),
3547
- field2("transaction_opaque_data", binary2(), true)
3882
+ field2("transaction_opaque_data", binary2(), true),
3883
+ field2("aliases", list2(field2("item", utf82(), true)), true),
3884
+ field2("security", utf82(), false),
3885
+ field2("comment", utf82(), true),
3886
+ field2("tags", map2(field2("key", utf82(), false), field2("value", utf82(), true), false), true),
3887
+ field2("column_comments", map2(field2("key", utf82(), false), field2("value", utf82(), true), false), true)
3548
3888
  ]);
3549
3889
  var CatalogViewDropParamsSchema = schema2([
3550
3890
  field2("attach_opaque_data", binary2(), false),
@@ -3589,11 +3929,15 @@ var TableFunctionDynamicToStringParamsSchema = schema2([
3589
3929
  var TableFunctionPlanParamsSchema = schema2([
3590
3930
  field2("request", binary2(), false)
3591
3931
  ]);
3932
+ var TableFunctionProjectionParamsSchema = schema2([
3933
+ field2("request", binary2(), false)
3934
+ ]);
3592
3935
  var TableFunctionStatisticsParamsSchema = schema2([
3593
3936
  field2("request", binary2(), false)
3594
3937
  ]);
3595
3938
 
3596
3939
  // src/generated/vgi-protocol-types.ts
3940
+ var decodeSqlExpression = (b) => decodeASD(SqlExpressionSchema, b);
3597
3941
  var decodeCatalogContentsResponse = (b) => decodeASD(CatalogContentsResultSchema, b);
3598
3942
 
3599
3943
  // src/generated/vgi-client.ts
@@ -3758,6 +4102,292 @@ function wrapRpcWithErrorEnrichment(rpc) {
3758
4102
  };
3759
4103
  }
3760
4104
 
4105
+ // src/catalog/column-expressions.ts
4106
+ var GENERATED_EXPRESSION_KEY = "vgi.column.generated.v1";
4107
+ var GENERATION_KEY = "vgi.column.generation.v1";
4108
+ var PROFILE = "vgi.expression.duckdb.scalar.v1";
4109
+ var MAX_BYTES = 8 * 1024 * 1024;
4110
+ var base64 = (bytes) => btoa(Array.from(bytes, (value) => String.fromCharCode(value)).join(""));
4111
+ function text(value, maximum) {
4112
+ if (typeof value !== "string" || !value || value.includes("\x00") || new TextEncoder().encode(value).length > maximum)
4113
+ throw new Error("invalid generated expression text");
4114
+ for (let i = 0;i < value.length; i++) {
4115
+ const c = value.charCodeAt(i);
4116
+ if (c >= 55296 && c <= 56319) {
4117
+ const d = value.charCodeAt(++i);
4118
+ if (!(d >= 56320 && d <= 57343))
4119
+ throw new Error("invalid generated expression Unicode");
4120
+ } else if (c >= 56320 && c <= 57343)
4121
+ throw new Error("invalid generated expression Unicode");
4122
+ }
4123
+ }
4124
+ function expression(value, owner) {
4125
+ text(value.sql, 1024 * 1024);
4126
+ if (!value.sql.trim() || value.profile !== PROFILE)
4127
+ throw new Error("unsupported generated expression profile or empty SQL");
4128
+ if (!Array.isArray(value.schema_path) || value.schema_path.length > 32)
4129
+ throw new Error("invalid generated expression owner");
4130
+ value.schema_path.forEach((part) => text(part, 4096));
4131
+ if (JSON.stringify(value.schema_path) !== JSON.stringify(owner))
4132
+ throw new Error("generated expression owner differs from table schema");
4133
+ const context = value.evaluation_context;
4134
+ if (!context)
4135
+ throw new Error("generated expression requires explicit evaluation context");
4136
+ text(context.timezone, 256);
4137
+ text(context.collation, 256);
4138
+ if (!["asc", "desc"].includes(context.default_order) || ![
4139
+ "nulls_first",
4140
+ "nulls_last",
4141
+ "nulls_first_on_asc_last_on_desc",
4142
+ "nulls_last_on_asc_first_on_desc"
4143
+ ].includes(context.default_null_order) || typeof context.preserve_insertion_order !== "boolean")
4144
+ throw new Error("invalid generated expression evaluation context");
4145
+ }
4146
+ function envelope(bytes) {
4147
+ if (!bytes.length || bytes.length > MAX_BYTES)
4148
+ throw new Error("invalid generated expression size");
4149
+ const data = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
4150
+ const kinds = [];
4151
+ const textBuffers = [];
4152
+ let offset = 0;
4153
+ while (offset < bytes.length) {
4154
+ const prefix = data.getInt32(offset, true) === -1 ? 8 : 4;
4155
+ const length = data.getInt32(offset + prefix - 4, true);
4156
+ offset += prefix;
4157
+ if (!length) {
4158
+ if (offset !== bytes.length || kinds.join(",") !== "1,3")
4159
+ throw new Error("SqlExpression requires exactly one complete IPC batch");
4160
+ return textBuffers;
4161
+ }
4162
+ if (length < 0 || offset + length > bytes.length)
4163
+ throw new Error("invalid expression IPC length");
4164
+ const p = offset + data.getUint32(offset, true), v = p - data.getInt32(p, true);
4165
+ const slot = (id) => 4 + id * 2 < data.getUint16(v, true) ? data.getUint16(v + 4 + id * 2, true) : 0;
4166
+ const kind = slot(1), body = slot(3);
4167
+ if (!kind)
4168
+ throw new Error("invalid expression IPC message");
4169
+ kinds.push(data.getUint8(p + kind));
4170
+ const bodyLength = body ? Number(data.getBigInt64(p + body, true)) : 0;
4171
+ if (bodyLength < 0 || bodyLength > bytes.length - offset - length)
4172
+ throw new Error("invalid expression IPC body");
4173
+ if (data.getUint8(p + kind) === 3) {
4174
+ const headerSlot = slot(2);
4175
+ const record = p + headerSlot + data.getUint32(p + headerSlot, true);
4176
+ const table = record - data.getInt32(record, true);
4177
+ const recordSlot = (id) => 4 + id * 2 < data.getUint16(table, true) ? data.getUint16(table + 4 + id * 2, true) : 0;
4178
+ if (recordSlot(3))
4179
+ throw new Error("compressed expression IPC is unsupported");
4180
+ const bufferSlot = recordSlot(2);
4181
+ const buffers = record + bufferSlot + data.getUint32(record + bufferSlot, true);
4182
+ if (data.getUint32(buffers, true) !== 26)
4183
+ throw new Error("invalid SqlExpression buffer layout");
4184
+ for (const index of [2, 5, 10, 14, 17, 20, 23]) {
4185
+ const buffer = buffers + 4 + index * 16;
4186
+ const start = Number(data.getBigInt64(buffer, true));
4187
+ const size = Number(data.getBigInt64(buffer + 8, true));
4188
+ if (start < 0 || size < 0 || start + size > bodyLength)
4189
+ throw new Error("invalid expression string buffer");
4190
+ textBuffers.push(bytes.subarray(offset + length + start, offset + length + start + size));
4191
+ }
4192
+ }
4193
+ offset += length + bodyLength;
4194
+ }
4195
+ throw new Error("expression IPC lacks end marker");
4196
+ }
4197
+ function shape(schema) {
4198
+ const field = (f) => [
4199
+ f.name,
4200
+ f.nullable,
4201
+ String(f.type),
4202
+ (f.type.children ?? []).map(field)
4203
+ ];
4204
+ return JSON.stringify(schema.fields.map(field));
4205
+ }
4206
+ function validateEncoded(encoded, owner) {
4207
+ if (!encoded.length || encoded.length > 4 * Math.ceil(MAX_BYTES / 3))
4208
+ throw new Error("invalid generated expression size");
4209
+ const bytes = Uint8Array.from(atob(encoded), (c) => c.charCodeAt(0));
4210
+ if (base64(bytes) !== encoded)
4211
+ throw new Error("generated expression requires canonical base64");
4212
+ const textBuffers = envelope(bytes);
4213
+ const batch = deserializeBatch(bytes);
4214
+ if (batch.numRows !== 1 || shape(batch.schema) !== shape(SqlExpressionSchema))
4215
+ throw new Error("invalid SqlExpression record schema");
4216
+ const utf8 = new TextDecoder("utf-8", { fatal: true });
4217
+ textBuffers.forEach((buffer) => utf8.decode(buffer));
4218
+ expression(decodeSqlExpression(bytes), owner);
4219
+ }
4220
+ function validateColumnExpressions(schema, owner, allowGenerated = true) {
4221
+ const type = (t) => {
4222
+ for (const f of t?.children ?? t?.fields ?? [])
4223
+ field(f);
4224
+ if (t?.dictionary)
4225
+ type(t.dictionary);
4226
+ };
4227
+ const field = (f) => {
4228
+ const metadata = f.metadata ?? new Map;
4229
+ for (const key of metadata.keys()) {
4230
+ if (key.startsWith("vgi.column.generated.") && key !== GENERATED_EXPRESSION_KEY || key.startsWith("vgi.column.generation.") && key !== GENERATION_KEY)
4231
+ throw new Error("unknown generated metadata version");
4232
+ }
4233
+ if (metadata.has("generated_expression"))
4234
+ throw new Error("legacy generated expression requires explicit canonical translation");
4235
+ if (metadata.has(GENERATED_EXPRESSION_KEY) !== metadata.has(GENERATION_KEY))
4236
+ throw new Error("generated expression and category must occur together");
4237
+ if (metadata.has(GENERATED_EXPRESSION_KEY)) {
4238
+ if (metadata.get(GENERATION_KEY) !== "virtual")
4239
+ throw new Error("only VIRTUAL generated columns are supported");
4240
+ if (metadata.has("default") || metadata.has("vgi.column.default.v1"))
4241
+ throw new Error("generated column cannot have a default");
4242
+ validateEncoded(metadata.get(GENERATED_EXPRESSION_KEY), owner);
4243
+ if (!allowGenerated)
4244
+ throw new Error("generated columns unsupported by this catalog");
4245
+ }
4246
+ type(f.type);
4247
+ };
4248
+ schema.fields.forEach(field);
4249
+ }
4250
+ function validateColumnExpressionsIpc(bytes, owner, allowGenerated = true) {
4251
+ validateColumnExpressions(deserializeSchema(bytes), owner, allowGenerated);
4252
+ }
4253
+
4254
+ // src/catalog/column-metadata.ts
4255
+ function scalarText(value) {
4256
+ for (let i = 0;i < value.length; i++) {
4257
+ const c = value.charCodeAt(i);
4258
+ if (c >= 55296 && c <= 56319) {
4259
+ const d = value.charCodeAt(++i);
4260
+ if (!(d >= 56320 && d <= 57343))
4261
+ throw new Error("column metadata contains an unpaired surrogate");
4262
+ } else if (c >= 56320 && c <= 57343)
4263
+ throw new Error("column metadata contains an unpaired surrogate");
4264
+ }
4265
+ }
4266
+ function tags(value) {
4267
+ let i = 0;
4268
+ const ws = () => {
4269
+ while (i < value.length && /[ \t\r\n]/.test(value[i]))
4270
+ i++;
4271
+ };
4272
+ const str = () => {
4273
+ ws();
4274
+ const start = i;
4275
+ if (value[i++] !== '"')
4276
+ throw new Error("column tags require string keys and values");
4277
+ while (i < value.length) {
4278
+ const c = value[i++];
4279
+ if (c === "\\") {
4280
+ i++;
4281
+ continue;
4282
+ }
4283
+ if (c === '"') {
4284
+ const result = JSON.parse(value.slice(start, i));
4285
+ scalarText(result);
4286
+ return result;
4287
+ }
4288
+ }
4289
+ throw new Error("unterminated column tag string");
4290
+ };
4291
+ ws();
4292
+ if (value[i++] !== "{")
4293
+ throw new Error("column tags must be a JSON object");
4294
+ ws();
4295
+ const seen = new Set;
4296
+ if (value[i] !== "}")
4297
+ for (;; ) {
4298
+ const key = str();
4299
+ if (seen.has(key))
4300
+ throw new Error("duplicate column tag key");
4301
+ seen.add(key);
4302
+ ws();
4303
+ if (value[i++] !== ":")
4304
+ throw new Error("invalid column tags JSON");
4305
+ str();
4306
+ ws();
4307
+ if (value[i] !== ",")
4308
+ break;
4309
+ i++;
4310
+ }
4311
+ if (value[i++] !== "}")
4312
+ throw new Error("invalid column tags JSON");
4313
+ ws();
4314
+ if (i !== value.length)
4315
+ throw new Error("trailing column tags JSON");
4316
+ }
4317
+ function entry(key, value) {
4318
+ if (key === "comment" || key === "tags") {
4319
+ scalarText(value);
4320
+ if (key === "tags")
4321
+ tags(value);
4322
+ }
4323
+ }
4324
+ function validateColumnMetadataIpc(bytes) {
4325
+ const input = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
4326
+ const prefix = input.getInt32(0, true) === -1 ? 8 : 4;
4327
+ const size = input.getInt32(prefix - 4, true);
4328
+ if (size <= 0 || prefix + size > bytes.length)
4329
+ throw new Error("invalid column schema IPC");
4330
+ const raw = bytes.subarray(prefix, prefix + size);
4331
+ const view = new DataView(raw.buffer, raw.byteOffset, raw.byteLength);
4332
+ const u32 = (p) => view.getUint32(p, true), i32 = (p) => view.getInt32(p, true), u16 = (p) => view.getUint16(p, true);
4333
+ const slot = (p, id) => {
4334
+ const v = p - i32(p), o = 4 + id * 2;
4335
+ return o < u16(v) ? u16(v + o) : 0;
4336
+ };
4337
+ const ref = (p, id) => {
4338
+ const o = slot(p, id);
4339
+ return o ? p + o + u32(p + o) : 0;
4340
+ };
4341
+ const vector = (p, id, fn) => {
4342
+ const v = ref(p, id);
4343
+ if (!v)
4344
+ return;
4345
+ const n = u32(v);
4346
+ if (n > (raw.length - v - 4) / 4)
4347
+ throw new Error("invalid column metadata vector");
4348
+ for (let j = 0;j < n; j++) {
4349
+ const q = v + 4 + j * 4;
4350
+ fn(q + u32(q));
4351
+ }
4352
+ };
4353
+ const text = (p, id) => {
4354
+ const v = ref(p, id);
4355
+ if (!v)
4356
+ return "";
4357
+ const n = u32(v);
4358
+ if (v + 4 + n > raw.length)
4359
+ throw new Error("invalid column metadata string");
4360
+ return new TextDecoder("utf-8", { fatal: true }).decode(raw.subarray(v + 4, v + 4 + n));
4361
+ };
4362
+ const field = (p, depth) => {
4363
+ if (depth > 64)
4364
+ throw new Error("column metadata nesting too deep");
4365
+ const seen = new Set;
4366
+ vector(p, 6, (m) => {
4367
+ const k = text(m, 0);
4368
+ if (seen.has(k))
4369
+ throw new Error("duplicate column metadata key");
4370
+ seen.add(k);
4371
+ if (k === "comment" || k === "tags")
4372
+ entry(k, text(m, 1));
4373
+ });
4374
+ vector(p, 5, (c) => field(c, depth + 1));
4375
+ };
4376
+ const message = u32(0), kind = slot(message, 1);
4377
+ if (!kind || view.getUint8(message + kind) !== 1)
4378
+ throw new Error("expected column schema message");
4379
+ const schema = ref(message, 2);
4380
+ if (!schema)
4381
+ throw new Error("missing column schema");
4382
+ vector(schema, 1, (f) => field(f, 0));
4383
+ }
4384
+ function validateTableInfoColumns(info) {
4385
+ if (info.columns.length) {
4386
+ validateColumnMetadataIpc(info.columns);
4387
+ validateColumnExpressionsIpc(info.columns, info.schema_path);
4388
+ }
4389
+ }
4390
+
3761
4391
  // src/catalog/contents-codec.ts
3762
4392
  var schemaPathKey = (path) => JSON.stringify(path.map((part) => part.toLowerCase()));
3763
4393
  var CATALOG_STREAM_KINDS = ["schemas", "tables", "views", "functions", "macros", "indexes"];
@@ -3790,8 +4420,10 @@ function decodeCatalogStreams(response, ifNoneMatch) {
3790
4420
  throw new Error("catalog object references an absent schema");
3791
4421
  return entry;
3792
4422
  };
3793
- for (const item of decodeASDCollection(TableInfoSchema, response.tables))
4423
+ for (const item of decodeASDCollection(TableInfoSchema, response.tables)) {
4424
+ validateTableInfoColumns(item);
3794
4425
  owner(item).tables.push(item);
4426
+ }
3795
4427
  for (const item of decodeASDCollection(ViewInfoSchema, response.views))
3796
4428
  owner(item).views.push(item);
3797
4429
  for (const item of decodeASDCollection(FunctionInfoSchema, response.functions)) {
@@ -3869,6 +4501,42 @@ function toAsyncIterator(input) {
3869
4501
  function onConflictName(onConflict) {
3870
4502
  return String(onConflict).toUpperCase();
3871
4503
  }
4504
+ function isNotModified(md) {
4505
+ const v = md.get(CACHE_NOT_MODIFIED_KEY);
4506
+ return v != null && v !== "0" && v.toLowerCase() !== "false";
4507
+ }
4508
+ async function* exchangeContinued(session, functionName, input) {
4509
+ const raw = session;
4510
+ if (typeof raw.exchangeRaw !== "function") {
4511
+ throw new VgiClientError(`tableInOutFunction(${functionName}): the transport's stream session has no exchangeRaw(), ` + `which continued output needs to read each reply's vgi.status`);
4512
+ }
4513
+ const exchangeRaw = raw.exchangeRaw.bind(session);
4514
+ let tick = false;
4515
+ let reply = await exchangeRaw({ batch: input, metadata: new Map });
4516
+ for (;; ) {
4517
+ if (reply === null) {
4518
+ if (tick) {
4519
+ throw new VgiClientError(`tableInOutFunction(${functionName}): the worker ended the stream while output was pending`);
4520
+ }
4521
+ return;
4522
+ }
4523
+ const md = new Map([...reply.batch.metadata ?? [], ...reply.metadata]);
4524
+ const more = md.get(STATUS_KEY) === HAVE_MORE_OUTPUT;
4525
+ if (isNotModified(md) && (more || tick)) {
4526
+ throw new VgiClientError(`tableInOutFunction(${functionName}): the worker answered not_modified on a continued reply ` + `(${tick ? "answering a continuation tick" : "one saying HAVE_MORE_OUTPUT"}); ` + `not_modified must be an input's only reply`);
4527
+ }
4528
+ const rows = [...iterRows(reply.batch)];
4529
+ if (rows.length > 0)
4530
+ yield rows;
4531
+ if (!more)
4532
+ return;
4533
+ tick = true;
4534
+ reply = await exchangeRaw({
4535
+ batch: emptyBatch(input.schema),
4536
+ metadata: new Map([[STATUS_KEY, CONTINUE]])
4537
+ });
4538
+ }
4539
+ }
3872
4540
 
3873
4541
  class VgiClient {
3874
4542
  rpc;
@@ -4033,13 +4701,9 @@ class VgiClient {
4033
4701
  joinKeys: opts.joinKeys
4034
4702
  });
4035
4703
  try {
4036
- const outRows = await inputSession.exchange([...iterRows(firstBatch)]);
4037
- if (outRows.length > 0)
4038
- yield outRows;
4704
+ yield* exchangeContinued(inputSession, opts.functionName, firstBatch);
4039
4705
  for await (const batch of { [Symbol.asyncIterator]: () => inputIter }) {
4040
- const result = await inputSession.exchange([...iterRows(batch)]);
4041
- if (result.length > 0)
4042
- yield result;
4706
+ yield* exchangeContinued(inputSession, opts.functionName, batch);
4043
4707
  }
4044
4708
  } finally {
4045
4709
  inputSession.close();
@@ -4084,13 +4748,13 @@ class VgiClient {
4084
4748
  });
4085
4749
  const outputSchema = bindResp.output_schema;
4086
4750
  try {
4087
- const outRows = await inputSession.exchange([...iterRows(firstBatch)]);
4088
- if (outRows.length > 0)
4089
- yield batchFromRows(outRows, outputSchema);
4751
+ for await (const rows of exchangeContinued(inputSession, opts.functionName, firstBatch)) {
4752
+ yield batchFromRows(rows, outputSchema);
4753
+ }
4090
4754
  for await (const batch of { [Symbol.asyncIterator]: () => inputIter }) {
4091
- const result = await inputSession.exchange([...iterRows(batch)]);
4092
- if (result.length > 0)
4093
- yield batchFromRows(result, outputSchema);
4755
+ for await (const rows of exchangeContinued(inputSession, opts.functionName, batch)) {
4756
+ yield batchFromRows(rows, outputSchema);
4757
+ }
4094
4758
  }
4095
4759
  } finally {
4096
4760
  inputSession.close();
@@ -4180,7 +4844,7 @@ class VgiClient {
4180
4844
  catalog_version_frozen: inner.catalog_version_frozen ?? false,
4181
4845
  catalog_version: Number(inner.catalog_version ?? 0),
4182
4846
  attach_opaque_data_required: inner.attach_opaque_data_required ?? true,
4183
- default_schema: inner.default_schema ?? "main",
4847
+ default_schema: inner.default_schema ?? null,
4184
4848
  settings: inner.settings ? (Array.isArray(inner.settings) ? inner.settings : [...inner.settings]).map(toUint8Array) : [],
4185
4849
  secret_types: inner.secret_types ? (Array.isArray(inner.secret_types) ? inner.secret_types : [...inner.secret_types]).map(toUint8Array) : [],
4186
4850
  attach_catalogs: inner.attach_catalogs ? (Array.isArray(inner.attach_catalogs) ? inner.attach_catalogs : [...inner.attach_catalogs]).map(toUint8Array) : [],
@@ -4450,17 +5114,17 @@ class VgiClient {
4450
5114
  const items = deserializeInfoList(inner.items, decodeTableInfo);
4451
5115
  return items.length > 0 ? items[0] : null;
4452
5116
  }
4453
- async tableCreate(attachOpaqueData, schemaPath, name, columns, onConflict, notNullConstraints, uniqueConstraints, checkConstraints, transactionOpaqueData) {
5117
+ async tableCreate(attachOpaqueData, schemaPath, name, columns, onConflict, constraintDefinitions = [], transactionOpaqueData) {
4454
5118
  await this.rpc.call("catalog_table_create", {
4455
- attach_opaque_data: attachOpaqueData,
4456
- schema_path: normalizeSchemaPath(schemaPath),
4457
- name,
4458
- columns,
4459
- on_conflict: onConflictName(onConflict),
4460
- not_null_constraints: notNullConstraints ?? null,
4461
- unique_constraints: uniqueConstraints ?? null,
4462
- check_constraints: checkConstraints ?? null,
4463
- transaction_opaque_data: transactionOpaqueData ?? null
5119
+ request: encodeASD(TableCreateRequestSchema, {
5120
+ attach_opaque_data: attachOpaqueData,
5121
+ schema_path: normalizeSchemaPath(schemaPath),
5122
+ name,
5123
+ columns,
5124
+ on_conflict: onConflictName(onConflict),
5125
+ constraint_definitions: constraintDefinitions,
5126
+ transaction_opaque_data: transactionOpaqueData ?? null
5127
+ })
4464
5128
  });
4465
5129
  }
4466
5130
  async tableDrop(attachOpaqueData, schemaPath, name, ignoreNotFound, cascade, transactionOpaqueData) {
@@ -4506,88 +5170,102 @@ class VgiClient {
4506
5170
  transaction_opaque_data: transactionOpaqueData ?? null
4507
5171
  });
4508
5172
  }
4509
- async tableColumnAdd(attachOpaqueData, schemaPath, name, columnName, columnType, defaultValue, ignoreNotFound, transactionOpaqueData) {
5173
+ async tableColumnAdd(attachOpaqueData, schemaPath, name, columnPath, columnDefinition, ignoreNotFound = false, ifColumnNotExists = false, transactionOpaqueData) {
4510
5174
  await this.rpc.call("catalog_table_column_add", {
4511
5175
  attach_opaque_data: attachOpaqueData,
4512
5176
  schema_path: normalizeSchemaPath(schemaPath),
4513
5177
  name,
4514
- column_name: columnName,
4515
- column_type: columnType,
4516
- default_value: defaultValue ?? null,
4517
- ignore_not_found: ignoreNotFound ?? null,
5178
+ column_path: columnPath,
5179
+ column_definition: columnDefinition,
5180
+ ignore_not_found: ignoreNotFound,
5181
+ if_column_not_exists: ifColumnNotExists,
4518
5182
  transaction_opaque_data: transactionOpaqueData ?? null
4519
5183
  });
4520
5184
  }
4521
- async tableColumnDrop(attachOpaqueData, schemaPath, name, columnName, ignoreNotFound, transactionOpaqueData) {
5185
+ async tableColumnDrop(attachOpaqueData, schemaPath, name, columnPath, ignoreNotFound = false, ifColumnExists = false, cascade = false, transactionOpaqueData) {
4522
5186
  await this.rpc.call("catalog_table_column_drop", {
4523
5187
  attach_opaque_data: attachOpaqueData,
4524
5188
  schema_path: normalizeSchemaPath(schemaPath),
4525
5189
  name,
4526
- column_name: columnName,
4527
- ignore_not_found: ignoreNotFound ?? null,
5190
+ column_path: columnPath,
5191
+ ignore_not_found: ignoreNotFound,
5192
+ if_column_exists: ifColumnExists,
5193
+ cascade,
4528
5194
  transaction_opaque_data: transactionOpaqueData ?? null
4529
5195
  });
4530
5196
  }
4531
- async tableColumnRename(attachOpaqueData, schemaPath, name, columnName, newName, ignoreNotFound, transactionOpaqueData) {
5197
+ async tableColumnRename(attachOpaqueData, schemaPath, name, columnPath, newColumnName, ignoreNotFound = false, transactionOpaqueData) {
4532
5198
  await this.rpc.call("catalog_table_column_rename", {
4533
5199
  attach_opaque_data: attachOpaqueData,
4534
5200
  schema_path: normalizeSchemaPath(schemaPath),
4535
5201
  name,
4536
- column_name: columnName,
4537
- new_name: newName,
4538
- ignore_not_found: ignoreNotFound ?? null,
5202
+ column_path: columnPath,
5203
+ new_column_name: newColumnName,
5204
+ ignore_not_found: ignoreNotFound,
5205
+ transaction_opaque_data: transactionOpaqueData ?? null
5206
+ });
5207
+ }
5208
+ async tableColumnCommentSet(attachOpaqueData, schemaPath, name, columnPath, comment, ignoreNotFound = false, transactionOpaqueData) {
5209
+ await this.rpc.call("catalog_table_column_comment_set", {
5210
+ attach_opaque_data: attachOpaqueData,
5211
+ schema_path: normalizeSchemaPath(schemaPath),
5212
+ name,
5213
+ column_path: columnPath,
5214
+ comment,
5215
+ ignore_not_found: ignoreNotFound,
4539
5216
  transaction_opaque_data: transactionOpaqueData ?? null
4540
5217
  });
4541
5218
  }
4542
- async tableColumnDefaultSet(attachOpaqueData, schemaPath, name, columnName, defaultValue, ignoreNotFound, transactionOpaqueData) {
5219
+ async tableColumnDefaultSet(attachOpaqueData, schemaPath, name, columnPath, expression, ignoreNotFound = false, transactionOpaqueData) {
4543
5220
  await this.rpc.call("catalog_table_column_default_set", {
4544
5221
  attach_opaque_data: attachOpaqueData,
4545
5222
  schema_path: normalizeSchemaPath(schemaPath),
4546
5223
  name,
4547
- column_name: columnName,
4548
- default_value: defaultValue,
4549
- ignore_not_found: ignoreNotFound ?? null,
5224
+ column_path: columnPath,
5225
+ expression,
5226
+ ignore_not_found: ignoreNotFound,
4550
5227
  transaction_opaque_data: transactionOpaqueData ?? null
4551
5228
  });
4552
5229
  }
4553
- async tableColumnDefaultDrop(attachOpaqueData, schemaPath, name, columnName, ignoreNotFound, transactionOpaqueData) {
5230
+ async tableColumnDefaultDrop(attachOpaqueData, schemaPath, name, columnPath, ignoreNotFound = false, transactionOpaqueData) {
4554
5231
  await this.rpc.call("catalog_table_column_default_drop", {
4555
5232
  attach_opaque_data: attachOpaqueData,
4556
5233
  schema_path: normalizeSchemaPath(schemaPath),
4557
5234
  name,
4558
- column_name: columnName,
4559
- ignore_not_found: ignoreNotFound ?? null,
5235
+ column_path: columnPath,
5236
+ ignore_not_found: ignoreNotFound,
4560
5237
  transaction_opaque_data: transactionOpaqueData ?? null
4561
5238
  });
4562
5239
  }
4563
- async tableColumnTypeChange(attachOpaqueData, schemaPath, name, columnDefinition, expression, ignoreNotFound, transactionOpaqueData) {
5240
+ async tableColumnTypeChange(attachOpaqueData, schemaPath, name, columnPath, columnDefinition, expression = null, ignoreNotFound = false, transactionOpaqueData) {
4564
5241
  await this.rpc.call("catalog_table_column_type_change", {
4565
5242
  attach_opaque_data: attachOpaqueData,
4566
5243
  schema_path: normalizeSchemaPath(schemaPath),
4567
5244
  name,
5245
+ column_path: columnPath,
4568
5246
  column_definition: columnDefinition,
4569
- expression: expression ?? null,
4570
- ignore_not_found: ignoreNotFound ?? false,
5247
+ expression,
5248
+ ignore_not_found: ignoreNotFound,
4571
5249
  transaction_opaque_data: transactionOpaqueData ?? null
4572
5250
  });
4573
5251
  }
4574
- async tableNotNullSet(attachOpaqueData, schemaPath, name, columnName, ignoreNotFound, transactionOpaqueData) {
5252
+ async tableNotNullSet(attachOpaqueData, schemaPath, name, columnPath, ignoreNotFound = false, transactionOpaqueData) {
4575
5253
  await this.rpc.call("catalog_table_not_null_set", {
4576
5254
  attach_opaque_data: attachOpaqueData,
4577
5255
  schema_path: normalizeSchemaPath(schemaPath),
4578
5256
  name,
4579
- column_name: columnName,
4580
- ignore_not_found: ignoreNotFound ?? null,
5257
+ column_path: columnPath,
5258
+ ignore_not_found: ignoreNotFound,
4581
5259
  transaction_opaque_data: transactionOpaqueData ?? null
4582
5260
  });
4583
5261
  }
4584
- async tableNotNullDrop(attachOpaqueData, schemaPath, name, columnName, ignoreNotFound, transactionOpaqueData) {
5262
+ async tableNotNullDrop(attachOpaqueData, schemaPath, name, columnPath, ignoreNotFound = false, transactionOpaqueData) {
4585
5263
  await this.rpc.call("catalog_table_not_null_drop", {
4586
5264
  attach_opaque_data: attachOpaqueData,
4587
5265
  schema_path: normalizeSchemaPath(schemaPath),
4588
5266
  name,
4589
- column_name: columnName,
4590
- ignore_not_found: ignoreNotFound ?? null,
5267
+ column_path: columnPath,
5268
+ ignore_not_found: ignoreNotFound,
4591
5269
  transaction_opaque_data: transactionOpaqueData ?? null
4592
5270
  });
4593
5271
  }
@@ -4604,12 +5282,17 @@ class VgiClient {
4604
5282
  const items = deserializeInfoList(inner.items, decodeViewInfo);
4605
5283
  return items.length > 0 ? items[0] : null;
4606
5284
  }
4607
- async viewCreate(attachOpaqueData, schemaPath, name, definition, onConflict, transactionOpaqueData) {
5285
+ async viewCreate(attachOpaqueData, schemaPath, name, definition, onConflict, transactionOpaqueData, aliases, security = "regular", comment, tags, columnComments) {
4608
5286
  await this.rpc.call("catalog_view_create", {
4609
5287
  attach_opaque_data: attachOpaqueData,
4610
5288
  schema_path: normalizeSchemaPath(schemaPath),
4611
5289
  name,
4612
5290
  definition,
5291
+ aliases: aliases ?? null,
5292
+ security,
5293
+ comment: comment ?? null,
5294
+ tags: tags ?? null,
5295
+ column_comments: columnComments ?? null,
4613
5296
  on_conflict: onConflictName(onConflict),
4614
5297
  transaction_opaque_data: transactionOpaqueData ?? null
4615
5298
  });
@@ -4644,6 +5327,17 @@ class VgiClient {
4644
5327
  transaction_opaque_data: transactionOpaqueData ?? null
4645
5328
  });
4646
5329
  }
5330
+ async viewColumnCommentSet(attachOpaqueData, schemaPath, name, columnPath, comment, ignoreNotFound = false, transactionOpaqueData) {
5331
+ await this.rpc.call("catalog_view_column_comment_set", {
5332
+ attach_opaque_data: attachOpaqueData,
5333
+ schema_path: normalizeSchemaPath(schemaPath),
5334
+ name,
5335
+ column_path: columnPath,
5336
+ comment: comment ?? null,
5337
+ ignore_not_found: ignoreNotFound,
5338
+ transaction_opaque_data: transactionOpaqueData ?? null
5339
+ });
5340
+ }
4647
5341
  async macroGet(attachOpaqueData, schemaPath, name, transactionOpaqueData) {
4648
5342
  const result = await this.rpc.call("catalog_macro_get", {
4649
5343
  attach_opaque_data: attachOpaqueData,
@@ -4669,17 +5363,14 @@ class VgiClient {
4669
5363
  const inner = unwrapResult(result);
4670
5364
  return deserializeInfoList(inner.items, decodeMacroInfo);
4671
5365
  }
4672
- async macroCreate(attachOpaqueData, schemaPath, name, macroType, parameters, definition, onConflict, parameterDefaultValues, argumentsSchema, transactionOpaqueData) {
5366
+ async macroCreate(attachOpaqueData, schemaPath, name, macroType, overloads, onConflict, transactionOpaqueData) {
4673
5367
  const innerBatch = batchFromColumns({
4674
5368
  attach_opaque_data: [attachOpaqueData],
4675
5369
  schema_path: [normalizeSchemaPath(schemaPath)],
4676
5370
  name: [name],
4677
5371
  macro_type: [macroType],
4678
- parameters: [parameters],
4679
- definition: [definition],
5372
+ overloads: [overloads],
4680
5373
  on_conflict: [onConflictName(onConflict)],
4681
- parameter_default_values: [parameterDefaultValues ?? null],
4682
- arguments_schema: [argumentsSchema ?? null],
4683
5374
  transaction_opaque_data: [transactionOpaqueData ?? null]
4684
5375
  }, MacroCreateRequestSchema);
4685
5376
  await this.rpc.call("catalog_macro_create", wrapRequest(innerBatch));
@@ -4875,4 +5566,4 @@ export {
4875
5566
  typeSignature
4876
5567
  };
4877
5568
 
4878
- //# debugId=D223782952AA2BC964756E2164756E21
5569
+ //# debugId=4510F06EECD1F22E64756E2164756E21