@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.
- package/dist/arrow/impl-arrowjs/index.d.ts +7 -0
- package/dist/arrow/impl-flechette/arrowjs-shape.d.ts +16 -0
- package/dist/arrow/impl-flechette/compat.d.ts +22 -0
- package/dist/arrow/impl-flechette/index.d.ts +2 -0
- package/dist/arrow/impl-flechette/ipc.d.ts +1 -1
- package/dist/arrow/index.d.ts +2 -2
- package/dist/arrow/predicates.d.ts +16 -0
- package/dist/cache-control.d.ts +7 -0
- package/dist/client-entry.js +5 -1
- package/dist/client-entry.js.map +4 -4
- package/dist/index.core.d.ts +2 -2
- package/dist/index.js +56 -4
- package/dist/index.js.map +10 -10
- package/dist/serve-entry.js +6 -1
- package/dist/serve-entry.js.map +5 -5
- package/dist/util/arrow/index.d.ts +1 -1
- package/dist/worker-cf-entry.js +53 -4
- package/dist/worker-cf-entry.js.map +9 -9
- package/package.json +5 -5
- package/src/arrow/impl-arrowjs/index.ts +10 -0
- package/src/arrow/impl-flechette/arrowjs-shape.ts +78 -0
- package/src/arrow/impl-flechette/canonical.ts +19 -0
- package/src/arrow/impl-flechette/compat.ts +254 -0
- package/src/arrow/impl-flechette/empty.ts +5 -1
- package/src/arrow/impl-flechette/index.ts +8 -0
- package/src/arrow/impl-flechette/ipc.ts +72 -6
- package/src/arrow/impl-flechette/normalize-type.ts +10 -2
- package/src/arrow/impl-flechette/schema.ts +13 -9
- package/src/arrow/index.ts +3 -0
- package/src/arrow/predicates.ts +59 -0
- package/src/cache-control.ts +8 -0
- package/src/functions/registry.ts +21 -4
- package/src/index.core.ts +3 -0
- package/src/protocol/handlers/function.ts +9 -1
- package/src/util/arrow/index.ts +1 -0
package/dist/index.core.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { CACHE_ETAG_KEY, CACHE_EXPIRES_KEY, CACHE_IF_MODIFIED_SINCE_KEY, CACHE_IF_NONE_MATCH_KEY, CACHE_LAST_MODIFIED_KEY, CACHE_NO_STORE_KEY, CACHE_NOT_MODIFIED_KEY, CACHE_REVALIDATABLE_KEY, CACHE_SCOPE_CATALOG, CACHE_SCOPE_KEY, CACHE_SCOPE_TRANSACTION, CACHE_STALE_IF_ERROR_KEY, CACHE_STALE_WHILE_REVALIDATE_KEY, CACHE_TTL_KEY, type CacheControl, cacheControlMetadata, type CacheScope, } from "./cache-control.js";
|
|
1
|
+
export { CACHE_ETAG_KEY, CACHE_EXPIRES_KEY, CACHE_IF_MODIFIED_SINCE_KEY, CACHE_IF_NONE_MATCH_KEY, CACHE_LAST_MODIFIED_KEY, CACHE_NO_STORE_KEY, CACHE_NOT_MODIFIED_KEY, CACHE_PARTITION_SCOPE_KEY, CACHE_REVALIDATABLE_KEY, CACHE_SCOPE_CATALOG, CACHE_SCOPE_KEY, CACHE_SCOPE_TRANSACTION, CACHE_STALE_IF_ERROR_KEY, CACHE_STALE_WHILE_REVALIDATE_KEY, CACHE_TTL_KEY, type CacheControl, cacheControlMetadata, type CacheScope, } from "./cache-control.js";
|
|
2
2
|
export { defineScalarFunction, type ScalarFunctionConfig, type ScalarBindParameters, type ScalarParameterDef } from "./functions/scalar.js";
|
|
3
3
|
export { defineTableFunction, type TableFunctionConfig, type TableBindParams, type TableProcessParams } from "./functions/table.js";
|
|
4
4
|
export { defineAggregate, GROUP_COLUMN_NAME, type AggregateFunctionConfig, type AggregateBindParams, type AggregateUpdateParams, type AggregateFinalizeParams, } from "./functions/aggregate.js";
|
|
@@ -32,7 +32,7 @@ export { toUint8Array } from "./util/bytes.js";
|
|
|
32
32
|
export { iterRows, batchFromRows, batchFromColumns, emptyBatch, filterBatch, projectSchema, projectBatch, batchToScalarDict, batchToSecretDict, safeNumber, } from "./util/arrow/index.js";
|
|
33
33
|
export { type SecretFields, type SecretsDict, secretType, secretsOfType, secretForScope, secretForScopeOfType, } from "./secrets/helpers.js";
|
|
34
34
|
export { serializeSchema, deserializeSchema, serializeBatch, deserializeBatch, } from "./util/arrow/index.js";
|
|
35
|
-
export { schema, field, nullType, int8, int16, int64, uint8, uint16, uint32, uint64, float16, float64, utf8, binary, fixedSizeBinary, decimal, decimal128, decimal256, date, dateDay, dateMillisecond, time, timeSecond, timeMillisecond, timeMicrosecond, timeNanosecond, timestamp, duration, interval, timestampSeconds, timestampMillis, timestampMicros, timestampNanos, durationSeconds, durationMillis, durationMicros, durationNanos, list, fixedSizeList, struct, map, dictionary, union, sparseUnion, denseUnion, TimeUnit, DateUnit, IntervalUnit, UnionMode, codecFor, asDate32, asDate64Ms, asTime32S, asTime32Ms, asTime64Us, asTime64Ns, asTimestampSeconds, asTimestampMillis, asTimestampMicros, asTimestampNanos, asDurationSeconds, asDurationMillis, asDurationMicros, asDurationNanos, asUnscaledDecimal, asInt64, asUint64, fromBranded, fromBrandedNumber, fromBrandedBigInt, TypeId, isNull, isInt, isFloat, isBinary, isUtf8, isBool, isDecimal, isDate, isTime, isTimestamp, isInterval, isList, isStruct, isUnion, isFixedSizeBinary, isFixedSizeList, isMap, isDuration, isDictionary, isBatch, readCanonicalValue, columnFromArray, decodeDictValue, backend, } from "./arrow/index.js";
|
|
35
|
+
export { schema, field, nullType, int8, int16, int64, uint8, uint16, uint32, uint64, float16, float64, utf8, binary, fixedSizeBinary, decimal, decimal128, decimal256, date, dateDay, dateMillisecond, time, timeSecond, timeMillisecond, timeMicrosecond, timeNanosecond, timestamp, duration, interval, timestampSeconds, timestampMillis, timestampMicros, timestampNanos, durationSeconds, durationMillis, durationMicros, durationNanos, list, fixedSizeList, struct, map, dictionary, union, sparseUnion, denseUnion, TimeUnit, DateUnit, IntervalUnit, UnionMode, codecFor, asDate32, asDate64Ms, asTime32S, asTime32Ms, asTime64Us, asTime64Ns, asTimestampSeconds, asTimestampMillis, asTimestampMicros, asTimestampNanos, asDurationSeconds, asDurationMillis, asDurationMicros, asDurationNanos, asUnscaledDecimal, asInt64, asUint64, fromBranded, fromBrandedNumber, fromBrandedBigInt, TypeId, isNull, isInt, isFloat, isBinary, isUtf8, isBool, isDecimal, isDate, isTime, isTimestamp, isInterval, isList, isStruct, isUnion, isFixedSizeBinary, isFixedSizeList, isMap, isDuration, isDictionary, isBatch, typeSignature, readCanonicalValue, columnFromArray, decodeDictValue, backend, adoptArrowJsShape, } from "./arrow/index.js";
|
|
36
36
|
export type { VgiTypeId, VgiDataType, VgiField, VgiSchema, VgiColumn, VgiColumnData, VgiBatch, VgiBackendInfo, TaggedUnion, NullDescriptor, BoolType, IntType, Int8Type, Int16Type, Int32Type, Int64Type, Uint8Type, Uint16Type, Uint32Type, Uint64Type, FloatType, Utf8Type, LargeUtf8Type, BinaryType, LargeBinaryType, FixedSizeBinaryType, DecimalType, Date32Type, Date64Type, Time32Type, Time64Type, TimestampType, DurationType, IntervalType, ListType, FixedSizeListType, StructType, MapType, DictionaryType, UnionType, TypedField, TUnit, RichValue, RawValue, ValueFor, Repr, Codec, Branded, Date32, Date64Ms, Time32S, Time32Ms, Time64Us, Time64Ns, TimestampSeconds, TimestampMillis, TimestampMicros, TimestampNanos, DurationSeconds, DurationMillis, DurationMicros, DurationNanos, UnscaledDecimal, Int64Raw, Uint64Raw, } from "./arrow/index.js";
|
|
37
37
|
export type { ScalarComputeRow, ScalarOutputValue, ScalarComputeResult } from "./functions/scalar.js";
|
|
38
38
|
export { type FunctionStorage, FunctionStorageSqlite, BoundStorage, UnknownInvocationError, resolveStorageFromEnv, setStorage, storage as functionStorage, } from "./functions/storage.js";
|
package/dist/index.js
CHANGED
|
@@ -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,
|
|
@@ -2568,6 +2610,7 @@ var CACHE_REVALIDATABLE_KEY = "vgi.cache.revalidatable";
|
|
|
2568
2610
|
var CACHE_STALE_WHILE_REVALIDATE_KEY = "vgi.cache.stale_while_revalidate";
|
|
2569
2611
|
var CACHE_STALE_IF_ERROR_KEY = "vgi.cache.stale_if_error";
|
|
2570
2612
|
var CACHE_NOT_MODIFIED_KEY = "vgi.cache.not_modified";
|
|
2613
|
+
var CACHE_PARTITION_SCOPE_KEY = "vgi.cache.partition_scope";
|
|
2571
2614
|
var CACHE_IF_NONE_MATCH_KEY = "vgi.cache.if_none_match";
|
|
2572
2615
|
var CACHE_IF_MODIFIED_SINCE_KEY = "vgi.cache.if_modified_since";
|
|
2573
2616
|
var CACHE_SCOPE_CATALOG = "catalog";
|
|
@@ -2604,6 +2647,8 @@ function cacheControlMetadata(cc, extra) {
|
|
|
2604
2647
|
md.set(CACHE_STALE_IF_ERROR_KEY, String(cc.staleIfError));
|
|
2605
2648
|
if (cc.notModified)
|
|
2606
2649
|
md.set(CACHE_NOT_MODIFIED_KEY, "1");
|
|
2650
|
+
if (cc.partitionScope)
|
|
2651
|
+
md.set(CACHE_PARTITION_SCOPE_KEY, "1");
|
|
2607
2652
|
return md;
|
|
2608
2653
|
}
|
|
2609
2654
|
// src/functions/scalar.ts
|
|
@@ -7694,8 +7739,11 @@ class CompositeCatalogInterface extends CatalogInterface {
|
|
|
7694
7739
|
init_arrow();
|
|
7695
7740
|
var EXACT_MATCH_SCORE = 2;
|
|
7696
7741
|
var FAMILY_MATCH_SCORE = 1;
|
|
7742
|
+
function typesIdentical(a, b) {
|
|
7743
|
+
return typeSignature(a) === typeSignature(b);
|
|
7744
|
+
}
|
|
7697
7745
|
function typesCompatible(actual, declared) {
|
|
7698
|
-
if (actual
|
|
7746
|
+
if (typesIdentical(actual, declared))
|
|
7699
7747
|
return true;
|
|
7700
7748
|
if (isInt(actual) && isInt(declared))
|
|
7701
7749
|
return true;
|
|
@@ -7723,7 +7771,7 @@ function scoreTypes(specs, actualTypes) {
|
|
|
7723
7771
|
const actual = actualTypes[i];
|
|
7724
7772
|
if (actual === null)
|
|
7725
7773
|
continue;
|
|
7726
|
-
if (actual
|
|
7774
|
+
if (typesIdentical(actual, spec.arrowType)) {
|
|
7727
7775
|
score += EXACT_MATCH_SCORE;
|
|
7728
7776
|
} else if (typesCompatible(actual, spec.arrowType)) {
|
|
7729
7777
|
score += FAMILY_MATCH_SCORE;
|
|
@@ -7736,7 +7784,7 @@ function scoreTypes(specs, actualTypes) {
|
|
|
7736
7784
|
const actual = actualTypes[i];
|
|
7737
7785
|
if (actual === null)
|
|
7738
7786
|
continue;
|
|
7739
|
-
if (actual
|
|
7787
|
+
if (typesIdentical(actual, varArgsSpec.arrowType)) {
|
|
7740
7788
|
score += EXACT_MATCH_SCORE;
|
|
7741
7789
|
} else if (typesCompatible(actual, varArgsSpec.arrowType)) {
|
|
7742
7790
|
score += FAMILY_MATCH_SCORE;
|
|
@@ -9169,6 +9217,7 @@ function registerFunctionMethods(protocol, config) {
|
|
|
9169
9217
|
return state;
|
|
9170
9218
|
},
|
|
9171
9219
|
exchange: async (state, input, out) => {
|
|
9220
|
+
input = adoptArrowJsShape(input);
|
|
9172
9221
|
let handlers;
|
|
9173
9222
|
let handlerState;
|
|
9174
9223
|
if (state._handlers) {
|
|
@@ -11754,6 +11803,7 @@ export {
|
|
|
11754
11803
|
uint642 as uint64,
|
|
11755
11804
|
uint322 as uint32,
|
|
11756
11805
|
uint162 as uint16,
|
|
11806
|
+
typeSignature,
|
|
11757
11807
|
toUint8Array,
|
|
11758
11808
|
toSchema,
|
|
11759
11809
|
timestampSeconds,
|
|
@@ -11918,6 +11968,7 @@ export {
|
|
|
11918
11968
|
arrowToMetadatas,
|
|
11919
11969
|
arrowStateSerializer,
|
|
11920
11970
|
argumentSpecsToSchema,
|
|
11971
|
+
adoptArrowJsShape,
|
|
11921
11972
|
Worker,
|
|
11922
11973
|
VgiError,
|
|
11923
11974
|
VgiClientError,
|
|
@@ -11966,6 +12017,7 @@ export {
|
|
|
11966
12017
|
CACHE_SCOPE_KEY,
|
|
11967
12018
|
CACHE_SCOPE_CATALOG,
|
|
11968
12019
|
CACHE_REVALIDATABLE_KEY,
|
|
12020
|
+
CACHE_PARTITION_SCOPE_KEY,
|
|
11969
12021
|
CACHE_NO_STORE_KEY,
|
|
11970
12022
|
CACHE_NOT_MODIFIED_KEY,
|
|
11971
12023
|
CACHE_LAST_MODIFIED_KEY,
|
|
@@ -11980,4 +12032,4 @@ export {
|
|
|
11980
12032
|
ArgumentValidationError
|
|
11981
12033
|
};
|
|
11982
12034
|
|
|
11983
|
-
//# debugId=
|
|
12035
|
+
//# debugId=16E563A7CD4C6BEC64756E2164756E21
|