@query-farm/vgi 0.27.0 → 0.29.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 (83) hide show
  1. package/README.md +26 -7
  2. package/dist/arguments/argument-spec.d.ts +53 -0
  3. package/dist/arrow/impl-arrowjs/index.d.ts +1 -1
  4. package/dist/arrow/impl-arrowjs/iterate.d.ts +10 -1
  5. package/dist/arrow/impl-arrowjs/schema.d.ts +2 -0
  6. package/dist/arrow/impl-flechette/index.d.ts +1 -1
  7. package/dist/arrow/impl-flechette/iterate.d.ts +10 -1
  8. package/dist/arrow/impl-flechette/schema.d.ts +2 -0
  9. package/dist/arrow/index.d.ts +1 -1
  10. package/dist/arrow/schema-types.d.ts +3 -1
  11. package/dist/arrow/types.d.ts +39 -3
  12. package/dist/catalog/interface.d.ts +43 -0
  13. package/dist/client/client.d.ts +1 -1
  14. package/dist/client-entry.js +360 -178
  15. package/dist/client-entry.js.map +14 -14
  16. package/dist/functions/table.d.ts +63 -0
  17. package/dist/functions/types.d.ts +38 -0
  18. package/dist/generated/vgi-client.d.ts +59 -0
  19. package/dist/generated/vgi-protocol-schemas.d.ts +19 -0
  20. package/dist/http/fetch.d.ts +10 -0
  21. package/dist/index.core.d.ts +2 -2
  22. package/dist/index.js +1203 -834
  23. package/dist/index.js.map +40 -37
  24. package/dist/protocol/handlers/catalog/shared.d.ts +0 -8
  25. package/dist/protocol/handlers/function.d.ts +11 -0
  26. package/dist/protocol/serializers/bind.d.ts +1 -2
  27. package/dist/protocol/serializers/cardinality.d.ts +1 -2
  28. package/dist/protocol/serializers/splits.d.ts +126 -0
  29. package/dist/protocol/types.d.ts +27 -0
  30. package/dist/request-auth.d.ts +28 -0
  31. package/dist/serve-entry.d.ts +4 -0
  32. package/dist/serve-entry.js +745 -359
  33. package/dist/serve-entry.js.map +32 -29
  34. package/dist/split-token.d.ts +88 -0
  35. package/dist/worker-cf-entry.js +1029 -619
  36. package/dist/worker-cf-entry.js.map +37 -34
  37. package/package.json +3 -3
  38. package/src/arguments/argument-spec.ts +81 -0
  39. package/src/arguments/arguments.ts +0 -1
  40. package/src/arrow/impl-arrowjs/index.ts +1 -1
  41. package/src/arrow/impl-arrowjs/iterate.ts +21 -0
  42. package/src/arrow/impl-arrowjs/schema.ts +4 -0
  43. package/src/arrow/impl-flechette/index.ts +1 -1
  44. package/src/arrow/impl-flechette/iterate.ts +24 -1
  45. package/src/arrow/impl-flechette/schema.ts +4 -0
  46. package/src/arrow/index.ts +1 -1
  47. package/src/arrow/schema-types.ts +4 -0
  48. package/src/arrow/types.ts +39 -3
  49. package/src/catalog/interface.ts +124 -29
  50. package/src/catalog/read-only.ts +18 -18
  51. package/src/client/client.ts +6 -2
  52. package/src/functions/aggregate.ts +3 -0
  53. package/src/functions/copy-from.ts +2 -1
  54. package/src/functions/copy-to.ts +2 -1
  55. package/src/functions/scalar.ts +11 -0
  56. package/src/functions/table-buffering.ts +3 -0
  57. package/src/functions/table-in-out.ts +8 -4
  58. package/src/functions/table.ts +129 -2
  59. package/src/functions/types.ts +40 -0
  60. package/src/generated/vgi-client.ts +63 -1
  61. package/src/generated/vgi-protocol-schemas.ts +240 -14
  62. package/src/http/fetch.ts +117 -2
  63. package/src/index.core.ts +2 -2
  64. package/src/protocol/handlers/aggregate.ts +10 -5
  65. package/src/protocol/handlers/catalog/admin.ts +41 -48
  66. package/src/protocol/handlers/catalog/index_methods.ts +4 -11
  67. package/src/protocol/handlers/catalog/macro.ts +8 -16
  68. package/src/protocol/handlers/catalog/shared.ts +10 -57
  69. package/src/protocol/handlers/catalog/table.ts +33 -96
  70. package/src/protocol/handlers/catalog/view.ts +13 -17
  71. package/src/protocol/handlers/function.ts +311 -18
  72. package/src/protocol/handlers/table-buffering.ts +7 -4
  73. package/src/protocol/serializers/bind.ts +56 -63
  74. package/src/protocol/serializers/cardinality.ts +7 -7
  75. package/src/protocol/serializers/init.ts +52 -10
  76. package/src/protocol/serializers/splits.ts +219 -0
  77. package/src/protocol/state-serializer.ts +55 -1
  78. package/src/protocol/types.ts +27 -0
  79. package/src/request-auth.ts +73 -0
  80. package/src/serve-entry.ts +5 -0
  81. package/src/split-token.ts +297 -0
  82. package/src/worker-cf-entry.ts +2 -1
  83. package/src/worker.ts +30 -10
package/dist/index.js CHANGED
@@ -179,7 +179,9 @@ import {
179
179
  Float32 as A_Float32,
180
180
  Float64 as A_Float64,
181
181
  Utf8 as A_Utf8,
182
+ LargeUtf8 as A_LargeUtf8,
182
183
  Binary as A_Binary,
184
+ LargeBinary as A_LargeBinary,
183
185
  Decimal as A_Decimal,
184
186
  Date_ as A_Date,
185
187
  Time as A_Time,
@@ -267,7 +269,7 @@ function union(mode, children, typeIds) {
267
269
  function isField(x) {
268
270
  return typeof x.name === "string" && x.type != null;
269
271
  }
270
- var TimeUnit, DateUnit, IntervalUnit, UnionMode, nullType = () => new A_Null, bool = () => new A_Bool, int8 = () => new A_Int8, int16 = () => new A_Int16, int32 = () => new A_Int32, int64 = () => new A_Int64, uint8 = () => new A_Uint8, uint16 = () => new A_Uint16, uint32 = () => new A_Uint32, uint64 = () => new A_Uint64, float16 = () => new A_Float16, float32 = () => new A_Float32, float64 = () => new A_Float64, utf8 = () => new A_Utf8, binary = () => new A_Binary, fixedSizeBinary = (byteWidth) => new A_FixedSizeBinary(byteWidth), decimal128 = (precision, scale) => decimal(precision, scale, 128), decimal256 = (precision, scale) => decimal(precision, scale, 256), date = (unit = A_DateUnit.MILLISECOND) => new A_Date(unit), dateDay = () => date(A_DateUnit.DAY), dateMillisecond = () => date(A_DateUnit.MILLISECOND), timeSecond = () => time(A_TimeUnit.SECOND, 32), timeMillisecond = () => time(A_TimeUnit.MILLISECOND, 32), timeMicrosecond = () => time(A_TimeUnit.MICROSECOND, 64), timeNanosecond = () => time(A_TimeUnit.NANOSECOND, 64), timestamp = (unit = A_TimeUnit.MILLISECOND, timezone = null) => new A_Timestamp(unit, timezone), duration = (unit = A_TimeUnit.MILLISECOND) => new A_Duration(unit), interval = (unit = A_IntervalUnit.MONTH_DAY_NANO) => new A_Interval(unit), sparseUnion = (children, typeIds) => union(A_UnionMode.Sparse, children, typeIds), denseUnion = (children, typeIds) => union(A_UnionMode.Dense, children, typeIds);
272
+ var TimeUnit, DateUnit, IntervalUnit, UnionMode, nullType = () => new A_Null, bool = () => new A_Bool, int8 = () => new A_Int8, int16 = () => new A_Int16, int32 = () => new A_Int32, int64 = () => new A_Int64, uint8 = () => new A_Uint8, uint16 = () => new A_Uint16, uint32 = () => new A_Uint32, uint64 = () => new A_Uint64, float16 = () => new A_Float16, float32 = () => new A_Float32, float64 = () => new A_Float64, utf8 = () => new A_Utf8, largeUtf8 = () => new A_LargeUtf8, binary = () => new A_Binary, largeBinary = () => new A_LargeBinary, fixedSizeBinary = (byteWidth) => new A_FixedSizeBinary(byteWidth), decimal128 = (precision, scale) => decimal(precision, scale, 128), decimal256 = (precision, scale) => decimal(precision, scale, 256), date = (unit = A_DateUnit.MILLISECOND) => new A_Date(unit), dateDay = () => date(A_DateUnit.DAY), dateMillisecond = () => date(A_DateUnit.MILLISECOND), timeSecond = () => time(A_TimeUnit.SECOND, 32), timeMillisecond = () => time(A_TimeUnit.MILLISECOND, 32), timeMicrosecond = () => time(A_TimeUnit.MICROSECOND, 64), timeNanosecond = () => time(A_TimeUnit.NANOSECOND, 64), timestamp = (unit = A_TimeUnit.MILLISECOND, timezone = null) => new A_Timestamp(unit, timezone), duration = (unit = A_TimeUnit.MILLISECOND) => new A_Duration(unit), interval = (unit = A_IntervalUnit.MONTH_DAY_NANO) => new A_Interval(unit), sparseUnion = (children, typeIds) => union(A_UnionMode.Sparse, children, typeIds), denseUnion = (children, typeIds) => union(A_UnionMode.Dense, children, typeIds);
271
273
  var init_schema = __esm(() => {
272
274
  TimeUnit = {
273
275
  SECOND: A_TimeUnit.SECOND,
@@ -1529,13 +1531,19 @@ function batchToSecretDict(batch) {
1529
1531
  }
1530
1532
  function safeNumber(value) {
1531
1533
  if (typeof value === "bigint") {
1534
+ if (value > MAX_SAFE || value < MIN_SAFE) {
1535
+ throw new RangeError(`${value} cannot be represented exactly as a JS number ` + `(|value| > Number.MAX_SAFE_INTEGER). Keep it as a bigint.`);
1536
+ }
1532
1537
  return Number(value);
1533
1538
  }
1534
1539
  return value;
1535
1540
  }
1541
+ var MAX_SAFE, MIN_SAFE;
1536
1542
  var init_iterate = __esm(() => {
1537
1543
  init_registry();
1538
1544
  init_canonical();
1545
+ MAX_SAFE = BigInt(Number.MAX_SAFE_INTEGER);
1546
+ MIN_SAFE = -MAX_SAFE;
1539
1547
  });
1540
1548
 
1541
1549
  // src/arrow/impl-arrowjs/filter.ts
@@ -1800,72 +1808,74 @@ var init_statistics = __esm(() => {
1800
1808
  // src/arrow/impl-arrowjs/index.ts
1801
1809
  var exports_impl_arrowjs = {};
1802
1810
  __export(exports_impl_arrowjs, {
1803
- withBatchMetadata: () => withBatchMetadata,
1804
- utf8: () => utf8,
1805
- union: () => union,
1806
- uint8: () => uint8,
1807
- uint64: () => uint64,
1808
- uint32: () => uint32,
1809
- uint16: () => uint16,
1810
- timestamp: () => timestamp,
1811
- timeSecond: () => timeSecond,
1812
- timeNanosecond: () => timeNanosecond,
1813
- timeMillisecond: () => timeMillisecond,
1814
- timeMicrosecond: () => timeMicrosecond,
1815
- time: () => time,
1816
- struct: () => struct,
1817
- sparseUnion: () => sparseUnion,
1818
- serializeSchema: () => serializeSchema,
1819
- serializeBatch: () => serializeBatch,
1820
- schema: () => schema,
1821
- safeNumber: () => safeNumber,
1822
- readCanonicalValue: () => readCanonicalValue,
1823
- projectSchema: () => projectSchema,
1824
- projectBatch: () => projectBatch,
1825
- nullType: () => nullType,
1826
- map: () => map,
1827
- list: () => list,
1828
- iterRows: () => iterRows,
1829
- interval: () => interval,
1830
- int8: () => int8,
1831
- int64: () => int64,
1832
- int32: () => int32,
1833
- int16: () => int16,
1834
- int: () => int,
1835
- float64: () => float64,
1836
- float32: () => float32,
1837
- float16: () => float16,
1838
- fixedSizeList: () => fixedSizeList,
1839
- fixedSizeBinary: () => fixedSizeBinary,
1840
- filterBatch: () => filterBatch,
1841
- field: () => field,
1842
- emptyBatch: () => emptyBatch,
1843
- duration: () => duration,
1844
- dictionary: () => dictionary,
1845
- deserializeSchema: () => deserializeSchema,
1846
- deserializeBatch: () => deserializeBatch,
1847
- denseUnion: () => denseUnion,
1848
- decodeDictValue: () => decodeDictValue,
1849
- decimal256: () => decimal256,
1850
- decimal128: () => decimal128,
1851
- decimal: () => decimal,
1852
- dateMillisecond: () => dateMillisecond,
1853
- dateDay: () => dateDay,
1854
- date: () => date,
1855
- columnFromArray: () => columnFromArray,
1856
- buildStatisticsBatch: () => buildStatisticsBatch,
1857
- bool: () => bool,
1858
- binary: () => binary,
1859
- batchToSecretDict: () => batchToSecretDict,
1860
- batchToScalarDict: () => batchToScalarDict,
1861
- batchFromRows: () => batchFromRows,
1862
- batchFromColumns: () => batchFromColumns,
1863
- backend: () => backend,
1864
- adoptArrowJsShape: () => adoptArrowJsShape,
1865
- UnionMode: () => UnionMode,
1866
- TimeUnit: () => TimeUnit,
1811
+ DateUnit: () => DateUnit,
1867
1812
  IntervalUnit: () => IntervalUnit,
1868
- DateUnit: () => DateUnit
1813
+ TimeUnit: () => TimeUnit,
1814
+ UnionMode: () => UnionMode,
1815
+ adoptArrowJsShape: () => adoptArrowJsShape,
1816
+ backend: () => backend,
1817
+ batchFromColumns: () => batchFromColumns,
1818
+ batchFromRows: () => batchFromRows,
1819
+ batchToScalarDict: () => batchToScalarDict,
1820
+ batchToSecretDict: () => batchToSecretDict,
1821
+ binary: () => binary,
1822
+ bool: () => bool,
1823
+ buildStatisticsBatch: () => buildStatisticsBatch,
1824
+ columnFromArray: () => columnFromArray,
1825
+ date: () => date,
1826
+ dateDay: () => dateDay,
1827
+ dateMillisecond: () => dateMillisecond,
1828
+ decimal: () => decimal,
1829
+ decimal128: () => decimal128,
1830
+ decimal256: () => decimal256,
1831
+ decodeDictValue: () => decodeDictValue,
1832
+ denseUnion: () => denseUnion,
1833
+ deserializeBatch: () => deserializeBatch,
1834
+ deserializeSchema: () => deserializeSchema,
1835
+ dictionary: () => dictionary,
1836
+ duration: () => duration,
1837
+ emptyBatch: () => emptyBatch,
1838
+ field: () => field,
1839
+ filterBatch: () => filterBatch,
1840
+ fixedSizeBinary: () => fixedSizeBinary,
1841
+ fixedSizeList: () => fixedSizeList,
1842
+ float16: () => float16,
1843
+ float32: () => float32,
1844
+ float64: () => float64,
1845
+ int: () => int,
1846
+ int16: () => int16,
1847
+ int32: () => int32,
1848
+ int64: () => int64,
1849
+ int8: () => int8,
1850
+ interval: () => interval,
1851
+ iterRows: () => iterRows,
1852
+ largeBinary: () => largeBinary,
1853
+ largeUtf8: () => largeUtf8,
1854
+ list: () => list,
1855
+ map: () => map,
1856
+ nullType: () => nullType,
1857
+ projectBatch: () => projectBatch,
1858
+ projectSchema: () => projectSchema,
1859
+ readCanonicalValue: () => readCanonicalValue,
1860
+ safeNumber: () => safeNumber,
1861
+ schema: () => schema,
1862
+ serializeBatch: () => serializeBatch,
1863
+ serializeSchema: () => serializeSchema,
1864
+ sparseUnion: () => sparseUnion,
1865
+ struct: () => struct,
1866
+ time: () => time,
1867
+ timeMicrosecond: () => timeMicrosecond,
1868
+ timeMillisecond: () => timeMillisecond,
1869
+ timeNanosecond: () => timeNanosecond,
1870
+ timeSecond: () => timeSecond,
1871
+ timestamp: () => timestamp,
1872
+ uint16: () => uint16,
1873
+ uint32: () => uint32,
1874
+ uint64: () => uint64,
1875
+ uint8: () => uint8,
1876
+ union: () => union,
1877
+ utf8: () => utf8,
1878
+ withBatchMetadata: () => withBatchMetadata
1869
1879
  });
1870
1880
  function adoptArrowJsShape(batch) {
1871
1881
  return batch;
@@ -1919,7 +1929,7 @@ function dictionary2(valueType, indexType, ordered, id) {
1919
1929
  function union2(mode, children, typeIds) {
1920
1930
  return union(mode, children, typeIds);
1921
1931
  }
1922
- var TimeUnit2, DateUnit3, IntervalUnit2, UnionMode2, schema2, nullType2 = () => nullType(), bool2 = () => bool(), int82 = () => int8(), int162 = () => int16(), int322 = () => int32(), int642 = () => int64(), uint82 = () => uint8(), uint162 = () => uint16(), uint322 = () => uint32(), uint642 = () => uint64(), float162 = () => float16(), float322 = () => float32(), float642 = () => float64(), utf82 = () => utf8(), binary2 = () => binary(), fixedSizeBinary2 = (byteWidth) => fixedSizeBinary(byteWidth), decimal2 = (precision, scale, bitWidth) => decimal(precision, scale, bitWidth), decimal1282 = (precision, scale) => decimal128(precision, scale), decimal2562 = (precision, scale) => decimal256(precision, scale), date2 = (unit) => date(unit), dateDay2 = () => dateDay(), dateMillisecond2 = () => dateMillisecond(), timeSecond2 = () => timeSecond(), timeMillisecond2 = () => timeMillisecond(), timeMicrosecond2 = () => timeMicrosecond(), timeNanosecond2 = () => timeNanosecond(), UNIT_TO_TAG, timestampSeconds = (timezone) => timestamp(TimeUnit.SECOND, timezone ?? null), timestampMillis = (timezone) => timestamp(TimeUnit.MILLISECOND, timezone ?? null), timestampMicros = (timezone) => timestamp(TimeUnit.MICROSECOND, timezone ?? null), timestampNanos = (timezone) => timestamp(TimeUnit.NANOSECOND, timezone ?? null), durationSeconds = () => duration(TimeUnit.SECOND), durationMillis = () => duration(TimeUnit.MILLISECOND), durationMicros = () => duration(TimeUnit.MICROSECOND), durationNanos = () => duration(TimeUnit.NANOSECOND), interval2 = (unit) => interval(unit), sparseUnion2 = (children, typeIds) => sparseUnion(children, typeIds), denseUnion2 = (children, typeIds) => denseUnion(children, typeIds);
1932
+ var TimeUnit2, DateUnit3, IntervalUnit2, UnionMode2, schema2, nullType2 = () => nullType(), bool2 = () => bool(), int82 = () => int8(), int162 = () => int16(), int322 = () => int32(), int642 = () => int64(), uint82 = () => uint8(), uint162 = () => uint16(), uint322 = () => uint32(), uint642 = () => uint64(), float162 = () => float16(), float322 = () => float32(), float642 = () => float64(), utf82 = () => utf8(), largeUtf82 = () => largeUtf8(), binary2 = () => binary(), largeBinary2 = () => largeBinary(), fixedSizeBinary2 = (byteWidth) => fixedSizeBinary(byteWidth), decimal2 = (precision, scale, bitWidth) => decimal(precision, scale, bitWidth), decimal1282 = (precision, scale) => decimal128(precision, scale), decimal2562 = (precision, scale) => decimal256(precision, scale), date2 = (unit) => date(unit), dateDay2 = () => dateDay(), dateMillisecond2 = () => dateMillisecond(), timeSecond2 = () => timeSecond(), timeMillisecond2 = () => timeMillisecond(), timeMicrosecond2 = () => timeMicrosecond(), timeNanosecond2 = () => timeNanosecond(), UNIT_TO_TAG, timestampSeconds = (timezone) => timestamp(TimeUnit.SECOND, timezone ?? null), timestampMillis = (timezone) => timestamp(TimeUnit.MILLISECOND, timezone ?? null), timestampMicros = (timezone) => timestamp(TimeUnit.MICROSECOND, timezone ?? null), timestampNanos = (timezone) => timestamp(TimeUnit.NANOSECOND, timezone ?? null), durationSeconds = () => duration(TimeUnit.SECOND), durationMillis = () => duration(TimeUnit.MILLISECOND), durationMicros = () => duration(TimeUnit.MICROSECOND), durationNanos = () => duration(TimeUnit.NANOSECOND), interval2 = (unit) => interval(unit), sparseUnion2 = (children, typeIds) => sparseUnion(children, typeIds), denseUnion2 = (children, typeIds) => denseUnion(children, typeIds);
1923
1933
  var init_schema_types = __esm(() => {
1924
1934
  init_impl_arrowjs();
1925
1935
  ({ TimeUnit: TimeUnit2, DateUnit: DateUnit3, IntervalUnit: IntervalUnit2, UnionMode: UnionMode2, schema: schema2 } = exports_impl_arrowjs);
@@ -1978,138 +1988,140 @@ var init_branded = __esm(() => {
1978
1988
  // src/arrow/index.ts
1979
1989
  var exports_arrow = {};
1980
1990
  __export(exports_arrow, {
1981
- withBatchMetadata: () => withBatchMetadata,
1982
- utf8: () => utf82,
1983
- union: () => union2,
1984
- uint8: () => uint82,
1985
- uint64: () => uint642,
1986
- uint32: () => uint322,
1987
- uint16: () => uint162,
1988
- typeSignature: () => typeSignature,
1989
- timestampSeconds: () => timestampSeconds,
1990
- timestampNanos: () => timestampNanos,
1991
- timestampMillis: () => timestampMillis,
1992
- timestampMicros: () => timestampMicros,
1993
- timestamp: () => timestamp2,
1994
- timeSecond: () => timeSecond2,
1995
- timeNanosecond: () => timeNanosecond2,
1996
- timeMillisecond: () => timeMillisecond2,
1997
- timeMicrosecond: () => timeMicrosecond2,
1998
- time: () => time2,
1999
- struct: () => struct2,
2000
- sparseUnion: () => sparseUnion2,
2001
- serializeSchema: () => serializeSchema,
2002
- serializeBatch: () => serializeBatch,
2003
- schema: () => schema2,
2004
- safeNumber: () => safeNumber,
2005
- readCanonicalValue: () => readCanonicalValue,
2006
- projectSchema: () => projectSchema,
2007
- projectBatch: () => projectBatch,
2008
- nullType: () => nullType2,
2009
- map: () => map2,
2010
- list: () => list2,
2011
- iterRows: () => iterRows,
2012
- isUtf8: () => isUtf8,
2013
- isUnion: () => isUnion,
2014
- isTimestamp: () => isTimestamp,
2015
- isTime: () => isTime,
2016
- isStruct: () => isStruct,
2017
- isNull: () => isNull,
2018
- isMap: () => isMap,
2019
- isList: () => isList,
2020
- isInterval: () => isInterval,
2021
- isInt: () => isInt,
2022
- isFloat: () => isFloat,
2023
- isFixedSizeList: () => isFixedSizeList,
2024
- isFixedSizeBinary: () => isFixedSizeBinary,
2025
- isDuration: () => isDuration,
2026
- isDictionary: () => isDictionary,
2027
- isDecimal: () => isDecimal,
2028
- isDate: () => isDate,
2029
- isBool: () => isBool,
2030
- isBinary: () => isBinary,
2031
- isBatch: () => isBatch,
2032
- interval: () => interval2,
2033
- int8: () => int82,
2034
- int64: () => int642,
2035
- int32: () => int322,
2036
- int16: () => int162,
2037
- int: () => int2,
2038
- fromBrandedNumber: () => fromBrandedNumber,
2039
- fromBrandedBigInt: () => fromBrandedBigInt,
2040
- fromBranded: () => fromBranded,
2041
- float64: () => float642,
2042
- float32: () => float322,
2043
- float16: () => float162,
2044
- fixedSizeList: () => fixedSizeList2,
2045
- fixedSizeBinary: () => fixedSizeBinary2,
2046
- filterBatch: () => filterBatch,
2047
- field: () => field2,
2048
- emptyBatch: () => emptyBatch,
2049
- durationSeconds: () => durationSeconds,
2050
- durationNanos: () => durationNanos,
2051
- durationMillis: () => durationMillis,
2052
- durationMicros: () => durationMicros,
2053
- duration: () => duration2,
2054
- dictionary: () => dictionary2,
2055
- deserializeSchema: () => deserializeSchema,
2056
- deserializeBatch: () => deserializeBatch,
2057
- denseUnion: () => denseUnion2,
2058
- decodeDictValue: () => decodeDictValue,
2059
- decimal256: () => decimal2562,
2060
- decimal128: () => decimal1282,
2061
- decimal: () => decimal2,
2062
- dateMillisecond: () => dateMillisecond2,
2063
- dateDay: () => dateDay2,
2064
- date: () => date2,
2065
- columnFromArray: () => columnFromArray,
2066
- codecFor: () => codecFor,
2067
- buildStatisticsBatch: () => buildStatisticsBatch,
2068
- bool: () => bool2,
2069
- binary: () => binary2,
2070
- batchToSecretDict: () => batchToSecretDict,
2071
- batchToScalarDict: () => batchToScalarDict,
2072
- batchFromRows: () => batchFromRows,
2073
- batchFromColumns: () => batchFromColumns,
2074
- backend: () => backend,
2075
- asUnscaledDecimal: () => asUnscaledDecimal,
2076
- asUint64: () => asUint64,
2077
- asTimestampSeconds: () => asTimestampSeconds,
2078
- asTimestampNanos: () => asTimestampNanos,
2079
- asTimestampMillis: () => asTimestampMillis,
2080
- asTimestampMicros: () => asTimestampMicros,
2081
- asTime64Us: () => asTime64Us,
2082
- asTime64Ns: () => asTime64Ns,
2083
- asTime32S: () => asTime32S,
2084
- asTime32Ms: () => asTime32Ms,
2085
- asInt64: () => asInt64,
2086
- asDurationSeconds: () => asDurationSeconds,
2087
- asDurationNanos: () => asDurationNanos,
2088
- asDurationMillis: () => asDurationMillis,
2089
- asDurationMicros: () => asDurationMicros,
2090
- asDate64Ms: () => asDate64Ms,
2091
- asDate32: () => asDate32,
2092
- adoptArrowJsShape: () => adoptArrowJsShape,
2093
- UnionMode: () => UnionMode2,
2094
- TypeId: () => TypeId,
2095
- TimeUnit: () => TimeUnit2,
1991
+ DateUnit: () => DateUnit3,
2096
1992
  IntervalUnit: () => IntervalUnit2,
2097
- DateUnit: () => DateUnit3
2098
- });
2099
- var init_arrow = __esm(() => {
2100
- init_predicates();
2101
- init_impl_arrowjs();
2102
- init_schema_types();
2103
- init_registry();
2104
- init_branded();
2105
- });
2106
-
2107
- // src/functions/storage-cf-do.ts
2108
- var exports_storage_cf_do = {};
2109
- __export(exports_storage_cf_do, {
2110
- FunctionStorageCfDo: () => FunctionStorageCfDo
2111
- });
2112
-
1993
+ TimeUnit: () => TimeUnit2,
1994
+ TypeId: () => TypeId,
1995
+ UnionMode: () => UnionMode2,
1996
+ adoptArrowJsShape: () => adoptArrowJsShape,
1997
+ asDate32: () => asDate32,
1998
+ asDate64Ms: () => asDate64Ms,
1999
+ asDurationMicros: () => asDurationMicros,
2000
+ asDurationMillis: () => asDurationMillis,
2001
+ asDurationNanos: () => asDurationNanos,
2002
+ asDurationSeconds: () => asDurationSeconds,
2003
+ asInt64: () => asInt64,
2004
+ asTime32Ms: () => asTime32Ms,
2005
+ asTime32S: () => asTime32S,
2006
+ asTime64Ns: () => asTime64Ns,
2007
+ asTime64Us: () => asTime64Us,
2008
+ asTimestampMicros: () => asTimestampMicros,
2009
+ asTimestampMillis: () => asTimestampMillis,
2010
+ asTimestampNanos: () => asTimestampNanos,
2011
+ asTimestampSeconds: () => asTimestampSeconds,
2012
+ asUint64: () => asUint64,
2013
+ asUnscaledDecimal: () => asUnscaledDecimal,
2014
+ backend: () => backend,
2015
+ batchFromColumns: () => batchFromColumns,
2016
+ batchFromRows: () => batchFromRows,
2017
+ batchToScalarDict: () => batchToScalarDict,
2018
+ batchToSecretDict: () => batchToSecretDict,
2019
+ binary: () => binary2,
2020
+ bool: () => bool2,
2021
+ buildStatisticsBatch: () => buildStatisticsBatch,
2022
+ codecFor: () => codecFor,
2023
+ columnFromArray: () => columnFromArray,
2024
+ date: () => date2,
2025
+ dateDay: () => dateDay2,
2026
+ dateMillisecond: () => dateMillisecond2,
2027
+ decimal: () => decimal2,
2028
+ decimal128: () => decimal1282,
2029
+ decimal256: () => decimal2562,
2030
+ decodeDictValue: () => decodeDictValue,
2031
+ denseUnion: () => denseUnion2,
2032
+ deserializeBatch: () => deserializeBatch,
2033
+ deserializeSchema: () => deserializeSchema,
2034
+ dictionary: () => dictionary2,
2035
+ duration: () => duration2,
2036
+ durationMicros: () => durationMicros,
2037
+ durationMillis: () => durationMillis,
2038
+ durationNanos: () => durationNanos,
2039
+ durationSeconds: () => durationSeconds,
2040
+ emptyBatch: () => emptyBatch,
2041
+ field: () => field2,
2042
+ filterBatch: () => filterBatch,
2043
+ fixedSizeBinary: () => fixedSizeBinary2,
2044
+ fixedSizeList: () => fixedSizeList2,
2045
+ float16: () => float162,
2046
+ float32: () => float322,
2047
+ float64: () => float642,
2048
+ fromBranded: () => fromBranded,
2049
+ fromBrandedBigInt: () => fromBrandedBigInt,
2050
+ fromBrandedNumber: () => fromBrandedNumber,
2051
+ int: () => int2,
2052
+ int16: () => int162,
2053
+ int32: () => int322,
2054
+ int64: () => int642,
2055
+ int8: () => int82,
2056
+ interval: () => interval2,
2057
+ isBatch: () => isBatch,
2058
+ isBinary: () => isBinary,
2059
+ isBool: () => isBool,
2060
+ isDate: () => isDate,
2061
+ isDecimal: () => isDecimal,
2062
+ isDictionary: () => isDictionary,
2063
+ isDuration: () => isDuration,
2064
+ isFixedSizeBinary: () => isFixedSizeBinary,
2065
+ isFixedSizeList: () => isFixedSizeList,
2066
+ isFloat: () => isFloat,
2067
+ isInt: () => isInt,
2068
+ isInterval: () => isInterval,
2069
+ isList: () => isList,
2070
+ isMap: () => isMap,
2071
+ isNull: () => isNull,
2072
+ isStruct: () => isStruct,
2073
+ isTime: () => isTime,
2074
+ isTimestamp: () => isTimestamp,
2075
+ isUnion: () => isUnion,
2076
+ isUtf8: () => isUtf8,
2077
+ iterRows: () => iterRows,
2078
+ largeBinary: () => largeBinary2,
2079
+ largeUtf8: () => largeUtf82,
2080
+ list: () => list2,
2081
+ map: () => map2,
2082
+ nullType: () => nullType2,
2083
+ projectBatch: () => projectBatch,
2084
+ projectSchema: () => projectSchema,
2085
+ readCanonicalValue: () => readCanonicalValue,
2086
+ safeNumber: () => safeNumber,
2087
+ schema: () => schema2,
2088
+ serializeBatch: () => serializeBatch,
2089
+ serializeSchema: () => serializeSchema,
2090
+ sparseUnion: () => sparseUnion2,
2091
+ struct: () => struct2,
2092
+ time: () => time2,
2093
+ timeMicrosecond: () => timeMicrosecond2,
2094
+ timeMillisecond: () => timeMillisecond2,
2095
+ timeNanosecond: () => timeNanosecond2,
2096
+ timeSecond: () => timeSecond2,
2097
+ timestamp: () => timestamp2,
2098
+ timestampMicros: () => timestampMicros,
2099
+ timestampMillis: () => timestampMillis,
2100
+ timestampNanos: () => timestampNanos,
2101
+ timestampSeconds: () => timestampSeconds,
2102
+ typeSignature: () => typeSignature,
2103
+ uint16: () => uint162,
2104
+ uint32: () => uint322,
2105
+ uint64: () => uint642,
2106
+ uint8: () => uint82,
2107
+ union: () => union2,
2108
+ utf8: () => utf82,
2109
+ withBatchMetadata: () => withBatchMetadata
2110
+ });
2111
+ var init_arrow = __esm(() => {
2112
+ init_predicates();
2113
+ init_impl_arrowjs();
2114
+ init_schema_types();
2115
+ init_registry();
2116
+ init_branded();
2117
+ });
2118
+
2119
+ // src/functions/storage-cf-do.ts
2120
+ var exports_storage_cf_do = {};
2121
+ __export(exports_storage_cf_do, {
2122
+ FunctionStorageCfDo: () => FunctionStorageCfDo
2123
+ });
2124
+
2113
2125
  class FunctionStorageCfDo {
2114
2126
  _baseUrl;
2115
2127
  _token;
@@ -2840,6 +2852,26 @@ function choiceEquals(choice, value) {
2840
2852
  return cn === vn;
2841
2853
  return choice === value;
2842
2854
  }
2855
+ function narrowArgValue(value) {
2856
+ return typeof value === "bigint" ? Number(value) : value;
2857
+ }
2858
+ function assertArrowType(value, where) {
2859
+ if (typeof value === "function") {
2860
+ const name = value.name;
2861
+ const call = name ? `${name}()` : "the factory";
2862
+ throw new ArgumentValidationError(`${where} is a type factory, not an Arrow type — call it: ${call}. ` + `(Note that int, int32, float32 and bool are ready-made types on ` + `@query-farm/vgi but factories on @query-farm/vgi/worker-cf, so the ` + `same name may need parentheses on one entry point and not the other. ` + `int64(), float64(), utf8() and the rest are factories everywhere.)`);
2863
+ }
2864
+ if (value === null || value === undefined) {
2865
+ throw new ArgumentValidationError(`${where} is ${String(value)}, not an Arrow type.`);
2866
+ }
2867
+ }
2868
+ function assertArrowTypes(types, where) {
2869
+ if (!types)
2870
+ return;
2871
+ for (const [name, type] of Object.entries(types)) {
2872
+ assertArrowType(type, `${where}.${name}`);
2873
+ }
2874
+ }
2843
2875
  function validateConstConstraints(name, constraints, value) {
2844
2876
  if (value === null || value === undefined)
2845
2877
  return;
@@ -3000,6 +3032,14 @@ init_arrow();
3000
3032
 
3001
3033
  // src/functions/scalar.ts
3002
3034
  function defineScalarFunction(config) {
3035
+ assertArrowTypes(config.params, `defineScalarFunction("${config.name}"): params`);
3036
+ assertArrowTypes(config.constParams, `defineScalarFunction("${config.name}"): constParams`);
3037
+ if (config.returns !== undefined) {
3038
+ assertArrowType(config.returns, `defineScalarFunction("${config.name}"): returns`);
3039
+ }
3040
+ for (const p of config.parameters ?? []) {
3041
+ assertArrowType(p.type, `defineScalarFunction("${config.name}"): parameters["${p.name}"].type`);
3042
+ }
3003
3043
  const repr = config.repr ?? "rich";
3004
3044
  const specs = [];
3005
3045
  if (config.parameters) {
@@ -3960,6 +4000,7 @@ function makeProjectingCollector(inner, targetSchema) {
3960
4000
  });
3961
4001
  }
3962
4002
  function defineTableFunction(config) {
4003
+ assertArrowTypes(config.args, `defineTableFunction("${config.name}"): args`);
3963
4004
  const specs = [];
3964
4005
  let posIdx = 0;
3965
4006
  if (config.args) {
@@ -3999,7 +4040,9 @@ function defineTableFunction(config) {
3999
4040
  orderDependent: config.orderDependent,
4000
4041
  distinctDependent: config.distinctDependent,
4001
4042
  supportsBatchIndex: config.supportsBatchIndex,
4002
- partitionKind: config.partitionKind
4043
+ partitionKind: config.partitionKind,
4044
+ supportsSplits: config.supportsSplits,
4045
+ splitTokenTtlSeconds: config.splitTokenTtlSeconds
4003
4046
  };
4004
4047
  function extractArgs(request) {
4005
4048
  const args = {};
@@ -4011,8 +4054,7 @@ function defineTableFunction(config) {
4011
4054
  } catch {
4012
4055
  val = request.arguments.get(spec.name, defaultVal);
4013
4056
  }
4014
- if (typeof val === "bigint")
4015
- val = safeNumber(val);
4057
+ val = narrowArgValue(val);
4016
4058
  const constraints = config.argConstraints?.[spec.name];
4017
4059
  if (constraints)
4018
4060
  validateConstConstraints(spec.name, constraints, val);
@@ -4046,6 +4088,22 @@ function defineTableFunction(config) {
4046
4088
  async globalInit(request) {
4047
4089
  const executionId = new Uint8Array(16);
4048
4090
  crypto.getRandomValues(executionId);
4091
+ if (request.split_payloads) {
4092
+ if (config.onSplit) {
4093
+ await config.onSplit(request.split_payloads, {
4094
+ args: extractArgs(request.bind_call),
4095
+ bindCall: request.bind_call,
4096
+ settings: batchToScalarDict(request.bind_call.settings),
4097
+ secrets: batchToSecretDict(request.bind_call.secrets),
4098
+ resolvedSecretsProvided: request.bind_call.resolved_secrets_provided ?? false
4099
+ });
4100
+ }
4101
+ return {
4102
+ max_workers: config.maxWorkers ?? 1,
4103
+ execution_id: request.execution_id ?? executionId,
4104
+ opaque_data: null
4105
+ };
4106
+ }
4049
4107
  if (request.execution_id) {
4050
4108
  return {
4051
4109
  max_workers: config.maxWorkers ?? 1,
@@ -4087,6 +4145,7 @@ function defineTableFunction(config) {
4087
4145
  settings,
4088
4146
  secrets,
4089
4147
  pushdownFilters,
4148
+ splitPayloads: request.split_payloads ?? undefined,
4090
4149
  storage: boundStorage,
4091
4150
  atUnit: request.bind_call.at_unit ?? undefined,
4092
4151
  atValue: request.bind_call.at_value ?? undefined
@@ -4138,6 +4197,18 @@ function defineTableFunction(config) {
4138
4197
  resolvedSecretsProvided: request.bind_call.resolved_secrets_provided ?? false
4139
4198
  });
4140
4199
  } : undefined,
4200
+ plan: config.plan ? (request) => {
4201
+ const args = extractArgs(request.bind_call);
4202
+ const settings = batchToScalarDict(request.bind_call.settings);
4203
+ const secrets = batchToSecretDict(request.bind_call.secrets);
4204
+ return config.plan({
4205
+ args,
4206
+ bindCall: request.bind_call,
4207
+ settings,
4208
+ secrets,
4209
+ resolvedSecretsProvided: request.bind_call.resolved_secrets_provided ?? false
4210
+ }, request);
4211
+ } : undefined,
4141
4212
  statistics: config.statistics ? (request) => {
4142
4213
  const args = extractArgs(request.bind_call);
4143
4214
  const settings = batchToScalarDict(request.bind_call.settings);
@@ -4282,6 +4353,7 @@ function persistGroupStates(executionId, gids) {
4282
4353
  }
4283
4354
  }
4284
4355
  function defineAggregate(config) {
4356
+ assertArrowTypes(config.args, `defineAggregate("${config.name}"): args`);
4285
4357
  const specs = [];
4286
4358
  let posIdx = 0;
4287
4359
  const varargsSet = new Set(config.varargs ?? []);
@@ -4364,6 +4436,27 @@ var EXCHANGE_STATE_SCHEMA = schema2([
4364
4436
  ]);
4365
4437
  var TEXT_ENCODER = new TextEncoder;
4366
4438
  var TEXT_DECODER = new TextDecoder;
4439
+ var LIST_CHILD_NAME = "item";
4440
+ var emptyListElementType = () => utf82();
4441
+ function inferElementType(values) {
4442
+ let elementType = null;
4443
+ let elementSig = "";
4444
+ for (const v of values) {
4445
+ if (v === null || v === undefined)
4446
+ continue;
4447
+ const t = inferFieldType(v);
4448
+ const sig = typeSignature(t);
4449
+ if (elementType === null) {
4450
+ elementType = t;
4451
+ elementSig = sig;
4452
+ continue;
4453
+ }
4454
+ if (sig !== elementSig) {
4455
+ throw new Error(`inferFieldType: arrays in userState must be homogeneous; ` + `found both '${elementSig}' and '${sig}' in the same array ` + `(split the values into separate fields, or normalize them to one type)`);
4456
+ }
4457
+ }
4458
+ return elementType ?? emptyListElementType();
4459
+ }
4367
4460
  function inferFieldType(value) {
4368
4461
  if (value === null || value === undefined)
4369
4462
  return nullType2();
@@ -4382,7 +4475,7 @@ function inferFieldType(value) {
4382
4475
  if (ArrayBuffer.isView(value))
4383
4476
  return binary2();
4384
4477
  if (Array.isArray(value)) {
4385
- throw new Error(`inferFieldType: arrays are not supported in userState (convert to a serializable form first)`);
4478
+ return list2(field2(LIST_CHILD_NAME, inferElementType(value), true));
4386
4479
  }
4387
4480
  if (value instanceof Map) {
4388
4481
  throw new Error(`inferFieldType: Map is not supported in userState (use a plain object instead)`);
@@ -4483,6 +4576,7 @@ var arrowStateSerializer = {
4483
4576
 
4484
4577
  // src/functions/table-in-out.ts
4485
4578
  function defineTableInOutFunction(config) {
4579
+ assertArrowTypes(config.args, `defineTableInOutFunction("${config.name}"): args`);
4486
4580
  const specs = [];
4487
4581
  let posIdx = 0;
4488
4582
  if (config.args) {
@@ -4531,8 +4625,7 @@ function defineTableInOutFunction(config) {
4531
4625
  continue;
4532
4626
  const defaultVal = config.argDefaults?.[spec.name] !== undefined ? config.argDefaults[spec.name] : undefined;
4533
4627
  let val = request.arguments.get(spec.position, defaultVal);
4534
- if (typeof val === "bigint")
4535
- val = Number(val);
4628
+ val = narrowArgValue(val);
4536
4629
  args[spec.name] = val;
4537
4630
  }
4538
4631
  return args;
@@ -4809,8 +4902,7 @@ function defineRowTransformFunction(config) {
4809
4902
  continue;
4810
4903
  const defaultVal = config.argDefaults?.[spec.name] !== undefined ? config.argDefaults[spec.name] : undefined;
4811
4904
  let val = request.arguments.get(spec.position, defaultVal ?? null);
4812
- if (typeof val === "bigint")
4813
- val = Number(val);
4905
+ val = narrowArgValue(val);
4814
4906
  args[spec.name] = val;
4815
4907
  }
4816
4908
  return args;
@@ -5098,10 +5190,19 @@ function buildSingleRowBatch(schema3, values) {
5098
5190
  }
5099
5191
 
5100
5192
  // src/protocol/serializers/bind.ts
5193
+ var COPY_FROM_STRUCT_TYPE = struct2([
5194
+ field2("format", utf82(), false),
5195
+ field2("file_path", utf82(), false),
5196
+ field2("expected_schema", binary2(), false)
5197
+ ]);
5198
+ var COPY_TO_STRUCT_TYPE = struct2([
5199
+ field2("format", utf82(), false),
5200
+ field2("file_path", utf82(), false)
5201
+ ]);
5101
5202
  var BIND_REQUEST_SCHEMA = schema2([
5102
5203
  field2("function_name", utf82(), false),
5103
5204
  field2("arguments", binary2(), false),
5104
- field2("function_type", utf82(), false),
5205
+ field2("function_type", dictionary2(utf82(), int162()), false),
5105
5206
  field2("input_schema", binary2(), true),
5106
5207
  field2("settings", binary2(), true),
5107
5208
  field2("secrets", binary2(), true),
@@ -5110,28 +5211,12 @@ var BIND_REQUEST_SCHEMA = schema2([
5110
5211
  field2("resolved_secrets_provided", bool2(), false),
5111
5212
  field2("at_unit", utf82(), true),
5112
5213
  field2("at_value", utf82(), true),
5214
+ field2("copy_from", COPY_FROM_STRUCT_TYPE, true),
5215
+ field2("copy_to", COPY_TO_STRUCT_TYPE, true),
5113
5216
  field2("schema_name", utf82(), true)
5114
5217
  ]);
5115
- var COPY_FROM_STRUCT_TYPE = struct2([
5116
- field2("format", utf82(), false),
5117
- field2("file_path", utf82(), false),
5118
- field2("expected_schema", binary2(), false)
5119
- ]);
5120
- var COPY_FROM_FIELD = field2("copy_from", COPY_FROM_STRUCT_TYPE, true);
5121
- var COPY_TO_STRUCT_TYPE = struct2([
5122
- field2("format", utf82(), false),
5123
- field2("file_path", utf82(), false)
5124
- ]);
5125
- var COPY_TO_FIELD = field2("copy_to", COPY_TO_STRUCT_TYPE, true);
5126
- var BIND_RESPONSE_SCHEMA = schema2([
5127
- field2("output_schema", binary2(), false),
5128
- field2("opaque_data", binary2(), true),
5129
- field2("lookup_secret_types", list2(field2("item", utf82(), true)), false),
5130
- field2("lookup_scopes", list2(field2("item", utf82(), true)), false),
5131
- field2("lookup_names", list2(field2("item", utf82(), true)), false)
5132
- ]);
5133
5218
  function serializeBindRequest(req) {
5134
- const row = {
5219
+ return buildSingleRowBatch(BIND_REQUEST_SCHEMA, {
5135
5220
  function_name: req.function_name,
5136
5221
  arguments: serializeArguments(req.arguments),
5137
5222
  function_type: req.function_type,
@@ -5143,29 +5228,14 @@ function serializeBindRequest(req) {
5143
5228
  resolved_secrets_provided: req.resolved_secrets_provided ?? false,
5144
5229
  at_unit: req.at_unit ?? null,
5145
5230
  at_value: req.at_value ?? null,
5146
- schema_name: req.schema_name ?? null
5147
- };
5148
- const extraFields = [];
5149
- if (req.copy_from) {
5150
- extraFields.push(COPY_FROM_FIELD);
5151
- row.copy_from = {
5231
+ copy_from: req.copy_from ? {
5152
5232
  format: req.copy_from.format,
5153
5233
  file_path: req.copy_from.file_path,
5154
5234
  expected_schema: serializeSchema(req.copy_from.expected_schema)
5155
- };
5156
- }
5157
- if (req.copy_to) {
5158
- extraFields.push(COPY_TO_FIELD);
5159
- row.copy_to = {
5160
- format: req.copy_to.format,
5161
- file_path: req.copy_to.file_path
5162
- };
5163
- }
5164
- if (extraFields.length > 0) {
5165
- const schemaWithCopy = schema2([...BIND_REQUEST_SCHEMA.fields, ...extraFields]);
5166
- return buildSingleRowBatch(schemaWithCopy, row);
5167
- }
5168
- return buildSingleRowBatch(BIND_REQUEST_SCHEMA, row);
5235
+ } : null,
5236
+ copy_to: req.copy_to ? { format: req.copy_to.format, file_path: req.copy_to.file_path } : null,
5237
+ schema_name: req.schema_name ?? null
5238
+ });
5169
5239
  }
5170
5240
  function parseCopyFromContext(raw) {
5171
5241
  if (raw == null)
@@ -5252,20 +5322,22 @@ var INIT_REQUEST_SCHEMA = schema2([
5252
5322
  field2("bind_call", binary2(), false),
5253
5323
  field2("output_schema", binary2(), false),
5254
5324
  field2("bind_opaque_data", binary2(), true),
5255
- field2("projection_ids", list2(field2("item", int642(), false)), true),
5256
- field2("pushdown_filters", binary2(), true),
5257
- field2("join_keys", list2(field2("item", binary2(), true)), false),
5258
- field2("phase", utf82(), true),
5325
+ field2("projection_ids", list2(field2("item", int642(), true)), true),
5326
+ field2("pushdown_filters", largeBinary2(), true),
5327
+ field2("join_keys", list2(field2("item", largeBinary2(), true)), true),
5328
+ field2("split_tokens", list2(field2("item", largeBinary2(), true)), true),
5329
+ field2("row_limit", int642(), true),
5330
+ field2("phase", dictionary2(utf82(), int162()), true),
5331
+ field2("finalize_state_id", binary2(), true),
5259
5332
  field2("execution_id", binary2(), true),
5260
5333
  field2("init_opaque_data", binary2(), true),
5261
5334
  field2("substream_id", binary2(), true),
5262
5335
  field2("order_by_column_name", utf82(), true),
5263
- field2("order_by_direction", utf82(), true),
5264
- field2("order_by_null_order", utf82(), true),
5336
+ field2("order_by_direction", dictionary2(utf82(), int162()), true),
5337
+ field2("order_by_null_order", dictionary2(utf82(), int162()), true),
5265
5338
  field2("order_by_limit", int642(), true),
5266
5339
  field2("tablesample_percentage", float642(), true),
5267
- field2("tablesample_seed", int642(), true),
5268
- field2("finalize_state_id", binary2(), true)
5340
+ field2("tablesample_seed", int642(), true)
5269
5341
  ]);
5270
5342
  var GLOBAL_INIT_RESPONSE_SCHEMA = schema2([
5271
5343
  field2("execution_id", binary2(), false),
@@ -5282,7 +5354,10 @@ function serializeInitRequest(req) {
5282
5354
  projection_ids: req.projection_ids?.map((n) => BigInt(n)) ?? null,
5283
5355
  pushdown_filters: req.pushdown_filters ? serializeBatch(req.pushdown_filters) : null,
5284
5356
  join_keys: (req.join_keys ?? []).map((b) => serializeBatch(b)),
5357
+ split_tokens: req.split_tokens ?? null,
5358
+ row_limit: req.row_limit ?? null,
5285
5359
  phase: req.phase ?? null,
5360
+ finalize_state_id: req.finalize_state_id ?? null,
5286
5361
  execution_id: req.execution_id ?? null,
5287
5362
  init_opaque_data: req.init_opaque_data ?? null,
5288
5363
  substream_id: req.substream_id ?? null,
@@ -5291,8 +5366,7 @@ function serializeInitRequest(req) {
5291
5366
  order_by_null_order: req.order_by_null_order ?? null,
5292
5367
  order_by_limit: req.order_by_limit ?? null,
5293
5368
  tablesample_percentage: req.tablesample_percentage ?? null,
5294
- tablesample_seed: req.tablesample_seed ?? null,
5295
- finalize_state_id: req.finalize_state_id ?? null
5369
+ tablesample_seed: req.tablesample_seed ?? null
5296
5370
  };
5297
5371
  return buildSingleRowBatch(INIT_REQUEST_SCHEMA, row);
5298
5372
  }
@@ -5341,10 +5415,19 @@ function deserializeInitRequest(params) {
5341
5415
  output_schema: deserializeSchema(toUint8Array2(params.output_schema)),
5342
5416
  bind_opaque_data: params.bind_opaque_data ? toUint8Array2(params.bind_opaque_data) : null,
5343
5417
  projection_ids: projectionIds,
5418
+ row_limit: params.row_limit == null ? null : Number(params.row_limit),
5344
5419
  pushdown_filters: params.pushdown_filters ? deserializeBatch(toUint8Array2(params.pushdown_filters)) : null,
5345
5420
  join_keys: joinKeys,
5346
5421
  phase,
5347
5422
  finalize_state_id: params.finalize_state_id ? toUint8Array2(params.finalize_state_id) : null,
5423
+ split_tokens: (() => {
5424
+ const raw = params.split_tokens;
5425
+ if (raw == null)
5426
+ return null;
5427
+ const iter = Array.isArray(raw) ? raw : typeof raw[Symbol.iterator] === "function" ? raw : [];
5428
+ const tokens = [...iter].filter((e) => e != null).map((e) => toUint8Array2(e));
5429
+ return tokens.length > 0 ? tokens : null;
5430
+ })(),
5348
5431
  execution_id: params.execution_id ? toUint8Array2(params.execution_id) : null,
5349
5432
  init_opaque_data: params.init_opaque_data ? toUint8Array2(params.init_opaque_data) : null,
5350
5433
  substream_id: params.substream_id ? toUint8Array2(params.substream_id) : null,
@@ -5420,10 +5503,6 @@ function deserializeGlobalInitResponse(params) {
5420
5503
  }
5421
5504
  // src/protocol/serializers/cardinality.ts
5422
5505
  init_arrow();
5423
- var TABLE_CARDINALITY_SCHEMA = schema2([
5424
- field2("estimate", int642(), true),
5425
- field2("max", int642(), true)
5426
- ]);
5427
5506
  var TABLE_FUNCTION_CARDINALITY_REQUEST_SCHEMA = schema2([
5428
5507
  field2("bind_call", binary2(), false),
5429
5508
  field2("bind_opaque_data", binary2(), true)
@@ -5446,6 +5525,7 @@ function serializeTableCardinality(card) {
5446
5525
  }
5447
5526
  // src/functions/table-buffering.ts
5448
5527
  function defineTableBufferingFunction(config) {
5528
+ assertArrowTypes(config.args, `defineTableBufferingFunction("${config.name}"): args`);
5449
5529
  if (config.sinkOrderDependent && config.requiresInputBatchIndex) {
5450
5530
  throw new Error(`${config.name}: sinkOrderDependent and requiresInputBatchIndex are ` + `mutually exclusive — single-thread sink already orders input.`);
5451
5531
  }
@@ -5763,8 +5843,7 @@ function defineCopyFromFunction(config) {
5763
5843
  }
5764
5844
  val = opt.default;
5765
5845
  }
5766
- if (typeof val === "bigint")
5767
- val = safeNumber(val);
5846
+ val = narrowArgValue(val);
5768
5847
  if (opt.choices && !opt.choices.includes(val)) {
5769
5848
  throw new Error(`COPY (FORMAT ${config.format}): option '${name}' value ${JSON.stringify(val)} ` + `is not one of ${JSON.stringify(opt.choices)}`);
5770
5849
  }
@@ -5878,8 +5957,7 @@ function defineCopyToFunction(config) {
5878
5957
  }
5879
5958
  val = opt.default;
5880
5959
  }
5881
- if (typeof val === "bigint")
5882
- val = safeNumber(val);
5960
+ val = narrowArgValue(val);
5883
5961
  if (opt.choices && !opt.choices.includes(val)) {
5884
5962
  throw new Error(`COPY (FORMAT ${config.format}): option '${name}' value ${JSON.stringify(val)} ` + `is not one of ${JSON.stringify(opt.choices)}`);
5885
5963
  }
@@ -6062,7 +6140,7 @@ var CatalogInfoSchema = schema2([
6062
6140
  field2("implementation_version", utf82(), true),
6063
6141
  field2("data_version_spec", utf82(), true),
6064
6142
  field2("attach_option_specs", list2(field2("item", binary2(), true)), false),
6065
- field2("releases", list2(field2("item", struct2([field2("version", utf82(), false), field2("released_at", timestamp2(TimeUnit2.MICROSECOND, "UTC"), false), field2("summary", utf82(), false), field2("notes_url", utf82(), true)]), true)), false),
6143
+ field2("releases", list2(field2("item", struct2([field2("version", utf82(), false), field2("released_at", timestamp2(TimeUnit2.MICROSECOND, "UTC"), true), field2("summary", utf82(), false), field2("notes_url", utf82(), true)]), true)), false),
6066
6144
  field2("source_url", utf82(), true)
6067
6145
  ]);
6068
6146
  var SchemaInfoSchema = schema2([
@@ -6088,14 +6166,14 @@ var TableInfoSchema = schema2([
6088
6166
  field2("supports_delete", bool2(), false),
6089
6167
  field2("supports_returning", bool2(), false),
6090
6168
  field2("supports_column_statistics", bool2(), false),
6091
- field2("scan_function", binary2(), false),
6092
- field2("insert_function", binary2(), false),
6093
- field2("update_function", binary2(), false),
6094
- field2("delete_function", binary2(), false),
6095
- field2("cardinality_estimate", int642(), false),
6096
- field2("cardinality_max", int642(), false),
6097
- field2("column_statistics", binary2(), false),
6098
- field2("bind_result", binary2(), false),
6169
+ field2("scan_function", binary2(), true),
6170
+ field2("insert_function", binary2(), true),
6171
+ field2("update_function", binary2(), true),
6172
+ field2("delete_function", binary2(), true),
6173
+ field2("cardinality_estimate", int642(), true),
6174
+ field2("cardinality_max", int642(), true),
6175
+ field2("column_statistics", binary2(), true),
6176
+ field2("bind_result", binary2(), true),
6099
6177
  field2("required_filters", list2(field2("item", list2(field2("item", utf82(), true)), true)), false)
6100
6178
  ]);
6101
6179
  var ViewInfoSchema = schema2([
@@ -6125,8 +6203,12 @@ var FunctionInfoSchema = schema2([
6125
6203
  field2("late_materialization", bool2(), true),
6126
6204
  field2("supported_expression_filters", list2(field2("item", utf82(), true)), false),
6127
6205
  field2("order_preservation", dictionary2(utf82(), int162()), true),
6128
- field2("max_workers", int322(), false),
6206
+ field2("max_workers", int322(), true),
6129
6207
  field2("supports_batch_index", bool2(), false),
6208
+ field2("supports_splits", bool2(), false),
6209
+ field2("filters_exactly_applied", bool2(), false),
6210
+ field2("supports_positions", bool2(), false),
6211
+ field2("split_token_ttl_seconds", int642(), true),
6130
6212
  field2("partition_kind", dictionary2(utf82(), int162()), false),
6131
6213
  field2("order_dependent", dictionary2(utf82(), int162()), false),
6132
6214
  field2("distinct_dependent", dictionary2(utf82(), int162()), false),
@@ -6147,9 +6229,9 @@ var MacroInfoSchema = schema2([
6147
6229
  field2("schema_name", utf82(), false),
6148
6230
  field2("macro_type", dictionary2(utf82(), int162()), false),
6149
6231
  field2("parameters", list2(field2("item", utf82(), true)), false),
6150
- field2("parameter_default_values", binary2(), false),
6232
+ field2("parameter_default_values", binary2(), true),
6151
6233
  field2("definition", utf82(), false),
6152
- field2("arguments_schema", binary2(), false)
6234
+ field2("arguments_schema", binary2(), true)
6153
6235
  ]);
6154
6236
  var IndexInfoSchema = schema2([
6155
6237
  field2("comment", utf82(), true),
@@ -6188,7 +6270,22 @@ var ScanBranchSchema = schema2([
6188
6270
  field2("writable", bool2(), false),
6189
6271
  field2("source_catalog", utf82(), true),
6190
6272
  field2("source_schema", utf82(), true),
6191
- field2("source_table", utf82(), true)
6273
+ field2("source_table", utf82(), true),
6274
+ field2("format_name", utf82(), true),
6275
+ field2("format_locations", list2(field2("item", utf82(), true)), true),
6276
+ field2("format_options", binary2(), true)
6277
+ ]);
6278
+ var ScanSplitSchema = schema2([
6279
+ field2("payload", binary2(), false),
6280
+ field2("token", binary2(), false),
6281
+ field2("estimated_rows", int642(), true),
6282
+ field2("rows_exact", bool2(), false),
6283
+ field2("estimated_bytes", int642(), true),
6284
+ field2("partition_bounds", binary2(), true),
6285
+ field2("column_statistics", binary2(), true),
6286
+ field2("location_ids", list2(field2("item", int642(), true)), true),
6287
+ field2("start_position", binary2(), true),
6288
+ field2("end_position", binary2(), true)
6192
6289
  ]);
6193
6290
  var AttachCatalogInfoSchema = schema2([
6194
6291
  field2("alias", utf82(), false),
@@ -6199,41 +6296,187 @@ var AttachCatalogInfoSchema = schema2([
6199
6296
  field2("required", bool2(), false),
6200
6297
  field2("secret_ref", utf82(), false)
6201
6298
  ]);
6202
- var AggregateBindResultSchema = schema2([
6203
- field2("output_schema", binary2(), false),
6204
- field2("execution_id", binary2(), false)
6205
- ]);
6206
- var AggregateCombineResultSchema = schema2([]);
6207
- var AggregateDestructorResultSchema = schema2([]);
6208
- var AggregateFinalizeResultSchema = schema2([
6209
- field2("result_batch", binary2(), false)
6210
- ]);
6211
- var AggregateStreamingChunkResultSchema = schema2([
6212
- field2("result_batch", binary2(), false)
6213
- ]);
6214
- var AggregateStreamingCloseResultSchema = schema2([]);
6215
- var AggregateStreamingOpenResultSchema = schema2([
6216
- field2("execution_id", binary2(), false)
6299
+ var AggregateBindRequestSchema = schema2([
6300
+ field2("function_name", utf82(), false),
6301
+ field2("arguments", binary2(), false),
6302
+ field2("input_schema", binary2(), true),
6303
+ field2("settings", binary2(), true),
6304
+ field2("secrets", binary2(), true),
6305
+ field2("attach_opaque_data", binary2(), true),
6306
+ field2("schema_name", utf82(), true)
6217
6307
  ]);
6218
- var AggregateUpdateResultSchema = schema2([]);
6219
- var AggregateWindowResultSchema = schema2([
6220
- field2("result_batch", binary2(), false)
6308
+ var AggregateCombineRequestSchema = schema2([
6309
+ field2("function_name", utf82(), false),
6310
+ field2("execution_id", binary2(), false),
6311
+ field2("merge_batch", binary2(), false),
6312
+ field2("attach_opaque_data", binary2(), true),
6313
+ field2("schema_name", utf82(), true)
6221
6314
  ]);
6222
- var AggregateWindowBatchResultSchema = schema2([
6223
- field2("result_batch", binary2(), false)
6315
+ var AggregateDestructorRequestSchema = schema2([
6316
+ field2("function_name", utf82(), false),
6317
+ field2("execution_id", binary2(), false),
6318
+ field2("group_ids_batch", binary2(), false),
6319
+ field2("attach_opaque_data", binary2(), true),
6320
+ field2("schema_name", utf82(), true)
6224
6321
  ]);
6225
- var AggregateWindowDestructorResultSchema = schema2([]);
6226
- var AggregateWindowInitResultSchema = schema2([]);
6227
- var BindResultSchema = schema2([
6322
+ var AggregateFinalizeRequestSchema = schema2([
6323
+ field2("function_name", utf82(), false),
6324
+ field2("execution_id", binary2(), false),
6325
+ field2("group_ids_batch", binary2(), false),
6228
6326
  field2("output_schema", binary2(), false),
6229
- field2("opaque_data", binary2(), false),
6230
- field2("lookup_secret_types", list2(field2("item", utf82(), true)), false),
6231
- field2("lookup_scopes", list2(field2("item", utf82(), true)), false),
6232
- field2("lookup_names", list2(field2("item", utf82(), true)), false)
6327
+ field2("attach_opaque_data", binary2(), true),
6328
+ field2("schema_name", utf82(), true)
6233
6329
  ]);
6234
- var CatalogAttachResultSchema = schema2([
6235
- field2("attach_opaque_data", binary2(), false),
6236
- field2("supports_transactions", bool2(), false),
6330
+ var AggregateUpdateRequestSchema = schema2([
6331
+ field2("function_name", utf82(), false),
6332
+ field2("execution_id", binary2(), false),
6333
+ field2("input_batch", binary2(), false),
6334
+ field2("attach_opaque_data", binary2(), true),
6335
+ field2("schema_name", utf82(), true)
6336
+ ]);
6337
+ var BindRequestSchema = schema2([
6338
+ field2("function_name", utf82(), false),
6339
+ field2("arguments", binary2(), false),
6340
+ field2("function_type", dictionary2(utf82(), int162()), false),
6341
+ field2("input_schema", binary2(), true),
6342
+ field2("settings", binary2(), true),
6343
+ field2("secrets", binary2(), true),
6344
+ field2("attach_opaque_data", binary2(), true),
6345
+ field2("transaction_opaque_data", binary2(), true),
6346
+ field2("resolved_secrets_provided", bool2(), false),
6347
+ field2("at_unit", utf82(), true),
6348
+ field2("at_value", utf82(), true),
6349
+ field2("copy_from", struct2([field2("format", utf82(), false), field2("file_path", utf82(), false), field2("expected_schema", binary2(), false)]), true),
6350
+ field2("copy_to", struct2([field2("format", utf82(), false), field2("file_path", utf82(), false)]), true),
6351
+ field2("schema_name", utf82(), true)
6352
+ ]);
6353
+ var CatalogAttachRequestSchema = schema2([
6354
+ field2("name", utf82(), false),
6355
+ field2("options", binary2(), true),
6356
+ field2("data_version_spec", utf82(), true),
6357
+ field2("implementation_version", utf82(), true),
6358
+ field2("client_capabilities", binary2(), true)
6359
+ ]);
6360
+ var CopyFromContextSchema = schema2([
6361
+ field2("format", utf82(), false),
6362
+ field2("file_path", utf82(), false),
6363
+ field2("expected_schema", binary2(), false)
6364
+ ]);
6365
+ var CopyToContextSchema = schema2([
6366
+ field2("format", utf82(), false),
6367
+ field2("file_path", utf82(), false)
6368
+ ]);
6369
+ var GlobalInitResponseSchema = schema2([
6370
+ field2("execution_id", binary2(), false),
6371
+ field2("opaque_data", binary2(), true),
6372
+ field2("max_workers", int642(), false)
6373
+ ]);
6374
+ var InitRequestSchema = schema2([
6375
+ field2("bind_call", binary2(), false),
6376
+ field2("output_schema", binary2(), false),
6377
+ field2("bind_opaque_data", binary2(), true),
6378
+ field2("projection_ids", list2(field2("item", int642(), true)), true),
6379
+ field2("pushdown_filters", largeBinary2(), true),
6380
+ field2("join_keys", list2(field2("item", largeBinary2(), true)), true),
6381
+ field2("split_tokens", list2(field2("item", largeBinary2(), true)), true),
6382
+ field2("row_limit", int642(), true),
6383
+ field2("phase", dictionary2(utf82(), int162()), true),
6384
+ field2("finalize_state_id", binary2(), true),
6385
+ field2("execution_id", binary2(), true),
6386
+ field2("init_opaque_data", binary2(), true),
6387
+ field2("substream_id", binary2(), true),
6388
+ field2("order_by_column_name", utf82(), true),
6389
+ field2("order_by_direction", dictionary2(utf82(), int162()), true),
6390
+ field2("order_by_null_order", dictionary2(utf82(), int162()), true),
6391
+ field2("order_by_limit", int642(), true),
6392
+ field2("tablesample_percentage", float642(), true),
6393
+ field2("tablesample_seed", int642(), true)
6394
+ ]);
6395
+ var TableBufferingCombineRequestSchema = schema2([
6396
+ field2("function_name", utf82(), false),
6397
+ field2("execution_id", binary2(), false),
6398
+ field2("state_ids", list2(field2("item", binary2(), true)), false),
6399
+ field2("attach_opaque_data", binary2(), true),
6400
+ field2("transaction_id", binary2(), true),
6401
+ field2("schema_name", utf82(), true)
6402
+ ]);
6403
+ var TableBufferingDestructorRequestSchema = schema2([
6404
+ field2("function_name", utf82(), false),
6405
+ field2("execution_id", binary2(), false),
6406
+ field2("attach_opaque_data", binary2(), true),
6407
+ field2("transaction_id", binary2(), true),
6408
+ field2("schema_name", utf82(), true)
6409
+ ]);
6410
+ var TableBufferingProcessRequestSchema = schema2([
6411
+ field2("function_name", utf82(), false),
6412
+ field2("execution_id", binary2(), false),
6413
+ field2("input_batch", binary2(), false),
6414
+ field2("attach_opaque_data", binary2(), true),
6415
+ field2("transaction_id", binary2(), true),
6416
+ field2("batch_index", int642(), true),
6417
+ field2("schema_name", utf82(), true)
6418
+ ]);
6419
+ var TableFunctionCardinalityRequestSchema = schema2([
6420
+ field2("bind_call", binary2(), false),
6421
+ field2("bind_opaque_data", binary2(), true)
6422
+ ]);
6423
+ var TableFunctionPlanRequestSchema = schema2([
6424
+ field2("bind_call", binary2(), false),
6425
+ field2("bind_opaque_data", binary2(), true),
6426
+ field2("projection_ids", list2(field2("item", int642(), true)), true),
6427
+ field2("pushdown_filters", largeBinary2(), true),
6428
+ field2("join_keys", list2(field2("item", largeBinary2(), true)), true),
6429
+ field2("row_limit", int642(), true),
6430
+ field2("target_split_bytes", int642(), true),
6431
+ field2("min_splits", int642(), true),
6432
+ field2("max_splits_per_response", int642(), true),
6433
+ field2("cursor", binary2(), true),
6434
+ field2("refined_filters", largeBinary2(), true),
6435
+ field2("filters_complete", bool2(), false),
6436
+ field2("start_position", binary2(), true),
6437
+ field2("end_position", binary2(), true),
6438
+ field2("order_by_column_name", utf82(), true),
6439
+ field2("order_by_direction", dictionary2(utf82(), int162()), true),
6440
+ field2("order_by_null_order", dictionary2(utf82(), int162()), true),
6441
+ field2("order_by_limit", int642(), true),
6442
+ field2("tablesample_percentage", float642(), true),
6443
+ field2("tablesample_seed", int642(), true)
6444
+ ]);
6445
+ var AggregateBindResultSchema = schema2([
6446
+ field2("output_schema", binary2(), false),
6447
+ field2("execution_id", binary2(), false)
6448
+ ]);
6449
+ var AggregateCombineResultSchema = schema2([]);
6450
+ var AggregateDestructorResultSchema = schema2([]);
6451
+ var AggregateFinalizeResultSchema = schema2([
6452
+ field2("result_batch", binary2(), false)
6453
+ ]);
6454
+ var AggregateStreamingChunkResultSchema = schema2([
6455
+ field2("result_batch", binary2(), false)
6456
+ ]);
6457
+ var AggregateStreamingCloseResultSchema = schema2([]);
6458
+ var AggregateStreamingOpenResultSchema = schema2([
6459
+ field2("execution_id", binary2(), false)
6460
+ ]);
6461
+ var AggregateUpdateResultSchema = schema2([]);
6462
+ var AggregateWindowResultSchema = schema2([
6463
+ field2("result_batch", binary2(), false)
6464
+ ]);
6465
+ var AggregateWindowBatchResultSchema = schema2([
6466
+ field2("result_batch", binary2(), false)
6467
+ ]);
6468
+ var AggregateWindowDestructorResultSchema = schema2([]);
6469
+ var AggregateWindowInitResultSchema = schema2([]);
6470
+ var BindResultSchema = schema2([
6471
+ field2("output_schema", binary2(), false),
6472
+ field2("opaque_data", binary2(), true),
6473
+ field2("lookup_secret_types", list2(field2("item", utf82(), true)), false),
6474
+ field2("lookup_scopes", list2(field2("item", utf82(), true)), false),
6475
+ field2("lookup_names", list2(field2("item", utf82(), true)), false)
6476
+ ]);
6477
+ var CatalogAttachResultSchema = schema2([
6478
+ field2("attach_opaque_data", binary2(), false),
6479
+ field2("supports_transactions", bool2(), false),
6237
6480
  field2("supports_time_travel", bool2(), false),
6238
6481
  field2("catalog_version_frozen", bool2(), false),
6239
6482
  field2("catalog_version", int642(), false),
@@ -6310,6 +6553,24 @@ var TableFunctionDynamicToStringResultSchema = schema2([
6310
6553
  field2("keys", list2(field2("item", utf82(), true)), false),
6311
6554
  field2("values", list2(field2("item", utf82(), true)), false)
6312
6555
  ]);
6556
+ var TableFunctionPlanResultSchema = schema2([
6557
+ field2("splits", list2(field2("item", binary2(), true)), false),
6558
+ field2("next_cursors", list2(field2("item", binary2(), true)), true),
6559
+ field2("execution_id", binary2(), true),
6560
+ field2("init_opaque_data", binary2(), true),
6561
+ field2("max_workers", int642(), true),
6562
+ field2("estimated_total_splits", int642(), true),
6563
+ field2("estimated_total_rows", int642(), true),
6564
+ field2("estimated_total_bytes", int642(), true),
6565
+ field2("catalog_version", int642(), true),
6566
+ field2("scope", utf82(), false),
6567
+ field2("locations", list2(field2("item", utf82(), true)), true),
6568
+ field2("partitioning", list2(field2("item", binary2(), true)), true),
6569
+ field2("sort_order", list2(field2("item", binary2(), true)), true),
6570
+ field2("cache_max_age_seconds", int642(), true),
6571
+ field2("start_position", binary2(), true),
6572
+ field2("end_position", binary2(), true)
6573
+ ]);
6313
6574
  var AggregateBindParamsSchema = schema2([
6314
6575
  field2("request", binary2(), false)
6315
6576
  ]);
@@ -6676,6 +6937,9 @@ var TableFunctionCardinalityParamsSchema = schema2([
6676
6937
  var TableFunctionDynamicToStringParamsSchema = schema2([
6677
6938
  field2("request", binary2(), false)
6678
6939
  ]);
6940
+ var TableFunctionPlanParamsSchema = schema2([
6941
+ field2("request", binary2(), false)
6942
+ ]);
6679
6943
  var TableFunctionStatisticsParamsSchema = schema2([
6680
6944
  field2("request", binary2(), false)
6681
6945
  ]);
@@ -6715,6 +6979,13 @@ var encodeAttachCatalogInfo = (v) => encodeASD(AttachCatalogInfoSchema, {
6715
6979
  required: v.required ?? false,
6716
6980
  secret_ref: v.secret_ref ?? ""
6717
6981
  });
6982
+ function encodeScanFunctionResult(functionName, argumentsBytes, requiredExtensions = []) {
6983
+ return serializeBatch(batchFromColumns({
6984
+ function_name: [functionName],
6985
+ arguments: [argumentsBytes],
6986
+ required_extensions: [requiredExtensions]
6987
+ }, ScanFunctionResultSchema));
6988
+ }
6718
6989
  function decodeScanFunctionResult(inner) {
6719
6990
  const argsBytes = inner.arguments;
6720
6991
  const positionalArguments = [];
@@ -6744,20 +7015,36 @@ function decodeScanFunctionResult(inner) {
6744
7015
  };
6745
7016
  }
6746
7017
  function singleBranchResult(legacy) {
6747
- const branchBatch = batchFromColumns({
6748
- function_name: [legacy.function_name],
6749
- arguments: [toUint8Array(legacy.arguments)],
6750
- branch_filter: [null],
6751
- writable: [false],
6752
- source_catalog: [null],
6753
- source_schema: [null],
6754
- source_table: [null]
6755
- }, ScanBranchSchema);
6756
7018
  return {
6757
- branches: [serializeBatch(branchBatch)],
7019
+ branches: [
7020
+ encodeScanBranch({ function_name: legacy.function_name, arguments: toUint8Array(legacy.arguments) })
7021
+ ],
6758
7022
  required_extensions: legacy.required_extensions ?? []
6759
7023
  };
6760
7024
  }
7025
+ function encodeScanBranch(cols) {
7026
+ return serializeBatch(batchFromColumns({
7027
+ function_name: [cols.function_name],
7028
+ arguments: [cols.arguments],
7029
+ branch_filter: [cols.branch_filter ?? null],
7030
+ writable: [cols.writable ?? false],
7031
+ source_catalog: [cols.source_catalog ?? null],
7032
+ source_schema: [cols.source_schema ?? null],
7033
+ source_table: [cols.source_table ?? null],
7034
+ format_name: [cols.format_name ?? null],
7035
+ format_locations: [cols.format_locations ?? null],
7036
+ format_options: [cols.format_options ?? null]
7037
+ }, ScanBranchSchema));
7038
+ }
7039
+ function encodeFormatOptions(options) {
7040
+ const fields = [];
7041
+ const values = {};
7042
+ for (const [name, arg] of Object.entries(options)) {
7043
+ fields.push(field2(name, arg.type, true));
7044
+ values[name] = [arg.value];
7045
+ }
7046
+ return serializeBatch(batchFromColumns(values, schema2(fields)));
7047
+ }
6761
7048
  function serializeBranchArguments(branch) {
6762
7049
  const fields = [];
6763
7050
  const values = {};
@@ -6775,18 +7062,18 @@ function serializeBranchArguments(branch) {
6775
7062
  return serializeBatch(batchFromColumns(values, batchSchema));
6776
7063
  }
6777
7064
  function buildScanBranchesResult(branches, requiredExtensions = []) {
6778
- const serializedBranches = branches.map((branch) => {
6779
- const branchBatch = batchFromColumns({
6780
- function_name: [branch.functionName],
6781
- arguments: [serializeBranchArguments(branch)],
6782
- branch_filter: [branch.branchFilter ?? null],
6783
- writable: [branch.writable ?? false],
6784
- source_catalog: [branch.sourceCatalog ?? null],
6785
- source_schema: [branch.sourceSchema ?? null],
6786
- source_table: [branch.sourceTable ?? null]
6787
- }, ScanBranchSchema);
6788
- return serializeBatch(branchBatch);
6789
- });
7065
+ const serializedBranches = branches.map((branch) => encodeScanBranch({
7066
+ function_name: branch.functionName,
7067
+ arguments: serializeBranchArguments(branch),
7068
+ branch_filter: branch.branchFilter,
7069
+ writable: branch.writable,
7070
+ source_catalog: branch.sourceCatalog,
7071
+ source_schema: branch.sourceSchema,
7072
+ source_table: branch.sourceTable,
7073
+ format_name: branch.formatName,
7074
+ format_locations: branch.formatLocations,
7075
+ format_options: branch.formatOptions
7076
+ }));
6790
7077
  return {
6791
7078
  branches: serializedBranches,
6792
7079
  required_extensions: requiredExtensions
@@ -7389,6 +7676,10 @@ class ReadOnlyCatalogInterface extends CatalogInterface {
7389
7676
  order_preservation: meta.preservesOrder,
7390
7677
  max_workers: meta.maxWorkers ?? DEFAULT_MAX_WORKERS,
7391
7678
  supports_batch_index: f.kind === "table_buffering" && f.meta.requiresInputBatchIndex === true || f.kind === "table" && f.meta.supportsBatchIndex === true,
7679
+ supports_splits: f.kind === "table" && f.meta.supportsSplits === true,
7680
+ filters_exactly_applied: f.kind === "table" && f.meta.filtersExactlyApplied === true,
7681
+ supports_positions: f.kind === "table" && f.meta.supportsPositions === true,
7682
+ split_token_ttl_seconds: f.kind === "table" ? f.meta.splitTokenTtlSeconds ?? null : null,
7392
7683
  partition_kind: f.kind === "table" && f.meta.partitionKind ? f.meta.partitionKind : "NOT_PARTITIONED",
7393
7684
  order_dependent: meta.orderDependent,
7394
7685
  distinct_dependent: meta.distinctDependent,
@@ -7739,17 +8030,7 @@ function inferScalarType2(val) {
7739
8030
  function inlineScanFunction(func, args) {
7740
8031
  const argSchema = argumentSpecsToSchema(func.argumentSpecs);
7741
8032
  const argBytes = serializeArgsBatch(args ?? new Arguments, argSchema);
7742
- const scanSchema = schema2([
7743
- field2("function_name", utf82(), false),
7744
- field2("arguments", binary2(), false),
7745
- field2("required_extensions", list2(field2("item", utf82(), true)), false)
7746
- ]);
7747
- const batch = batchFromColumns({
7748
- function_name: [func.meta.name],
7749
- arguments: [argBytes],
7750
- required_extensions: [[]]
7751
- }, scanSchema);
7752
- return serializeBatch(batch);
8033
+ return encodeScanFunctionResult(func.meta.name, argBytes);
7753
8034
  }
7754
8035
  // src/catalog/composite.ts
7755
8036
  var ROUTE_BYTE = 0;
@@ -9248,57 +9529,232 @@ function decodeOptionsBatch(bytes) {
9248
9529
  return row ?? {};
9249
9530
  }
9250
9531
  var emptyResultSchema = schema2([]);
9251
- var attachOpaqueDataParam = schema2([
9252
- field2("attach_opaque_data", binary2(), true)
9253
- ]);
9254
- var attachOpaqueDataTxnParams = schema2([
9255
- field2("attach_opaque_data", binary2(), true),
9256
- field2("transaction_opaque_data", binary2(), true)
9257
- ]);
9258
- var attachOpaqueDataNameTxnParams = schema2([
9259
- field2("attach_opaque_data", binary2(), true),
9260
- field2("name", utf82(), false),
9261
- field2("transaction_opaque_data", binary2(), true)
9262
- ]);
9263
- var attachOpaqueDataSchemaNameTxnParams = schema2([
9264
- field2("attach_opaque_data", binary2(), true),
9265
- field2("schema_name", utf82(), false),
9266
- field2("name", utf82(), false),
9267
- field2("transaction_opaque_data", binary2(), true)
9268
- ]);
9269
- var schemaNameIgnoreNotFoundTxnParams = schema2([
9270
- field2("attach_opaque_data", binary2(), true),
9271
- field2("schema_name", utf82(), false),
9272
- field2("name", utf82(), false),
9273
- field2("ignore_not_found", bool2(), true),
9274
- field2("transaction_opaque_data", binary2(), true)
9275
- ]);
9276
- var schemaNameCommentParams = schema2([
9277
- field2("attach_opaque_data", binary2(), true),
9278
- field2("schema_name", utf82(), false),
9279
- field2("name", utf82(), false),
9280
- field2("comment", utf82(), true),
9281
- field2("ignore_not_found", bool2(), true),
9282
- field2("transaction_opaque_data", binary2(), true)
9283
- ]);
9284
- var schemaNameRenameParams = schema2([
9285
- field2("attach_opaque_data", binary2(), true),
9286
- field2("schema_name", utf82(), false),
9287
- field2("name", utf82(), false),
9288
- field2("new_name", utf82(), false),
9289
- field2("ignore_not_found", bool2(), true),
9290
- field2("transaction_opaque_data", binary2(), true)
9291
- ]);
9292
- var columnOpParams = schema2([
9293
- field2("attach_opaque_data", binary2(), true),
9294
- field2("schema_name", utf82(), false),
9295
- field2("name", utf82(), false),
9296
- field2("column_name", utf82(), false),
9297
- field2("ignore_not_found", bool2(), true),
9298
- field2("transaction_opaque_data", binary2(), true)
9299
- ]);
9532
+
9533
+ // src/request-auth.ts
9534
+ var scope;
9535
+ function currentRequestAuth() {
9536
+ return scope?.getStore()?.auth;
9537
+ }
9538
+
9539
+ // src/protocol/serializers/splits.ts
9540
+ var SCAN_SPLIT_SCHEMA = ScanSplitSchema;
9541
+ var PLAN_RESPONSE_SCHEMA = TableFunctionPlanResultSchema;
9542
+ function deserializePlanRequest(params) {
9543
+ const bindCallBytes = toUint8Array2(params.bind_call);
9544
+ const bindCall = deserializeBindRequest(batchToScalarDict(deserializeBatch(bindCallBytes)));
9545
+ let projectionIds = null;
9546
+ if (params.projection_ids != null) {
9547
+ const raw = params.projection_ids;
9548
+ if (Array.isArray(raw))
9549
+ projectionIds = raw.map(Number);
9550
+ else if (raw && typeof raw[Symbol.iterator] === "function")
9551
+ projectionIds = [...raw].map(Number);
9552
+ }
9553
+ const asBigInt = (v) => v == null ? null : typeof v === "bigint" ? v : BigInt(Number(v));
9554
+ return {
9555
+ bind_call: bindCall,
9556
+ bind_opaque_data: params.bind_opaque_data ? toUint8Array2(params.bind_opaque_data) : null,
9557
+ projection_ids: projectionIds,
9558
+ pushdown_filters: params.pushdown_filters ? toUint8Array2(params.pushdown_filters) : null,
9559
+ target_split_bytes: asBigInt(params.target_split_bytes),
9560
+ min_splits: asBigInt(params.min_splits),
9561
+ cursor: params.cursor ? toUint8Array2(params.cursor) : null
9562
+ };
9563
+ }
9564
+ function fingerprintInputs(bindCallBytes) {
9565
+ const dict = batchToScalarDict(deserializeBatch(bindCallBytes));
9566
+ return {
9567
+ schemaName: dict.schema_name == null ? "" : String(dict.schema_name),
9568
+ functionName: String(dict.function_name ?? ""),
9569
+ args: dict.arguments ? toUint8Array2(dict.arguments) : new Uint8Array(0),
9570
+ settings: dict.settings ? toUint8Array2(dict.settings) : new Uint8Array(0)
9571
+ };
9572
+ }
9573
+ function scanSplitRow(split, token) {
9574
+ const asBigInt = (v) => v == null ? null : typeof v === "bigint" ? v : BigInt(v);
9575
+ return {
9576
+ payload: new Uint8Array(0),
9577
+ token,
9578
+ estimated_rows: asBigInt(split.estimatedRows),
9579
+ rows_exact: split.rowsExact === true,
9580
+ estimated_bytes: asBigInt(split.estimatedBytes),
9581
+ partition_bounds: split.partitionBounds ?? null,
9582
+ column_statistics: split.columnStatistics ?? null,
9583
+ location_ids: split.locationIds ?? null,
9584
+ start_position: split.startPosition ?? null,
9585
+ end_position: split.endPosition ?? null
9586
+ };
9587
+ }
9588
+ function planResponseRow(result, splitBlobs) {
9589
+ const asBigInt = (v) => v == null ? null : typeof v === "bigint" ? v : BigInt(v);
9590
+ return {
9591
+ splits: splitBlobs,
9592
+ next_cursors: result.nextCursors ?? [],
9593
+ execution_id: null,
9594
+ init_opaque_data: new Uint8Array(0),
9595
+ max_workers: asBigInt(result.maxWorkers),
9596
+ estimated_total_splits: asBigInt(result.estimatedTotalSplits),
9597
+ estimated_total_rows: asBigInt(result.estimatedTotalRows),
9598
+ estimated_total_bytes: asBigInt(result.estimatedTotalBytes),
9599
+ catalog_version: asBigInt(result.catalogVersion),
9600
+ scope: result.scope ?? "catalog",
9601
+ locations: null,
9602
+ partitioning: [],
9603
+ sort_order: [],
9604
+ cache_max_age_seconds: asBigInt(result.cacheMaxAgeSeconds),
9605
+ start_position: new Uint8Array(0),
9606
+ end_position: new Uint8Array(0)
9607
+ };
9608
+ }
9609
+
9610
+ // src/split-token.ts
9611
+ var SPLIT_TOKEN_FORMAT_VERSION = 1;
9612
+ var FLAG_PAYLOAD_SEALED = 1;
9613
+ var RESERVED_FLAGS_MASK = 254;
9614
+ var FINGERPRINT_LEN = 16;
9615
+ var HEADER_LEN = 4 + FINGERPRINT_LEN;
9616
+ var SEAL_VERSION = 1;
9617
+ var AAD_PREFIX = new TextEncoder().encode("vgi.split_token.v1\x00");
9618
+ var SPLIT_TOKEN_INVALID = "SPLIT_TOKEN_INVALID";
9619
+ var SPLIT_SNAPSHOT_EXPIRED = "SPLIT_SNAPSHOT_EXPIRED";
9620
+ class SplitTokenError extends Error {
9621
+ kind;
9622
+ constructor(kind, message) {
9623
+ super(`[${kind}] ${message}`);
9624
+ this.name = "SplitTokenError";
9625
+ this.kind = kind;
9626
+ }
9627
+ }
9628
+ function concat2(...parts) {
9629
+ const total = parts.reduce((n, p) => n + p.length, 0);
9630
+ const out = new Uint8Array(total);
9631
+ let at = 0;
9632
+ for (const p of parts) {
9633
+ out.set(p, at);
9634
+ at += p.length;
9635
+ }
9636
+ return out;
9637
+ }
9638
+ function equalBytes2(a, b) {
9639
+ if (a.length !== b.length)
9640
+ return false;
9641
+ let diff = 0;
9642
+ for (let i = 0;i < a.length; i++)
9643
+ diff |= a[i] ^ b[i];
9644
+ return diff === 0;
9645
+ }
9646
+ async function bindFingerprint(schemaName, functionName, args, settings, projection) {
9647
+ const enc = new TextEncoder;
9648
+ const zero = Uint8Array.of(0);
9649
+ const field3 = (label, value) => concat2(enc.encode(label), zero, value, zero);
9650
+ const message = concat2(AAD_PREFIX, field3("schema_name", enc.encode(schemaName)), field3("function_name", enc.encode(functionName)), field3("arguments", args), field3("settings", settings), field3("projection_ids", projection));
9651
+ const digest = await crypto.subtle.digest("SHA-256", message);
9652
+ return new Uint8Array(digest).slice(0, FINGERPRINT_LEN);
9653
+ }
9654
+ function splitTokenAad(header, auth) {
9655
+ return concat2(header, identityTail(auth));
9656
+ }
9657
+ function splitAnchor(catalogVersion) {
9658
+ const out = new Uint8Array(8);
9659
+ new DataView(out.buffer).setBigInt64(0, BigInt(catalogVersion), true);
9660
+ return out;
9661
+ }
9662
+ async function buildSplitToken(opts) {
9663
+ const { payload, fingerprint, anchor, signingKey, auth } = opts;
9664
+ if (fingerprint.length !== FINGERPRINT_LEN) {
9665
+ throw new SplitTokenError(SPLIT_TOKEN_INVALID, `bind_fingerprint must be ${FINGERPRINT_LEN} bytes, got ${fingerprint.length}`);
9666
+ }
9667
+ if (anchor.length > 65535) {
9668
+ throw new SplitTokenError(SPLIT_TOKEN_INVALID, `consistency_anchor too long: ${anchor.length} bytes exceeds u16`);
9669
+ }
9670
+ const head = new Uint8Array(4);
9671
+ head[0] = SPLIT_TOKEN_FORMAT_VERSION;
9672
+ head[1] = signingKey ? FLAG_PAYLOAD_SEALED : 0;
9673
+ new DataView(head.buffer).setUint16(2, anchor.length, true);
9674
+ const body = concat2(head, fingerprint, anchor);
9675
+ if (!signingKey)
9676
+ return concat2(body, payload);
9677
+ const sealed = await sealBytes(payload, signingKey, splitTokenAad(body, auth), SEAL_VERSION);
9678
+ return concat2(body, sealed);
9679
+ }
9680
+ async function openSplitToken(token, opts = {}) {
9681
+ const { signingKey, auth, expectedFingerprint, currentAnchor } = opts;
9682
+ if (token.length < HEADER_LEN) {
9683
+ throw new SplitTokenError(SPLIT_TOKEN_INVALID, `split token too short: ${token.length} bytes, need at least ${HEADER_LEN}`);
9684
+ }
9685
+ const version = token[0];
9686
+ const flags = token[1];
9687
+ const view = new DataView(token.buffer, token.byteOffset, token.byteLength);
9688
+ const anchorLen = view.getUint16(2, true);
9689
+ if (version !== SPLIT_TOKEN_FORMAT_VERSION) {
9690
+ throw new SplitTokenError(SPLIT_TOKEN_INVALID, `unsupported split-token format_version ${version}; this worker speaks ` + `${SPLIT_TOKEN_FORMAT_VERSION}`);
9691
+ }
9692
+ if (flags & RESERVED_FLAGS_MASK) {
9693
+ throw new SplitTokenError(SPLIT_TOKEN_INVALID, `split token sets reserved flag bits (flags=0x${flags.toString(16).padStart(2, "0")})`);
9694
+ }
9695
+ const sealed = (flags & FLAG_PAYLOAD_SEALED) !== 0;
9696
+ if (signingKey && !sealed) {
9697
+ throw new SplitTokenError(SPLIT_TOKEN_INVALID, "split token is unsealed but this worker holds a signing key; refusing. An unsealed " + "token cannot be authenticated, so accepting one here would let any caller forge a " + "split (alg:none).");
9698
+ }
9699
+ if (!signingKey && sealed) {
9700
+ throw new SplitTokenError(SPLIT_TOKEN_INVALID, "split token is sealed but this worker holds no signing key; cannot open it");
9701
+ }
9702
+ const endOfAnchor = HEADER_LEN + anchorLen;
9703
+ if (token.length < endOfAnchor) {
9704
+ throw new SplitTokenError(SPLIT_TOKEN_INVALID, `split token truncated: anchor_len=${anchorLen} exceeds token length ${token.length}`);
9705
+ }
9706
+ const fingerprint = token.subarray(4, HEADER_LEN);
9707
+ const anchor = token.subarray(HEADER_LEN, endOfAnchor);
9708
+ const body = token.subarray(0, endOfAnchor);
9709
+ const rest = token.subarray(endOfAnchor);
9710
+ if (expectedFingerprint && !equalBytes2(fingerprint, expectedFingerprint)) {
9711
+ throw new SplitTokenError(SPLIT_TOKEN_INVALID, "split token was minted for a different bind (fingerprint mismatch)");
9712
+ }
9713
+ if (currentAnchor && !equalBytes2(anchor, currentAnchor)) {
9714
+ throw new SplitTokenError(SPLIT_SNAPSHOT_EXPIRED, "split snapshot expired; re-run the query");
9715
+ }
9716
+ if (!sealed)
9717
+ return new Uint8Array(rest);
9718
+ try {
9719
+ return await openBytes(rest, signingKey, splitTokenAad(body, auth), SEAL_VERSION, "split token");
9720
+ } catch (err2) {
9721
+ throw new SplitTokenError(SPLIT_TOKEN_INVALID, `split token failed authentication: ${err2 instanceof Error ? err2.message : String(err2)}`);
9722
+ }
9723
+ }
9300
9724
 
9301
9725
  // src/protocol/handlers/function.ts
9726
+ async function liveSplitAnchor(catalogInterface, bindCall, auth, signingKey) {
9727
+ if (!catalogInterface?.version || bindCall.attach_opaque_data == null)
9728
+ return;
9729
+ const raw = toUint8Array(bindCall.attach_opaque_data);
9730
+ const txn = bindCall.transaction_opaque_data ? toUint8Array(bindCall.transaction_opaque_data) : undefined;
9731
+ const forms = [
9732
+ async () => raw,
9733
+ async () => openAttach(raw, auth, signingKey)
9734
+ ];
9735
+ for (const form of forms) {
9736
+ try {
9737
+ return splitAnchor(await catalogInterface.version(await form(), txn));
9738
+ } catch {}
9739
+ }
9740
+ return;
9741
+ }
9742
+ async function resolveSplitPayloads(request, innerParams, opts) {
9743
+ if (!request.split_tokens)
9744
+ return;
9745
+ const fp = fingerprintInputs(toUint8Array(innerParams.bind_call));
9746
+ const expected = await bindFingerprint(fp.schemaName, fp.functionName, fp.args, fp.settings, new Uint8Array(0));
9747
+ const currentAnchor = opts.checkAnchor ? await liveSplitAnchor(opts.catalogInterface, request.bind_call, opts.auth, opts.signingKey) : undefined;
9748
+ request.split_payloads = [];
9749
+ for (const token of request.split_tokens) {
9750
+ request.split_payloads.push(await openSplitToken(token, {
9751
+ signingKey: opts.signingKey,
9752
+ auth: opts.auth,
9753
+ expectedFingerprint: expected,
9754
+ currentAnchor
9755
+ }));
9756
+ }
9757
+ }
9302
9758
  function registerFunctionMethods(protocol, config) {
9303
9759
  const { registry, signingKey, catalogInterface } = config;
9304
9760
  async function stripAttach(attach, ctx) {
@@ -9307,7 +9763,7 @@ function registerFunctionMethods(protocol, config) {
9307
9763
  const env = toUint8Array(attach);
9308
9764
  if (env.length === 0)
9309
9765
  return env;
9310
- return openAttach(env, ctx?.auth, signingKey);
9766
+ return openAttach(env, ctx?.auth ?? currentRequestAuth(), signingKey);
9311
9767
  }
9312
9768
  async function strippedContext(bindCall, ctx) {
9313
9769
  let attach = null;
@@ -9318,17 +9774,13 @@ function registerFunctionMethods(protocol, config) {
9318
9774
  }
9319
9775
  return overloadContext({ ...bindCall, attach_opaque_data: attach }, catalogInterface);
9320
9776
  }
9321
- const initHeaderSchema = schema2([
9322
- field2("execution_id", binary2(), false),
9323
- field2("opaque_data", binary2(), true),
9324
- field2("max_workers", int642(), false)
9325
- ]);
9777
+ const initHeaderSchema = GLOBAL_INIT_RESPONSE_SCHEMA;
9326
9778
  const emptySchema = schema2([]);
9327
9779
  const dummyInputSchema = schema2([
9328
9780
  field2("_tick", binary2(), true)
9329
9781
  ]);
9330
9782
  protocol.unary("bind", {
9331
- params: REQUEST_PARAMS_SCHEMA,
9783
+ params: BindParamsSchema,
9332
9784
  result: RESULT_BINARY_SCHEMA,
9333
9785
  handler: async (params, ctx) => {
9334
9786
  const innerParams = unwrapRequest(params.request);
@@ -9341,14 +9793,21 @@ function registerFunctionMethods(protocol, config) {
9341
9793
  }
9342
9794
  });
9343
9795
  protocol.exchange("init", {
9344
- params: REQUEST_PARAMS_SCHEMA,
9796
+ params: InitParamsSchema,
9345
9797
  inputSchema: dummyInputSchema,
9346
9798
  outputSchema: emptySchema,
9347
- init: async (params) => {
9799
+ init: async (params, ctx) => {
9348
9800
  const requestIpcBytes = toUint8Array(params.request);
9349
9801
  const innerParams = unwrapRequest(params.request);
9350
9802
  const request = deserializeInitRequest(innerParams);
9351
- request.bind_call.attach_opaque_data = await stripAttach(request.bind_call.attach_opaque_data, undefined);
9803
+ const auth = ctx?.auth ?? currentRequestAuth();
9804
+ request.bind_call.attach_opaque_data = await stripAttach(request.bind_call.attach_opaque_data, ctx);
9805
+ await resolveSplitPayloads(request, innerParams, {
9806
+ auth,
9807
+ signingKey,
9808
+ catalogInterface,
9809
+ checkAnchor: true
9810
+ });
9352
9811
  const func = registry.get(request.bind_call.function_name, overloadContext(request.bind_call, catalogInterface));
9353
9812
  const initResponse = await func.globalInit(request);
9354
9813
  const accumulatedState = recoverFinalizeState(request, config.recoverExchangeState);
@@ -9389,6 +9848,12 @@ function registerFunctionMethods(protocol, config) {
9389
9848
  const initRequestBatch = deserializeBatch(state.initRequestIpc);
9390
9849
  const initRequestDict = batchToScalarDict(initRequestBatch);
9391
9850
  const request = deserializeInitRequest(initRequestDict);
9851
+ await resolveSplitPayloads(request, { bind_call: initRequestDict.bind_call }, {
9852
+ auth: currentRequestAuth(),
9853
+ signingKey,
9854
+ catalogInterface,
9855
+ checkAnchor: false
9856
+ });
9392
9857
  const func = registry.get(state.functionName, await strippedContext(request.bind_call));
9393
9858
  const executionId = state.executionId;
9394
9859
  const opaqueData = state.opaqueData ?? null;
@@ -9432,7 +9897,7 @@ function registerFunctionMethods(protocol, config) {
9432
9897
  }
9433
9898
  });
9434
9899
  protocol.unary("table_function_cardinality", {
9435
- params: REQUEST_PARAMS_SCHEMA,
9900
+ params: TableFunctionCardinalityParamsSchema,
9436
9901
  result: RESULT_BINARY_SCHEMA,
9437
9902
  handler: async (params) => {
9438
9903
  const innerParams = unwrapRequest(params.request);
@@ -9447,8 +9912,36 @@ function registerFunctionMethods(protocol, config) {
9447
9912
  return wrapResult(cardResult, TableFunctionCardinalityResultSchema);
9448
9913
  }
9449
9914
  });
9915
+ protocol.unary("table_function_plan", {
9916
+ params: TableFunctionPlanParamsSchema,
9917
+ result: RESULT_BINARY_SCHEMA,
9918
+ handler: async (params, ctx) => {
9919
+ const innerParams = unwrapRequest(params.request);
9920
+ const request = deserializePlanRequest(innerParams);
9921
+ const func = registry.get(request.bind_call.function_name, await strippedContext(request.bind_call));
9922
+ const plan = func.plan ? await func.plan(request) : { splits: [{ payload: new Uint8Array(0) }] };
9923
+ const fp = fingerprintInputs(toUint8Array(innerParams.bind_call));
9924
+ const fingerprint = await bindFingerprint(fp.schemaName, fp.functionName, fp.args, fp.settings, new Uint8Array(0));
9925
+ const anchor = plan.catalogVersion != null ? splitAnchor(plan.catalogVersion) : await liveSplitAnchor(catalogInterface, request.bind_call, ctx?.auth, signingKey) ?? splitAnchor(0);
9926
+ const blobs = [];
9927
+ for (const split of plan.splits) {
9928
+ const token = await buildSplitToken({
9929
+ payload: split.payload,
9930
+ fingerprint,
9931
+ anchor,
9932
+ signingKey,
9933
+ auth: ctx?.auth
9934
+ });
9935
+ blobs.push(serializeBatch(batchFromColumns(Object.fromEntries(SCAN_SPLIT_SCHEMA.fields.map((f) => [
9936
+ f.name,
9937
+ [scanSplitRow(split, token)[f.name] ?? null]
9938
+ ])), SCAN_SPLIT_SCHEMA)));
9939
+ }
9940
+ return wrapResult(planResponseRow(plan, blobs), PLAN_RESPONSE_SCHEMA);
9941
+ }
9942
+ });
9450
9943
  protocol.unary("table_function_statistics", {
9451
- params: REQUEST_PARAMS_SCHEMA,
9944
+ params: TableFunctionStatisticsParamsSchema,
9452
9945
  result: RESULT_BINARY_NULLABLE_SCHEMA,
9453
9946
  handler: async (params) => {
9454
9947
  const innerParams = unwrapRequest(params.request);
@@ -9463,7 +9956,7 @@ function registerFunctionMethods(protocol, config) {
9463
9956
  }
9464
9957
  });
9465
9958
  protocol.unary("table_function_dynamic_to_string", {
9466
- params: REQUEST_PARAMS_SCHEMA,
9959
+ params: TableFunctionDynamicToStringParamsSchema,
9467
9960
  result: RESULT_BINARY_SCHEMA,
9468
9961
  handler: async (params) => {
9469
9962
  const innerParams = unwrapRequest(params.request);
@@ -9498,7 +9991,7 @@ function registerAggregateMethods(protocol, registry) {
9498
9991
  return func.aggregateConfig;
9499
9992
  }
9500
9993
  protocol.unary("aggregate_bind", {
9501
- params: REQUEST_PARAMS_SCHEMA,
9994
+ params: AggregateBindParamsSchema,
9502
9995
  result: RESULT_BINARY_SCHEMA,
9503
9996
  handler: async (params) => {
9504
9997
  const innerParams = unwrapRequest(params.request);
@@ -9530,7 +10023,7 @@ function registerAggregateMethods(protocol, registry) {
9530
10023
  }
9531
10024
  });
9532
10025
  protocol.unary("aggregate_update", {
9533
- params: REQUEST_PARAMS_SCHEMA,
10026
+ params: AggregateUpdateParamsSchema,
9534
10027
  result: RESULT_BINARY_SCHEMA,
9535
10028
  handler: (params) => {
9536
10029
  const innerParams = unwrapRequest(params.request);
@@ -9583,7 +10076,7 @@ function registerAggregateMethods(protocol, registry) {
9583
10076
  }
9584
10077
  });
9585
10078
  protocol.unary("aggregate_combine", {
9586
- params: REQUEST_PARAMS_SCHEMA,
10079
+ params: AggregateCombineParamsSchema,
9587
10080
  result: RESULT_BINARY_SCHEMA,
9588
10081
  handler: (params) => {
9589
10082
  const innerParams = unwrapRequest(params.request);
@@ -9628,7 +10121,7 @@ function registerAggregateMethods(protocol, registry) {
9628
10121
  }
9629
10122
  });
9630
10123
  protocol.unary("aggregate_finalize", {
9631
- params: REQUEST_PARAMS_SCHEMA,
10124
+ params: AggregateFinalizeParamsSchema,
9632
10125
  result: RESULT_BINARY_SCHEMA,
9633
10126
  handler: (params) => {
9634
10127
  const innerParams = unwrapRequest(params.request);
@@ -9666,7 +10159,7 @@ function registerAggregateMethods(protocol, registry) {
9666
10159
  }
9667
10160
  });
9668
10161
  protocol.unary("aggregate_destructor", {
9669
- params: REQUEST_PARAMS_SCHEMA,
10162
+ params: AggregateDestructorParamsSchema,
9670
10163
  result: RESULT_BINARY_SCHEMA,
9671
10164
  handler: (params) => {
9672
10165
  const innerParams = unwrapRequest(params.request);
@@ -9793,7 +10286,7 @@ function registerTableBufferingMethods(protocol, registry, signingKey) {
9793
10286
  return { func, params };
9794
10287
  }
9795
10288
  protocol.unary("table_buffering_process", {
9796
- params: REQUEST_PARAMS_SCHEMA,
10289
+ params: TableBufferingProcessParamsSchema,
9797
10290
  result: RESULT_BINARY_SCHEMA,
9798
10291
  handler: async (rpcParams, ctx) => {
9799
10292
  const inner = unwrapRequest(rpcParams.request);
@@ -9811,7 +10304,7 @@ function registerTableBufferingMethods(protocol, registry, signingKey) {
9811
10304
  }
9812
10305
  });
9813
10306
  protocol.unary("table_buffering_combine", {
9814
- params: REQUEST_PARAMS_SCHEMA,
10307
+ params: TableBufferingCombineParamsSchema,
9815
10308
  result: RESULT_BINARY_SCHEMA,
9816
10309
  handler: async (rpcParams, ctx) => {
9817
10310
  const inner = unwrapRequest(rpcParams.request);
@@ -9829,7 +10322,7 @@ function registerTableBufferingMethods(protocol, registry, signingKey) {
9829
10322
  }
9830
10323
  });
9831
10324
  protocol.unary("table_buffering_destructor", {
9832
- params: REQUEST_PARAMS_SCHEMA,
10325
+ params: TableBufferingDestructorParamsSchema,
9833
10326
  result: RESULT_BINARY_SCHEMA,
9834
10327
  handler: async (rpcParams) => {
9835
10328
  try {
@@ -9865,10 +10358,9 @@ function hex(buf) {
9865
10358
  }
9866
10359
 
9867
10360
  // src/protocol/handlers/catalog/admin.ts
9868
- init_arrow();
9869
10361
  function registerCatalogAdminMethods(protocol, getCatalog, signingKey) {
9870
10362
  catalogUnary(protocol, signingKey, "catalog_catalogs", {
9871
- params: emptyResultSchema,
10363
+ params: CatalogCatalogsParamsSchema,
9872
10364
  result: RESULT_BINARY_SCHEMA,
9873
10365
  handler: async () => {
9874
10366
  const cat = getCatalog();
@@ -9884,7 +10376,7 @@ function registerCatalogAdminMethods(protocol, getCatalog, signingKey) {
9884
10376
  }
9885
10377
  });
9886
10378
  protocol.unary("catalog_attach", {
9887
- params: REQUEST_PARAMS_SCHEMA,
10379
+ params: CatalogAttachParamsSchema,
9888
10380
  result: RESULT_BINARY_SCHEMA,
9889
10381
  handler: async (params, ctx) => {
9890
10382
  const innerParams = unwrapRequest(params.request);
@@ -9914,7 +10406,7 @@ function registerCatalogAdminMethods(protocol, getCatalog, signingKey) {
9914
10406
  }
9915
10407
  });
9916
10408
  catalogUnary(protocol, signingKey, "catalog_detach", {
9917
- params: attachOpaqueDataParam,
10409
+ params: CatalogDetachParamsSchema,
9918
10410
  result: emptyResultSchema,
9919
10411
  handler: async (params) => {
9920
10412
  const cat = getCatalog();
@@ -9923,11 +10415,7 @@ function registerCatalogAdminMethods(protocol, getCatalog, signingKey) {
9923
10415
  }
9924
10416
  });
9925
10417
  catalogUnary(protocol, signingKey, "catalog_create", {
9926
- params: schema2([
9927
- field2("name", utf82(), false),
9928
- field2("on_conflict", utf82(), false),
9929
- field2("options", binary2(), true)
9930
- ]),
10418
+ params: CatalogCreateParamsSchema,
9931
10419
  result: emptyResultSchema,
9932
10420
  handler: async (params) => {
9933
10421
  const cat = getCatalog();
@@ -9936,7 +10424,7 @@ function registerCatalogAdminMethods(protocol, getCatalog, signingKey) {
9936
10424
  }
9937
10425
  });
9938
10426
  catalogUnary(protocol, signingKey, "catalog_drop", {
9939
- params: schema2([field2("name", utf82(), false)]),
10427
+ params: CatalogDropParamsSchema,
9940
10428
  result: emptyResultSchema,
9941
10429
  handler: async (params) => {
9942
10430
  const cat = getCatalog();
@@ -9945,7 +10433,7 @@ function registerCatalogAdminMethods(protocol, getCatalog, signingKey) {
9945
10433
  }
9946
10434
  });
9947
10435
  catalogUnary(protocol, signingKey, "catalog_version", {
9948
- params: attachOpaqueDataTxnParams,
10436
+ params: CatalogVersionParamsSchema,
9949
10437
  result: RESULT_BINARY_SCHEMA,
9950
10438
  handler: async (params) => {
9951
10439
  const cat = getCatalog();
@@ -9954,7 +10442,7 @@ function registerCatalogAdminMethods(protocol, getCatalog, signingKey) {
9954
10442
  }
9955
10443
  });
9956
10444
  protocol.unary("catalog_transaction_begin", {
9957
- params: attachOpaqueDataParam,
10445
+ params: CatalogTransactionBeginParamsSchema,
9958
10446
  result: RESULT_BINARY_SCHEMA,
9959
10447
  handler: async (params, ctx) => {
9960
10448
  const auth = ctx?.auth;
@@ -9967,7 +10455,7 @@ function registerCatalogAdminMethods(protocol, getCatalog, signingKey) {
9967
10455
  }
9968
10456
  });
9969
10457
  catalogUnary(protocol, signingKey, "catalog_transaction_commit", {
9970
- params: attachOpaqueDataTxnParams,
10458
+ params: CatalogTransactionCommitParamsSchema,
9971
10459
  result: emptyResultSchema,
9972
10460
  handler: async (params) => {
9973
10461
  const cat = getCatalog();
@@ -9976,7 +10464,7 @@ function registerCatalogAdminMethods(protocol, getCatalog, signingKey) {
9976
10464
  }
9977
10465
  });
9978
10466
  catalogUnary(protocol, signingKey, "catalog_transaction_rollback", {
9979
- params: attachOpaqueDataTxnParams,
10467
+ params: CatalogTransactionRollbackParamsSchema,
9980
10468
  result: emptyResultSchema,
9981
10469
  handler: async (params) => {
9982
10470
  const cat = getCatalog();
@@ -9985,7 +10473,7 @@ function registerCatalogAdminMethods(protocol, getCatalog, signingKey) {
9985
10473
  }
9986
10474
  });
9987
10475
  catalogUnary(protocol, signingKey, "catalog_schemas", {
9988
- params: attachOpaqueDataTxnParams,
10476
+ params: CatalogSchemasParamsSchema,
9989
10477
  result: RESULT_BINARY_SCHEMA,
9990
10478
  handler: async (params) => {
9991
10479
  const cat = getCatalog();
@@ -9996,7 +10484,7 @@ function registerCatalogAdminMethods(protocol, getCatalog, signingKey) {
9996
10484
  }
9997
10485
  });
9998
10486
  catalogUnary(protocol, signingKey, "catalog_copy_from_formats", {
9999
- params: attachOpaqueDataTxnParams,
10487
+ params: CatalogCopyFromFormatsParamsSchema,
10000
10488
  result: RESULT_BINARY_SCHEMA,
10001
10489
  handler: async (params) => {
10002
10490
  const cat = getCatalog();
@@ -10007,7 +10495,7 @@ function registerCatalogAdminMethods(protocol, getCatalog, signingKey) {
10007
10495
  }
10008
10496
  });
10009
10497
  catalogUnary(protocol, signingKey, "catalog_schema_get", {
10010
- params: attachOpaqueDataNameTxnParams,
10498
+ params: CatalogSchemaGetParamsSchema,
10011
10499
  result: RESULT_BINARY_SCHEMA,
10012
10500
  handler: async (params) => {
10013
10501
  const cat = getCatalog();
@@ -10018,13 +10506,7 @@ function registerCatalogAdminMethods(protocol, getCatalog, signingKey) {
10018
10506
  }
10019
10507
  });
10020
10508
  catalogUnary(protocol, signingKey, "catalog_schema_create", {
10021
- params: schema2([
10022
- field2("attach_opaque_data", binary2(), true),
10023
- field2("name", utf82(), false),
10024
- field2("comment", utf82(), true),
10025
- field2("tags", binary2(), true),
10026
- field2("transaction_opaque_data", binary2(), true)
10027
- ]),
10509
+ params: CatalogSchemaCreateParamsSchema,
10028
10510
  result: emptyResultSchema,
10029
10511
  handler: async (params) => {
10030
10512
  const cat = getCatalog();
@@ -10033,13 +10515,7 @@ function registerCatalogAdminMethods(protocol, getCatalog, signingKey) {
10033
10515
  }
10034
10516
  });
10035
10517
  catalogUnary(protocol, signingKey, "catalog_schema_drop", {
10036
- params: schema2([
10037
- field2("attach_opaque_data", binary2(), true),
10038
- field2("name", utf82(), false),
10039
- field2("ignore_not_found", bool2(), true),
10040
- field2("cascade", bool2(), true),
10041
- field2("transaction_opaque_data", binary2(), true)
10042
- ]),
10518
+ params: CatalogSchemaDropParamsSchema,
10043
10519
  result: emptyResultSchema,
10044
10520
  handler: async (params) => {
10045
10521
  const cat = getCatalog();
@@ -10048,7 +10524,7 @@ function registerCatalogAdminMethods(protocol, getCatalog, signingKey) {
10048
10524
  }
10049
10525
  });
10050
10526
  catalogUnary(protocol, signingKey, "catalog_schema_contents_tables", {
10051
- params: attachOpaqueDataNameTxnParams,
10527
+ params: CatalogSchemaContentsTablesParamsSchema,
10052
10528
  result: RESULT_BINARY_SCHEMA,
10053
10529
  handler: async (params) => {
10054
10530
  const cat = getCatalog();
@@ -10059,7 +10535,7 @@ function registerCatalogAdminMethods(protocol, getCatalog, signingKey) {
10059
10535
  }
10060
10536
  });
10061
10537
  catalogUnary(protocol, signingKey, "catalog_schema_contents_views", {
10062
- params: attachOpaqueDataNameTxnParams,
10538
+ params: CatalogSchemaContentsViewsParamsSchema,
10063
10539
  result: RESULT_BINARY_SCHEMA,
10064
10540
  handler: async (params) => {
10065
10541
  const cat = getCatalog();
@@ -10070,12 +10546,7 @@ function registerCatalogAdminMethods(protocol, getCatalog, signingKey) {
10070
10546
  }
10071
10547
  });
10072
10548
  catalogUnary(protocol, signingKey, "catalog_schema_contents_functions", {
10073
- params: schema2([
10074
- field2("attach_opaque_data", binary2(), true),
10075
- field2("name", utf82(), false),
10076
- field2("type", utf82(), false),
10077
- field2("transaction_opaque_data", binary2(), true)
10078
- ]),
10549
+ params: CatalogSchemaContentsFunctionsParamsSchema,
10079
10550
  result: RESULT_BINARY_SCHEMA,
10080
10551
  handler: async (params) => {
10081
10552
  const cat = getCatalog();
@@ -10088,17 +10559,9 @@ function registerCatalogAdminMethods(protocol, getCatalog, signingKey) {
10088
10559
  }
10089
10560
 
10090
10561
  // src/protocol/handlers/catalog/table.ts
10091
- init_arrow();
10092
10562
  function registerCatalogTableMethods(protocol, getCatalog, signingKey) {
10093
10563
  catalogUnary(protocol, signingKey, "catalog_table_get", {
10094
- params: schema2([
10095
- field2("attach_opaque_data", binary2(), true),
10096
- field2("schema_name", utf82(), false),
10097
- field2("name", utf82(), false),
10098
- field2("at_unit", utf82(), true),
10099
- field2("at_value", utf82(), true),
10100
- field2("transaction_opaque_data", binary2(), true)
10101
- ]),
10564
+ params: CatalogTableGetParamsSchema,
10102
10565
  result: RESULT_BINARY_SCHEMA,
10103
10566
  handler: async (params) => {
10104
10567
  const cat = getCatalog();
@@ -10109,17 +10572,7 @@ function registerCatalogTableMethods(protocol, getCatalog, signingKey) {
10109
10572
  }
10110
10573
  });
10111
10574
  catalogUnary(protocol, signingKey, "catalog_table_create", {
10112
- params: schema2([
10113
- field2("attach_opaque_data", binary2(), true),
10114
- field2("schema_name", utf82(), false),
10115
- field2("name", utf82(), false),
10116
- field2("columns", binary2(), false),
10117
- field2("on_conflict", utf82(), false),
10118
- field2("not_null_constraints", list2(field2("item", int322(), false)), true),
10119
- field2("unique_constraints", list2(field2("item", list2(field2("item", int322(), false)), false)), true),
10120
- field2("check_constraints", list2(field2("item", utf82(), false)), true),
10121
- field2("transaction_opaque_data", binary2(), true)
10122
- ]),
10575
+ params: CatalogTableCreateParamsSchema,
10123
10576
  result: emptyResultSchema,
10124
10577
  handler: async (params) => {
10125
10578
  const cat = getCatalog();
@@ -10128,13 +10581,7 @@ function registerCatalogTableMethods(protocol, getCatalog, signingKey) {
10128
10581
  }
10129
10582
  });
10130
10583
  catalogUnary(protocol, signingKey, "catalog_table_drop", {
10131
- params: schema2([
10132
- field2("attach_opaque_data", binary2(), true),
10133
- field2("schema_name", utf82(), false),
10134
- field2("name", utf82(), false),
10135
- field2("ignore_not_found", bool2(), true),
10136
- field2("transaction_opaque_data", binary2(), true)
10137
- ]),
10584
+ params: CatalogTableDropParamsSchema,
10138
10585
  result: emptyResultSchema,
10139
10586
  handler: async (params) => {
10140
10587
  const cat = getCatalog();
@@ -10143,12 +10590,7 @@ function registerCatalogTableMethods(protocol, getCatalog, signingKey) {
10143
10590
  }
10144
10591
  });
10145
10592
  catalogUnary(protocol, signingKey, "catalog_table_column_statistics_get", {
10146
- params: schema2([
10147
- field2("attach_opaque_data", binary2(), true),
10148
- field2("schema_name", utf82(), false),
10149
- field2("name", utf82(), false),
10150
- field2("transaction_opaque_data", binary2(), true)
10151
- ]),
10593
+ params: CatalogTableColumnStatisticsGetParamsSchema,
10152
10594
  result: RESULT_BINARY_NULLABLE_SCHEMA,
10153
10595
  handler: async (params) => {
10154
10596
  const cat = getCatalog();
@@ -10157,14 +10599,7 @@ function registerCatalogTableMethods(protocol, getCatalog, signingKey) {
10157
10599
  }
10158
10600
  });
10159
10601
  catalogUnary(protocol, signingKey, "catalog_table_scan_function_get", {
10160
- params: schema2([
10161
- field2("attach_opaque_data", binary2(), true),
10162
- field2("schema_name", utf82(), false),
10163
- field2("name", utf82(), false),
10164
- field2("at_unit", utf82(), true),
10165
- field2("at_value", utf82(), true),
10166
- field2("transaction_opaque_data", binary2(), true)
10167
- ]),
10602
+ params: CatalogTableScanFunctionGetParamsSchema,
10168
10603
  result: RESULT_BINARY_SCHEMA,
10169
10604
  handler: async (params) => {
10170
10605
  const cat = getCatalog();
@@ -10173,14 +10608,7 @@ function registerCatalogTableMethods(protocol, getCatalog, signingKey) {
10173
10608
  }
10174
10609
  });
10175
10610
  catalogUnary(protocol, signingKey, "catalog_table_scan_branches_get", {
10176
- params: schema2([
10177
- field2("attach_opaque_data", binary2(), true),
10178
- field2("schema_name", utf82(), false),
10179
- field2("name", utf82(), false),
10180
- field2("at_unit", utf82(), true),
10181
- field2("at_value", utf82(), true),
10182
- field2("transaction_opaque_data", binary2(), true)
10183
- ]),
10611
+ params: CatalogTableScanBranchesGetParamsSchema,
10184
10612
  result: RESULT_BINARY_SCHEMA,
10185
10613
  handler: async (params) => {
10186
10614
  const cat = getCatalog();
@@ -10189,7 +10617,7 @@ function registerCatalogTableMethods(protocol, getCatalog, signingKey) {
10189
10617
  }
10190
10618
  });
10191
10619
  catalogUnary(protocol, signingKey, "catalog_table_comment_set", {
10192
- params: schemaNameCommentParams,
10620
+ params: CatalogTableCommentSetParamsSchema,
10193
10621
  result: emptyResultSchema,
10194
10622
  handler: async (params) => {
10195
10623
  const cat = getCatalog();
@@ -10198,7 +10626,7 @@ function registerCatalogTableMethods(protocol, getCatalog, signingKey) {
10198
10626
  }
10199
10627
  });
10200
10628
  catalogUnary(protocol, signingKey, "catalog_table_rename", {
10201
- params: schemaNameRenameParams,
10629
+ params: CatalogTableRenameParamsSchema,
10202
10630
  result: emptyResultSchema,
10203
10631
  handler: async (params) => {
10204
10632
  const cat = getCatalog();
@@ -10207,16 +10635,7 @@ function registerCatalogTableMethods(protocol, getCatalog, signingKey) {
10207
10635
  }
10208
10636
  });
10209
10637
  catalogUnary(protocol, signingKey, "catalog_table_column_add", {
10210
- params: schema2([
10211
- field2("attach_opaque_data", binary2(), true),
10212
- field2("schema_name", utf82(), false),
10213
- field2("name", utf82(), false),
10214
- field2("column_name", utf82(), false),
10215
- field2("column_type", utf82(), false),
10216
- field2("default_value", utf82(), true),
10217
- field2("ignore_not_found", bool2(), true),
10218
- field2("transaction_opaque_data", binary2(), true)
10219
- ]),
10638
+ params: CatalogTableColumnAddParamsSchema,
10220
10639
  result: emptyResultSchema,
10221
10640
  handler: async (params) => {
10222
10641
  const cat = getCatalog();
@@ -10225,7 +10644,7 @@ function registerCatalogTableMethods(protocol, getCatalog, signingKey) {
10225
10644
  }
10226
10645
  });
10227
10646
  catalogUnary(protocol, signingKey, "catalog_table_column_drop", {
10228
- params: columnOpParams,
10647
+ params: CatalogTableColumnDropParamsSchema,
10229
10648
  result: emptyResultSchema,
10230
10649
  handler: async (params) => {
10231
10650
  const cat = getCatalog();
@@ -10234,15 +10653,7 @@ function registerCatalogTableMethods(protocol, getCatalog, signingKey) {
10234
10653
  }
10235
10654
  });
10236
10655
  catalogUnary(protocol, signingKey, "catalog_table_column_rename", {
10237
- params: schema2([
10238
- field2("attach_opaque_data", binary2(), true),
10239
- field2("schema_name", utf82(), false),
10240
- field2("name", utf82(), false),
10241
- field2("column_name", utf82(), false),
10242
- field2("new_name", utf82(), false),
10243
- field2("ignore_not_found", bool2(), true),
10244
- field2("transaction_opaque_data", binary2(), true)
10245
- ]),
10656
+ params: CatalogTableColumnRenameParamsSchema,
10246
10657
  result: emptyResultSchema,
10247
10658
  handler: async (params) => {
10248
10659
  const cat = getCatalog();
@@ -10251,15 +10662,7 @@ function registerCatalogTableMethods(protocol, getCatalog, signingKey) {
10251
10662
  }
10252
10663
  });
10253
10664
  catalogUnary(protocol, signingKey, "catalog_table_column_default_set", {
10254
- params: schema2([
10255
- field2("attach_opaque_data", binary2(), true),
10256
- field2("schema_name", utf82(), false),
10257
- field2("name", utf82(), false),
10258
- field2("column_name", utf82(), false),
10259
- field2("default_value", utf82(), false),
10260
- field2("ignore_not_found", bool2(), true),
10261
- field2("transaction_opaque_data", binary2(), true)
10262
- ]),
10665
+ params: CatalogTableColumnDefaultSetParamsSchema,
10263
10666
  result: emptyResultSchema,
10264
10667
  handler: async (params) => {
10265
10668
  const cat = getCatalog();
@@ -10268,7 +10671,7 @@ function registerCatalogTableMethods(protocol, getCatalog, signingKey) {
10268
10671
  }
10269
10672
  });
10270
10673
  catalogUnary(protocol, signingKey, "catalog_table_column_default_drop", {
10271
- params: columnOpParams,
10674
+ params: CatalogTableColumnDefaultDropParamsSchema,
10272
10675
  result: emptyResultSchema,
10273
10676
  handler: async (params) => {
10274
10677
  const cat = getCatalog();
@@ -10277,15 +10680,7 @@ function registerCatalogTableMethods(protocol, getCatalog, signingKey) {
10277
10680
  }
10278
10681
  });
10279
10682
  catalogUnary(protocol, signingKey, "catalog_table_column_type_change", {
10280
- params: schema2([
10281
- field2("attach_opaque_data", binary2(), true),
10282
- field2("schema_name", utf82(), false),
10283
- field2("name", utf82(), false),
10284
- field2("column_name", utf82(), false),
10285
- field2("new_type", utf82(), false),
10286
- field2("ignore_not_found", bool2(), true),
10287
- field2("transaction_opaque_data", binary2(), true)
10288
- ]),
10683
+ params: CatalogTableColumnTypeChangeParamsSchema,
10289
10684
  result: emptyResultSchema,
10290
10685
  handler: async (params) => {
10291
10686
  const cat = getCatalog();
@@ -10294,7 +10689,7 @@ function registerCatalogTableMethods(protocol, getCatalog, signingKey) {
10294
10689
  }
10295
10690
  });
10296
10691
  catalogUnary(protocol, signingKey, "catalog_table_not_null_set", {
10297
- params: columnOpParams,
10692
+ params: CatalogTableNotNullSetParamsSchema,
10298
10693
  result: emptyResultSchema,
10299
10694
  handler: async (params) => {
10300
10695
  const cat = getCatalog();
@@ -10303,7 +10698,7 @@ function registerCatalogTableMethods(protocol, getCatalog, signingKey) {
10303
10698
  }
10304
10699
  });
10305
10700
  catalogUnary(protocol, signingKey, "catalog_table_not_null_drop", {
10306
- params: columnOpParams,
10701
+ params: CatalogTableNotNullDropParamsSchema,
10307
10702
  result: emptyResultSchema,
10308
10703
  handler: async (params) => {
10309
10704
  const cat = getCatalog();
@@ -10314,10 +10709,9 @@ function registerCatalogTableMethods(protocol, getCatalog, signingKey) {
10314
10709
  }
10315
10710
 
10316
10711
  // src/protocol/handlers/catalog/view.ts
10317
- init_arrow();
10318
10712
  function registerCatalogViewMethods(protocol, getCatalog, signingKey) {
10319
10713
  catalogUnary(protocol, signingKey, "catalog_view_get", {
10320
- params: attachOpaqueDataSchemaNameTxnParams,
10714
+ params: CatalogViewGetParamsSchema,
10321
10715
  result: RESULT_BINARY_SCHEMA,
10322
10716
  handler: async (params) => {
10323
10717
  const cat = getCatalog();
@@ -10328,14 +10722,7 @@ function registerCatalogViewMethods(protocol, getCatalog, signingKey) {
10328
10722
  }
10329
10723
  });
10330
10724
  catalogUnary(protocol, signingKey, "catalog_view_create", {
10331
- params: schema2([
10332
- field2("attach_opaque_data", binary2(), true),
10333
- field2("schema_name", utf82(), false),
10334
- field2("name", utf82(), false),
10335
- field2("definition", utf82(), false),
10336
- field2("on_conflict", utf82(), false),
10337
- field2("transaction_opaque_data", binary2(), true)
10338
- ]),
10725
+ params: CatalogViewCreateParamsSchema,
10339
10726
  result: emptyResultSchema,
10340
10727
  handler: async (params) => {
10341
10728
  const cat = getCatalog();
@@ -10344,7 +10731,7 @@ function registerCatalogViewMethods(protocol, getCatalog, signingKey) {
10344
10731
  }
10345
10732
  });
10346
10733
  catalogUnary(protocol, signingKey, "catalog_view_drop", {
10347
- params: schemaNameIgnoreNotFoundTxnParams,
10734
+ params: CatalogViewDropParamsSchema,
10348
10735
  result: emptyResultSchema,
10349
10736
  handler: async (params) => {
10350
10737
  const cat = getCatalog();
@@ -10353,7 +10740,7 @@ function registerCatalogViewMethods(protocol, getCatalog, signingKey) {
10353
10740
  }
10354
10741
  });
10355
10742
  catalogUnary(protocol, signingKey, "catalog_view_rename", {
10356
- params: schemaNameRenameParams,
10743
+ params: CatalogViewRenameParamsSchema,
10357
10744
  result: emptyResultSchema,
10358
10745
  handler: async (params) => {
10359
10746
  const cat = getCatalog();
@@ -10362,7 +10749,7 @@ function registerCatalogViewMethods(protocol, getCatalog, signingKey) {
10362
10749
  }
10363
10750
  });
10364
10751
  catalogUnary(protocol, signingKey, "catalog_view_comment_set", {
10365
- params: schemaNameCommentParams,
10752
+ params: CatalogViewCommentSetParamsSchema,
10366
10753
  result: emptyResultSchema,
10367
10754
  handler: async (params) => {
10368
10755
  const cat = getCatalog();
@@ -10373,10 +10760,9 @@ function registerCatalogViewMethods(protocol, getCatalog, signingKey) {
10373
10760
  }
10374
10761
 
10375
10762
  // src/protocol/handlers/catalog/macro.ts
10376
- init_arrow();
10377
10763
  function registerCatalogMacroMethods(protocol, getCatalog, signingKey) {
10378
10764
  catalogUnary(protocol, signingKey, "catalog_macro_get", {
10379
- params: attachOpaqueDataSchemaNameTxnParams,
10765
+ params: CatalogMacroGetParamsSchema,
10380
10766
  result: RESULT_BINARY_SCHEMA,
10381
10767
  handler: async (params) => {
10382
10768
  const cat = getCatalog();
@@ -10387,7 +10773,7 @@ function registerCatalogMacroMethods(protocol, getCatalog, signingKey) {
10387
10773
  }
10388
10774
  });
10389
10775
  catalogUnary(protocol, signingKey, "catalog_macro_create", {
10390
- params: REQUEST_PARAMS_SCHEMA,
10776
+ params: CatalogMacroCreateParamsSchema,
10391
10777
  result: emptyResultSchema,
10392
10778
  handler: async (params) => {
10393
10779
  const cat = getCatalog();
@@ -10397,13 +10783,7 @@ function registerCatalogMacroMethods(protocol, getCatalog, signingKey) {
10397
10783
  }
10398
10784
  });
10399
10785
  catalogUnary(protocol, signingKey, "catalog_macro_drop", {
10400
- params: schema2([
10401
- field2("attach_opaque_data", binary2(), true),
10402
- field2("schema_name", utf82(), false),
10403
- field2("name", utf82(), false),
10404
- field2("ignore_not_found", bool2(), true),
10405
- field2("transaction_opaque_data", binary2(), true)
10406
- ]),
10786
+ params: CatalogMacroDropParamsSchema,
10407
10787
  result: emptyResultSchema,
10408
10788
  handler: async (params) => {
10409
10789
  const cat = getCatalog();
@@ -10412,12 +10792,7 @@ function registerCatalogMacroMethods(protocol, getCatalog, signingKey) {
10412
10792
  }
10413
10793
  });
10414
10794
  catalogUnary(protocol, signingKey, "catalog_schema_contents_macros", {
10415
- params: schema2([
10416
- field2("attach_opaque_data", binary2(), true),
10417
- field2("name", utf82(), false),
10418
- field2("type", utf82(), false),
10419
- field2("transaction_opaque_data", binary2(), true)
10420
- ]),
10795
+ params: CatalogSchemaContentsMacrosParamsSchema,
10421
10796
  result: RESULT_BINARY_SCHEMA,
10422
10797
  handler: async (params) => {
10423
10798
  const cat = getCatalog();
@@ -10430,14 +10805,9 @@ function registerCatalogMacroMethods(protocol, getCatalog, signingKey) {
10430
10805
  }
10431
10806
 
10432
10807
  // src/protocol/handlers/catalog/index_methods.ts
10433
- init_arrow();
10434
10808
  function registerCatalogIndexMethods(protocol, getCatalog, signingKey) {
10435
10809
  catalogUnary(protocol, signingKey, "catalog_schema_contents_indexes", {
10436
- params: schema2([
10437
- field2("attach_opaque_data", binary2(), true),
10438
- field2("name", utf82(), false),
10439
- field2("transaction_opaque_data", binary2(), true)
10440
- ]),
10810
+ params: CatalogSchemaContentsIndexesParamsSchema,
10441
10811
  result: RESULT_BINARY_SCHEMA,
10442
10812
  handler: async (params) => {
10443
10813
  const cat = getCatalog();
@@ -10448,12 +10818,7 @@ function registerCatalogIndexMethods(protocol, getCatalog, signingKey) {
10448
10818
  }
10449
10819
  });
10450
10820
  catalogUnary(protocol, signingKey, "catalog_index_get", {
10451
- params: schema2([
10452
- field2("attach_opaque_data", binary2(), true),
10453
- field2("schema_name", utf82(), false),
10454
- field2("name", utf82(), false),
10455
- field2("transaction_opaque_data", binary2(), true)
10456
- ]),
10821
+ params: CatalogIndexGetParamsSchema,
10457
10822
  result: RESULT_BINARY_SCHEMA,
10458
10823
  handler: async (params) => {
10459
10824
  const cat = getCatalog();
@@ -10617,13 +10982,13 @@ function selectForScope(secrets, path2, type) {
10617
10982
  for (const fields of Object.values(secrets ?? {})) {
10618
10983
  if (type !== undefined && scalarStr(fields.type) !== type)
10619
10984
  continue;
10620
- const scope = scalarStr(fields.scope);
10621
- if (!scope) {
10985
+ const scope2 = scalarStr(fields.scope);
10986
+ if (!scope2) {
10622
10987
  if (!fallback)
10623
10988
  fallback = fields;
10624
10989
  continue;
10625
10990
  }
10626
- for (const prefix of scope.split(`
10991
+ for (const prefix of scope2.split(`
10627
10992
  `)) {
10628
10993
  if (prefix && path2.startsWith(prefix) && prefix.length > bestLen) {
10629
10994
  bestLen = prefix.length;
@@ -10816,6 +11181,8 @@ class VgiClient {
10816
11181
  bind_call: bindRequest,
10817
11182
  output_schema: bindResponse.output_schema,
10818
11183
  bind_opaque_data: bindResponse.opaque_data,
11184
+ split_tokens: null,
11185
+ row_limit: null,
10819
11186
  projection_ids: opts?.projectionIds ?? null,
10820
11187
  pushdown_filters: opts?.pushdownFilters ?? null,
10821
11188
  join_keys: opts?.joinKeys ?? [],
@@ -11454,7 +11821,7 @@ class VgiClient {
11454
11821
  }
11455
11822
  async macroCreate(attachOpaqueData, schemaName, name, macroType, parameters, definition, onConflict, parameterDefaultValues, argumentsSchema, transactionOpaqueData) {
11456
11823
  const schema3 = schema2([
11457
- field2("attach_opaque_data", binary2(), true),
11824
+ field2("attach_opaque_data", binary2(), false),
11458
11825
  field2("schema_name", utf82(), false),
11459
11826
  field2("name", utf82(), false),
11460
11827
  field2("macro_type", utf82(), false),
@@ -11498,6 +11865,13 @@ import { str, bytes, int as int3, int32 as int323, float, float32 as float323, b
11498
11865
  import { subprocessConnect, httpConnect, tcpConnect } from "@query-farm/vgi-rpc";
11499
11866
  // src/worker.ts
11500
11867
  import { VgiRpcServer, serveUnix, serveTcp, serveStream as serveStreamRpc } from "@query-farm/vgi-rpc";
11868
+ function debug(message) {
11869
+ const flag = process.env.VGI_DEBUG;
11870
+ if (flag === undefined || flag === "" || flag === "0")
11871
+ return;
11872
+ process.stderr.write(message() + `
11873
+ `);
11874
+ }
11501
11875
  function parseTcpSpec(spec, out) {
11502
11876
  const idx = spec.lastIndexOf(":");
11503
11877
  if (idx >= 0) {
@@ -11560,24 +11934,20 @@ class Worker {
11560
11934
  }
11561
11935
  }
11562
11936
  run(argv = process.argv.slice(2)) {
11563
- process.stderr.write(`[worker] starting, pid=${process.pid}
11564
- `);
11937
+ debug(() => `[worker] starting, pid=${process.pid}`);
11565
11938
  try {
11566
11939
  const protocol = this.buildProtocol();
11567
- process.stderr.write(`[worker] protocol built
11568
- `);
11940
+ debug(() => `[worker] protocol built`);
11569
11941
  const launcher = parseLauncherArgs(argv);
11570
11942
  if (launcher.unixPath !== undefined) {
11571
11943
  const envOverride = process.env.VGI_WORKER_IDLE_TIMEOUT;
11572
11944
  const idleTimeout = envOverride !== undefined && envOverride !== "" ? Number(envOverride) : launcher.idleTimeout;
11573
- process.stderr.write(`[worker] AF_UNIX mode: ${launcher.unixPath} idle=${idleTimeout ?? 300}s${envOverride !== undefined && envOverride !== "" ? " (env override)" : ""}
11574
- `);
11945
+ debug(() => `[worker] AF_UNIX mode: ${launcher.unixPath} idle=${idleTimeout ?? 300}s${envOverride !== undefined && envOverride !== "" ? " (env override)" : ""}`);
11575
11946
  serveUnix(protocol, {
11576
11947
  unixPath: launcher.unixPath,
11577
11948
  idleTimeout
11578
11949
  }).then((handle) => handle.done).then(() => {
11579
- process.stderr.write(`[worker] serveUnix done (idle shutdown)
11580
- `);
11950
+ debug(() => `[worker] serveUnix done (idle shutdown)`);
11581
11951
  }).catch((err2) => {
11582
11952
  process.stderr.write(`Worker error: ${err2.message}
11583
11953
  ${err2.stack}
@@ -11589,15 +11959,13 @@ ${err2.stack}
11589
11959
  if (launcher.tcpPort !== undefined) {
11590
11960
  const envOverride = process.env.VGI_WORKER_IDLE_TIMEOUT;
11591
11961
  const idleTimeout = envOverride !== undefined && envOverride !== "" ? Number(envOverride) : launcher.idleTimeout;
11592
- process.stderr.write(`[worker] TCP mode: ${launcher.tcpHost}:${launcher.tcpPort} idle=${idleTimeout ?? 300}s${envOverride !== undefined && envOverride !== "" ? " (env override)" : ""}
11593
- `);
11962
+ debug(() => `[worker] TCP mode: ${launcher.tcpHost}:${launcher.tcpPort} idle=${idleTimeout ?? 300}s${envOverride !== undefined && envOverride !== "" ? " (env override)" : ""}`);
11594
11963
  serveTcp(protocol, {
11595
11964
  host: launcher.tcpHost,
11596
11965
  port: launcher.tcpPort,
11597
11966
  idleTimeout
11598
11967
  }).then((handle) => handle.done).then(() => {
11599
- process.stderr.write(`[worker] serveTcp done (idle shutdown)
11600
- `);
11968
+ debug(() => `[worker] serveTcp done (idle shutdown)`);
11601
11969
  }).catch((err2) => {
11602
11970
  process.stderr.write(`Worker error: ${err2.message}
11603
11971
  ${err2.stack}
@@ -11607,11 +11975,9 @@ ${err2.stack}
11607
11975
  return;
11608
11976
  }
11609
11977
  const server = new VgiRpcServer(protocol);
11610
- process.stderr.write(`[worker] server created, calling run()
11611
- `);
11978
+ debug(() => `[worker] server created, calling run()`);
11612
11979
  server.run().then(() => {
11613
- process.stderr.write(`[worker] server.run() resolved cleanly
11614
- `);
11980
+ debug(() => `[worker] server.run() resolved cleanly`);
11615
11981
  }).catch((err2) => {
11616
11982
  process.stderr.write(`Worker error: ${err2.message}
11617
11983
  ${err2.stack}
@@ -11637,238 +12003,241 @@ ${err2.stack}
11637
12003
  }
11638
12004
  }
11639
12005
  export {
11640
- utf82 as utf8,
11641
- union2 as union,
11642
- uint82 as uint8,
11643
- uint642 as uint64,
11644
- uint322 as uint32,
11645
- uint162 as uint16,
11646
- typeSignature,
11647
- toUint8Array,
11648
- toSchema,
11649
- timestampSeconds,
11650
- timestampNanos,
11651
- timestampMillis,
11652
- timestampMicros,
11653
- timestamp2 as timestamp,
11654
- timeSecond2 as timeSecond,
11655
- timeNanosecond2 as timeNanosecond,
11656
- timeMillisecond2 as timeMillisecond,
11657
- timeMicrosecond2 as timeMicrosecond,
11658
- time2 as time,
11659
- tcpConnect,
11660
- subprocessConnect,
11661
- struct2 as struct,
11662
- str,
11663
- sparseUnion2 as sparseUnion,
11664
- setStorage,
11665
- serializeUserState,
11666
- serializeSchema,
11667
- serializeColumnStatistics,
11668
- serializeBatch,
11669
- serializeAttachOptionSpecs,
11670
- serializeAttachOptionSpec,
11671
- secretsOfType,
11672
- secretType,
11673
- secretForScopeOfType,
11674
- secretForScope,
11675
- schemaToArgumentSpecs,
11676
- schema2 as schema,
11677
- safeNumber,
11678
- resolveStorageFromEnv,
11679
- resolveMetadata,
11680
- reprPushedFilters,
11681
- readCanonicalValue,
11682
- projectSchema,
11683
- projectBatch,
11684
- parentRowsMetadata,
11685
- nullType2 as nullType,
11686
- metadatasToArrow,
11687
- map2 as map,
11688
- macroParameterDocsFromSchema,
11689
- macroArgumentsSchema,
11690
- list2 as list,
11691
- iterRows,
11692
- isUtf8,
11693
- isUnion,
11694
- isTimestamp,
11695
- isTime,
11696
- isStruct,
11697
- isNull,
11698
- isMap,
11699
- isList,
11700
- isInterval,
11701
- isInt,
11702
- isFloat,
11703
- isFixedSizeList,
11704
- isFixedSizeBinary,
11705
- isDuration,
11706
- isDictionary,
11707
- isDecimal,
11708
- isDate,
11709
- isBool,
11710
- isBinary,
11711
- isBatch,
11712
- interval2 as interval,
11713
- int82 as int8,
11714
- int642 as int64,
11715
- int323 as int32,
11716
- int162 as int16,
11717
- int3 as int,
11718
- httpConnect,
11719
- storage as functionStorage,
11720
- fromBrandedNumber,
11721
- fromBrandedBigInt,
11722
- fromBranded,
11723
- formatRange,
11724
- formatPushedFilters,
11725
- float642 as float64,
11726
- float323 as float32,
11727
- float162 as float16,
11728
- float,
11729
- fixedSizeList2 as fixedSizeList,
11730
- fixedSizeBinary2 as fixedSizeBinary,
11731
- filterBatch,
11732
- field2 as field,
11733
- encodeViewInfo,
11734
- encodeTableInfo,
11735
- encodeSchemaInfo,
11736
- encodeMacroInfo,
11737
- encodeFunctionInfo,
11738
- encodeCopyFromFormatInfo,
11739
- encodeCatalogInfo,
11740
- emptyBatch,
11741
- durationSeconds,
11742
- durationNanos,
11743
- durationMillis,
11744
- durationMicros,
11745
- duration2 as duration,
11746
- dictionary2 as dictionary,
11747
- deserializeUserState,
11748
- deserializeSchema,
11749
- deserializeFilters,
11750
- deserializeBatch,
11751
- deserializeAttachOptionSpecs,
11752
- deserializeAttachOptionSpec,
11753
- denseUnion2 as denseUnion,
11754
- defineTableInOutFunction,
11755
- defineTableFunction,
11756
- defineTableBufferingFunction,
11757
- defineScalarFunction,
11758
- defineRowTransformFunction,
11759
- defineCopyToFunction,
11760
- defineCopyFromFunction,
11761
- defineAggregate,
11762
- decodeViewInfo,
11763
- decodeTableInfo,
11764
- decodeSchemaInfo,
11765
- decodeMacroInfo,
11766
- decodeFunctionInfo,
11767
- decodeDictValue,
11768
- decodeCatalogInfo,
11769
- decimal2562 as decimal256,
11770
- decimal1282 as decimal128,
11771
- decimal2 as decimal,
11772
- dateMillisecond2 as dateMillisecond,
11773
- dateDay2 as dateDay,
11774
- date2 as date,
11775
- createLandingRoutes,
11776
- constraintSpecFields,
11777
- columnFromArray,
11778
- codecFor,
11779
- cacheControlMetadata,
11780
- bytes,
11781
- buildVgiProtocol,
11782
- buildScanBranchesResult,
11783
- buildJoinKeysLookup,
11784
- bool3 as bool,
11785
- binary2 as binary,
11786
- batchToSecretDict,
11787
- batchToScalarDict,
11788
- batchFromRows,
11789
- batchFromColumns,
11790
- backend,
11791
- asUnscaledDecimal,
11792
- asUint64,
11793
- asTimestampSeconds,
11794
- asTimestampNanos,
11795
- asTimestampMillis,
11796
- asTimestampMicros,
11797
- asTime64Us,
11798
- asTime64Ns,
11799
- asTime32S,
11800
- asTime32Ms,
11801
- asInt64,
11802
- asDurationSeconds,
11803
- asDurationNanos,
11804
- asDurationMillis,
11805
- asDurationMicros,
11806
- asDate64Ms,
11807
- asDate32,
11808
- arrowToMetadatas,
11809
- arrowStateSerializer,
11810
- argumentSpecsToSchema,
11811
- adoptArrowJsShape,
11812
- Worker,
11813
- VgiError,
11814
- VgiClientError,
11815
- VgiClient,
11816
- UnknownInvocationError,
11817
- UnionMode2 as UnionMode,
11818
- TypeId,
11819
- TimeUnit2 as TimeUnit,
11820
- TableInOutPhase,
11821
- ScanFunctionResultSchema,
11822
- RowCountMismatchError,
11823
- ReadOnlyCatalogInterface,
11824
- PushdownFilters,
11825
- PARENT_ROW_METADATA_KEY,
11826
- OutputCollector,
11827
- OrderPreservation,
11828
- OrderDependence,
11829
- NullHandling,
11830
- NoCatalogError,
11831
- IntervalUnit2 as IntervalUnit,
11832
- GROUP_COLUMN_NAME,
11833
- FunctionType,
11834
- FunctionStorageSqlite,
11835
- FunctionStorageCfDo,
11836
- FunctionStability,
11837
- FunctionRegistry,
11838
- FunctionNotFoundError,
11839
- FilteringOutputCollector,
11840
- EXCHANGE_STATE_SCHEMA,
11841
- DistinctDependence,
11842
- DateUnit3 as DateUnit,
11843
- DEFAULT_MAX_WORKERS,
11844
- CompositeCatalogInterface,
11845
- ComparisonOp,
11846
- CatalogReadOnlyError,
11847
- CatalogNotFoundError,
11848
- CatalogInterface,
11849
- CatalogFunctionType,
11850
- CatalogAlreadyExistsError,
11851
- CACHE_TTL_KEY,
11852
- CACHE_STALE_WHILE_REVALIDATE_KEY,
11853
- CACHE_STALE_IF_ERROR_KEY,
11854
- CACHE_SCOPE_TRANSACTION,
11855
- CACHE_SCOPE_KEY,
11856
- CACHE_SCOPE_CATALOG,
11857
- CACHE_REVALIDATABLE_KEY,
11858
- CACHE_PER_VALUE_KEY,
11859
- CACHE_PARTITION_SCOPE_KEY,
11860
- CACHE_NO_STORE_KEY,
11861
- CACHE_NOT_MODIFIED_KEY,
11862
- CACHE_LAST_MODIFIED_KEY,
11863
- CACHE_IF_NONE_MATCH_KEY,
11864
- CACHE_IF_MODIFIED_SINCE_KEY,
11865
- CACHE_EXPIRES_KEY,
11866
- CACHE_ETAG_KEY,
11867
- BoundStorage,
11868
- BindResultSchema,
11869
- AuthContext,
12006
+ ArgumentValidationError,
11870
12007
  Arguments,
11871
- ArgumentValidationError
12008
+ AuthContext,
12009
+ BindResultSchema,
12010
+ BoundStorage,
12011
+ CACHE_ETAG_KEY,
12012
+ CACHE_EXPIRES_KEY,
12013
+ CACHE_IF_MODIFIED_SINCE_KEY,
12014
+ CACHE_IF_NONE_MATCH_KEY,
12015
+ CACHE_LAST_MODIFIED_KEY,
12016
+ CACHE_NOT_MODIFIED_KEY,
12017
+ CACHE_NO_STORE_KEY,
12018
+ CACHE_PARTITION_SCOPE_KEY,
12019
+ CACHE_PER_VALUE_KEY,
12020
+ CACHE_REVALIDATABLE_KEY,
12021
+ CACHE_SCOPE_CATALOG,
12022
+ CACHE_SCOPE_KEY,
12023
+ CACHE_SCOPE_TRANSACTION,
12024
+ CACHE_STALE_IF_ERROR_KEY,
12025
+ CACHE_STALE_WHILE_REVALIDATE_KEY,
12026
+ CACHE_TTL_KEY,
12027
+ CatalogAlreadyExistsError,
12028
+ CatalogFunctionType,
12029
+ CatalogInterface,
12030
+ CatalogNotFoundError,
12031
+ CatalogReadOnlyError,
12032
+ ComparisonOp,
12033
+ CompositeCatalogInterface,
12034
+ DEFAULT_MAX_WORKERS,
12035
+ DateUnit3 as DateUnit,
12036
+ DistinctDependence,
12037
+ EXCHANGE_STATE_SCHEMA,
12038
+ FilteringOutputCollector,
12039
+ FunctionNotFoundError,
12040
+ FunctionRegistry,
12041
+ FunctionStability,
12042
+ FunctionStorageCfDo,
12043
+ FunctionStorageSqlite,
12044
+ FunctionType,
12045
+ GROUP_COLUMN_NAME,
12046
+ IntervalUnit2 as IntervalUnit,
12047
+ NoCatalogError,
12048
+ NullHandling,
12049
+ OrderDependence,
12050
+ OrderPreservation,
12051
+ OutputCollector,
12052
+ PARENT_ROW_METADATA_KEY,
12053
+ PushdownFilters,
12054
+ ReadOnlyCatalogInterface,
12055
+ RowCountMismatchError,
12056
+ ScanFunctionResultSchema,
12057
+ TableInOutPhase,
12058
+ TimeUnit2 as TimeUnit,
12059
+ TypeId,
12060
+ UnionMode2 as UnionMode,
12061
+ UnknownInvocationError,
12062
+ VgiClient,
12063
+ VgiClientError,
12064
+ VgiError,
12065
+ Worker,
12066
+ adoptArrowJsShape,
12067
+ argumentSpecsToSchema,
12068
+ arrowStateSerializer,
12069
+ arrowToMetadatas,
12070
+ asDate32,
12071
+ asDate64Ms,
12072
+ asDurationMicros,
12073
+ asDurationMillis,
12074
+ asDurationNanos,
12075
+ asDurationSeconds,
12076
+ asInt64,
12077
+ asTime32Ms,
12078
+ asTime32S,
12079
+ asTime64Ns,
12080
+ asTime64Us,
12081
+ asTimestampMicros,
12082
+ asTimestampMillis,
12083
+ asTimestampNanos,
12084
+ asTimestampSeconds,
12085
+ asUint64,
12086
+ asUnscaledDecimal,
12087
+ backend,
12088
+ batchFromColumns,
12089
+ batchFromRows,
12090
+ batchToScalarDict,
12091
+ batchToSecretDict,
12092
+ binary2 as binary,
12093
+ bool3 as bool,
12094
+ buildJoinKeysLookup,
12095
+ buildScanBranchesResult,
12096
+ buildVgiProtocol,
12097
+ bytes,
12098
+ cacheControlMetadata,
12099
+ codecFor,
12100
+ columnFromArray,
12101
+ constraintSpecFields,
12102
+ createLandingRoutes,
12103
+ date2 as date,
12104
+ dateDay2 as dateDay,
12105
+ dateMillisecond2 as dateMillisecond,
12106
+ decimal2 as decimal,
12107
+ decimal1282 as decimal128,
12108
+ decimal2562 as decimal256,
12109
+ decodeCatalogInfo,
12110
+ decodeDictValue,
12111
+ decodeFunctionInfo,
12112
+ decodeMacroInfo,
12113
+ decodeSchemaInfo,
12114
+ decodeTableInfo,
12115
+ decodeViewInfo,
12116
+ defineAggregate,
12117
+ defineCopyFromFunction,
12118
+ defineCopyToFunction,
12119
+ defineRowTransformFunction,
12120
+ defineScalarFunction,
12121
+ defineTableBufferingFunction,
12122
+ defineTableFunction,
12123
+ defineTableInOutFunction,
12124
+ denseUnion2 as denseUnion,
12125
+ deserializeAttachOptionSpec,
12126
+ deserializeAttachOptionSpecs,
12127
+ deserializeBatch,
12128
+ deserializeFilters,
12129
+ deserializeSchema,
12130
+ deserializeUserState,
12131
+ dictionary2 as dictionary,
12132
+ duration2 as duration,
12133
+ durationMicros,
12134
+ durationMillis,
12135
+ durationNanos,
12136
+ durationSeconds,
12137
+ emptyBatch,
12138
+ encodeCatalogInfo,
12139
+ encodeCopyFromFormatInfo,
12140
+ encodeFormatOptions,
12141
+ encodeFunctionInfo,
12142
+ encodeMacroInfo,
12143
+ encodeSchemaInfo,
12144
+ encodeTableInfo,
12145
+ encodeViewInfo,
12146
+ field2 as field,
12147
+ filterBatch,
12148
+ fixedSizeBinary2 as fixedSizeBinary,
12149
+ fixedSizeList2 as fixedSizeList,
12150
+ float,
12151
+ float162 as float16,
12152
+ float323 as float32,
12153
+ float642 as float64,
12154
+ formatPushedFilters,
12155
+ formatRange,
12156
+ fromBranded,
12157
+ fromBrandedBigInt,
12158
+ fromBrandedNumber,
12159
+ storage as functionStorage,
12160
+ httpConnect,
12161
+ int3 as int,
12162
+ int162 as int16,
12163
+ int323 as int32,
12164
+ int642 as int64,
12165
+ int82 as int8,
12166
+ interval2 as interval,
12167
+ isBatch,
12168
+ isBinary,
12169
+ isBool,
12170
+ isDate,
12171
+ isDecimal,
12172
+ isDictionary,
12173
+ isDuration,
12174
+ isFixedSizeBinary,
12175
+ isFixedSizeList,
12176
+ isFloat,
12177
+ isInt,
12178
+ isInterval,
12179
+ isList,
12180
+ isMap,
12181
+ isNull,
12182
+ isStruct,
12183
+ isTime,
12184
+ isTimestamp,
12185
+ isUnion,
12186
+ isUtf8,
12187
+ iterRows,
12188
+ largeBinary2 as largeBinary,
12189
+ largeUtf82 as largeUtf8,
12190
+ list2 as list,
12191
+ macroArgumentsSchema,
12192
+ macroParameterDocsFromSchema,
12193
+ map2 as map,
12194
+ metadatasToArrow,
12195
+ nullType2 as nullType,
12196
+ parentRowsMetadata,
12197
+ projectBatch,
12198
+ projectSchema,
12199
+ readCanonicalValue,
12200
+ reprPushedFilters,
12201
+ resolveMetadata,
12202
+ resolveStorageFromEnv,
12203
+ safeNumber,
12204
+ schema2 as schema,
12205
+ schemaToArgumentSpecs,
12206
+ secretForScope,
12207
+ secretForScopeOfType,
12208
+ secretType,
12209
+ secretsOfType,
12210
+ serializeAttachOptionSpec,
12211
+ serializeAttachOptionSpecs,
12212
+ serializeBatch,
12213
+ serializeColumnStatistics,
12214
+ serializeSchema,
12215
+ serializeUserState,
12216
+ setStorage,
12217
+ sparseUnion2 as sparseUnion,
12218
+ str,
12219
+ struct2 as struct,
12220
+ subprocessConnect,
12221
+ tcpConnect,
12222
+ time2 as time,
12223
+ timeMicrosecond2 as timeMicrosecond,
12224
+ timeMillisecond2 as timeMillisecond,
12225
+ timeNanosecond2 as timeNanosecond,
12226
+ timeSecond2 as timeSecond,
12227
+ timestamp2 as timestamp,
12228
+ timestampMicros,
12229
+ timestampMillis,
12230
+ timestampNanos,
12231
+ timestampSeconds,
12232
+ toSchema,
12233
+ toUint8Array,
12234
+ typeSignature,
12235
+ uint162 as uint16,
12236
+ uint322 as uint32,
12237
+ uint642 as uint64,
12238
+ uint82 as uint8,
12239
+ union2 as union,
12240
+ utf82 as utf8
11872
12241
  };
11873
12242
 
11874
- //# debugId=86694E0569653A9D64756E2164756E21
12243
+ //# debugId=8E82230A6E17921864756E2164756E21