@query-farm/vgi 0.20.0 → 0.21.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 (35) hide show
  1. package/dist/arrow/impl-arrowjs/index.d.ts +7 -0
  2. package/dist/arrow/impl-flechette/arrowjs-shape.d.ts +16 -0
  3. package/dist/arrow/impl-flechette/compat.d.ts +22 -0
  4. package/dist/arrow/impl-flechette/index.d.ts +2 -0
  5. package/dist/arrow/impl-flechette/ipc.d.ts +1 -1
  6. package/dist/arrow/index.d.ts +2 -2
  7. package/dist/arrow/predicates.d.ts +16 -0
  8. package/dist/cache-control.d.ts +7 -0
  9. package/dist/client-entry.js +5 -1
  10. package/dist/client-entry.js.map +4 -4
  11. package/dist/index.core.d.ts +2 -2
  12. package/dist/index.js +56 -4
  13. package/dist/index.js.map +10 -10
  14. package/dist/serve-entry.js +6 -1
  15. package/dist/serve-entry.js.map +5 -5
  16. package/dist/util/arrow/index.d.ts +1 -1
  17. package/dist/worker-cf-entry.js +53 -4
  18. package/dist/worker-cf-entry.js.map +9 -9
  19. package/package.json +5 -5
  20. package/src/arrow/impl-arrowjs/index.ts +10 -0
  21. package/src/arrow/impl-flechette/arrowjs-shape.ts +78 -0
  22. package/src/arrow/impl-flechette/canonical.ts +19 -0
  23. package/src/arrow/impl-flechette/compat.ts +254 -0
  24. package/src/arrow/impl-flechette/empty.ts +5 -1
  25. package/src/arrow/impl-flechette/index.ts +8 -0
  26. package/src/arrow/impl-flechette/ipc.ts +72 -6
  27. package/src/arrow/impl-flechette/normalize-type.ts +10 -2
  28. package/src/arrow/impl-flechette/schema.ts +13 -9
  29. package/src/arrow/index.ts +3 -0
  30. package/src/arrow/predicates.ts +59 -0
  31. package/src/cache-control.ts +8 -0
  32. package/src/functions/registry.ts +21 -4
  33. package/src/index.core.ts +3 -0
  34. package/src/protocol/handlers/function.ts +9 -1
  35. package/src/util/arrow/index.ts +1 -0
@@ -1 +1 @@
1
- export { emptyBatch, batchFromRows, batchFromColumns, iterRows, batchToScalarDict, batchToSecretDict, safeNumber, decodeDictValue, filterBatch, projectSchema, projectBatch, serializeSchema, deserializeSchema, serializeBatch, deserializeBatch, } from "../../arrow/index.js";
1
+ export { emptyBatch, batchFromRows, batchFromColumns, iterRows, batchToScalarDict, batchToSecretDict, safeNumber, decodeDictValue, filterBatch, projectSchema, projectBatch, serializeSchema, deserializeSchema, serializeBatch, deserializeBatch, adoptArrowJsShape, } from "../../arrow/index.js";
@@ -95,6 +95,42 @@ function isDuration(t) {
95
95
  function isDictionary(t) {
96
96
  return t.typeId === TypeId.Dictionary;
97
97
  }
98
+ function typeSignature(t) {
99
+ if (t == null)
100
+ return "null";
101
+ const a = t;
102
+ const kids = () => Array.isArray(a.children) ? a.children.map((c) => `${c?.name ?? ""}:${typeSignature(c?.type ?? c)}`).join(",") : "";
103
+ switch (t.typeId) {
104
+ case TypeId.Int:
105
+ return `int${a.bitWidth}${a.isSigned ?? a.signed ?? true ? "" : "u"}`;
106
+ case TypeId.Float:
107
+ return `float${a.precision}`;
108
+ case TypeId.Decimal:
109
+ return `decimal${a.bitWidth ?? 128}(${a.precision},${a.scale})`;
110
+ case TypeId.Date:
111
+ case TypeId.Time:
112
+ case TypeId.Duration:
113
+ return `${t.typeId}[${a.unit}]`;
114
+ case TypeId.Timestamp:
115
+ return `ts[${a.unit},${a.timezone ?? ""}]`;
116
+ case TypeId.Interval:
117
+ return `iv[${a.unit}]`;
118
+ case TypeId.FixedSizeBinary:
119
+ return `fsb(${a.byteWidth ?? a.stride})`;
120
+ case TypeId.FixedSizeList:
121
+ return `fsl(${a.listSize ?? a.stride},${kids()})`;
122
+ case TypeId.List:
123
+ case TypeId.Struct:
124
+ case TypeId.Map:
125
+ return `${t.typeId}<${kids()}>`;
126
+ case TypeId.Union:
127
+ return `union(${a.mode},${kids()})`;
128
+ case TypeId.Dictionary:
129
+ return `dict(${typeSignature(a.dictionary)},${typeSignature(a.indices)},${a.ordered ?? a.isOrdered ?? false})`;
130
+ default:
131
+ return Array.isArray(a.children) ? `${t.typeId}<${kids()}>` : String(t.typeId);
132
+ }
133
+ }
98
134
  function isBatch(x) {
99
135
  return x != null && typeof x.numRows === "number" && x.schema != null && Array.isArray(x.schema.fields);
100
136
  }
@@ -1825,11 +1861,15 @@ __export(exports_impl_arrowjs, {
1825
1861
  batchFromRows: () => batchFromRows,
1826
1862
  batchFromColumns: () => batchFromColumns,
1827
1863
  backend: () => backend,
1864
+ adoptArrowJsShape: () => adoptArrowJsShape,
1828
1865
  UnionMode: () => UnionMode,
1829
1866
  TimeUnit: () => TimeUnit,
1830
1867
  IntervalUnit: () => IntervalUnit,
1831
1868
  DateUnit: () => DateUnit
1832
1869
  });
1870
+ function adoptArrowJsShape(batch) {
1871
+ return batch;
1872
+ }
1833
1873
  var backend;
1834
1874
  var init_impl_arrowjs = __esm(() => {
1835
1875
  init_schema();
@@ -1945,6 +1985,7 @@ __export(exports_arrow, {
1945
1985
  uint64: () => uint642,
1946
1986
  uint32: () => uint322,
1947
1987
  uint16: () => uint162,
1988
+ typeSignature: () => typeSignature,
1948
1989
  timestampSeconds: () => timestampSeconds,
1949
1990
  timestampNanos: () => timestampNanos,
1950
1991
  timestampMillis: () => timestampMillis,
@@ -2048,6 +2089,7 @@ __export(exports_arrow, {
2048
2089
  asDurationMicros: () => asDurationMicros,
2049
2090
  asDate64Ms: () => asDate64Ms,
2050
2091
  asDate32: () => asDate32,
2092
+ adoptArrowJsShape: () => adoptArrowJsShape,
2051
2093
  UnionMode: () => UnionMode2,
2052
2094
  TypeId: () => TypeId,
2053
2095
  TimeUnit: () => TimeUnit2,
@@ -4880,6 +4922,7 @@ function registerFunctionMethods(protocol, config) {
4880
4922
  return state;
4881
4923
  },
4882
4924
  exchange: async (state, input, out) => {
4925
+ input = adoptArrowJsShape(input);
4883
4926
  let handlers;
4884
4927
  let handlerState;
4885
4928
  if (state._handlers) {
@@ -7236,6 +7279,7 @@ var CACHE_REVALIDATABLE_KEY = "vgi.cache.revalidatable";
7236
7279
  var CACHE_STALE_WHILE_REVALIDATE_KEY = "vgi.cache.stale_while_revalidate";
7237
7280
  var CACHE_STALE_IF_ERROR_KEY = "vgi.cache.stale_if_error";
7238
7281
  var CACHE_NOT_MODIFIED_KEY = "vgi.cache.not_modified";
7282
+ var CACHE_PARTITION_SCOPE_KEY = "vgi.cache.partition_scope";
7239
7283
  var CACHE_IF_NONE_MATCH_KEY = "vgi.cache.if_none_match";
7240
7284
  var CACHE_IF_MODIFIED_SINCE_KEY = "vgi.cache.if_modified_since";
7241
7285
  var CACHE_SCOPE_CATALOG = "catalog";
@@ -7272,6 +7316,8 @@ function cacheControlMetadata(cc, extra) {
7272
7316
  md.set(CACHE_STALE_IF_ERROR_KEY, String(cc.staleIfError));
7273
7317
  if (cc.notModified)
7274
7318
  md.set(CACHE_NOT_MODIFIED_KEY, "1");
7319
+ if (cc.partitionScope)
7320
+ md.set(CACHE_PARTITION_SCOPE_KEY, "1");
7275
7321
  return md;
7276
7322
  }
7277
7323
 
@@ -8761,8 +8807,11 @@ class CompositeCatalogInterface extends CatalogInterface {
8761
8807
  init_arrow();
8762
8808
  var EXACT_MATCH_SCORE = 2;
8763
8809
  var FAMILY_MATCH_SCORE = 1;
8810
+ function typesIdentical(a, b) {
8811
+ return typeSignature(a) === typeSignature(b);
8812
+ }
8764
8813
  function typesCompatible(actual, declared) {
8765
- if (actual.toString() === declared.toString())
8814
+ if (typesIdentical(actual, declared))
8766
8815
  return true;
8767
8816
  if (isInt(actual) && isInt(declared))
8768
8817
  return true;
@@ -8790,7 +8839,7 @@ function scoreTypes(specs, actualTypes) {
8790
8839
  const actual = actualTypes[i];
8791
8840
  if (actual === null)
8792
8841
  continue;
8793
- if (actual.toString() === spec.arrowType.toString()) {
8842
+ if (typesIdentical(actual, spec.arrowType)) {
8794
8843
  score += EXACT_MATCH_SCORE;
8795
8844
  } else if (typesCompatible(actual, spec.arrowType)) {
8796
8845
  score += FAMILY_MATCH_SCORE;
@@ -8803,7 +8852,7 @@ function scoreTypes(specs, actualTypes) {
8803
8852
  const actual = actualTypes[i];
8804
8853
  if (actual === null)
8805
8854
  continue;
8806
- if (actual.toString() === varArgsSpec.arrowType.toString()) {
8855
+ if (typesIdentical(actual, varArgsSpec.arrowType)) {
8807
8856
  score += EXACT_MATCH_SCORE;
8808
8857
  } else if (typesCompatible(actual, varArgsSpec.arrowType)) {
8809
8858
  score += FAMILY_MATCH_SCORE;
@@ -9531,4 +9580,4 @@ export {
9531
9580
  Arguments
9532
9581
  };
9533
9582
 
9534
- //# debugId=9CBEC1BA4EDD0C8364756E2164756E21
9583
+ //# debugId=702D54392090E98D64756E2164756E21