@query-farm/vgi 0.28.0 → 0.29.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -8
- package/dist/arguments/argument-spec.d.ts +57 -2
- package/dist/arrow/impl-arrowjs/index.d.ts +1 -1
- package/dist/arrow/impl-arrowjs/iterate.d.ts +10 -1
- package/dist/arrow/impl-arrowjs/schema.d.ts +2 -0
- package/dist/arrow/impl-flechette/index.d.ts +1 -1
- package/dist/arrow/impl-flechette/iterate.d.ts +10 -1
- package/dist/arrow/impl-flechette/schema.d.ts +2 -0
- package/dist/arrow/index.d.ts +1 -1
- package/dist/arrow/schema-types.d.ts +3 -1
- package/dist/arrow/types.d.ts +39 -3
- package/dist/catalog/composite.d.ts +13 -13
- package/dist/catalog/descriptors.d.ts +7 -3
- package/dist/catalog/interface.d.ts +108 -38
- package/dist/catalog/read-only.d.ts +32 -15
- package/dist/client/client.d.ts +37 -30
- package/dist/client/types.d.ts +2 -0
- package/dist/client-entry.d.ts +1 -1
- package/dist/client-entry.js +791 -447
- package/dist/client-entry.js.map +18 -17
- package/dist/filter-pushdown/capabilities.d.ts +3 -0
- package/dist/filter-pushdown/deserialize.d.ts +14 -15
- package/dist/filter-pushdown/evaluate.d.ts +14 -44
- package/dist/filter-pushdown/index.d.ts +2 -2
- package/dist/filter-pushdown/types.d.ts +120 -68
- package/dist/functions/aggregate.d.ts +4 -0
- package/dist/functions/registry.d.ts +5 -5
- package/dist/functions/scalar.d.ts +6 -1
- package/dist/functions/table-buffering.d.ts +9 -0
- package/dist/functions/table-in-out.d.ts +13 -0
- package/dist/functions/table.d.ts +72 -2
- package/dist/functions/types.d.ts +60 -2
- package/dist/generated/vgi-client.d.ts +114 -26
- package/dist/generated/vgi-protocol-schemas.d.ts +34 -0
- package/dist/http/fetch.d.ts +16 -0
- package/dist/index.core.d.ts +4 -3
- package/dist/index.js +3396 -2064
- package/dist/index.js.map +55 -49
- package/dist/metadata/types.d.ts +15 -2
- package/dist/protocol/handlers/catalog/shared.d.ts +0 -8
- package/dist/protocol/handlers/function.d.ts +11 -0
- package/dist/protocol/handlers/shared.d.ts +3 -1
- package/dist/protocol/serializers/bind.d.ts +1 -2
- package/dist/protocol/serializers/cardinality.d.ts +1 -2
- package/dist/protocol/serializers/splits.d.ts +126 -0
- package/dist/protocol/types.d.ts +36 -3
- package/dist/request-auth.d.ts +28 -0
- package/dist/schema-path.d.ts +7 -0
- package/dist/serve-entry.d.ts +25 -0
- package/dist/serve-entry.js +1129 -569
- package/dist/serve-entry.js.map +36 -32
- package/dist/split-token.d.ts +88 -0
- package/dist/types.d.ts +8 -0
- package/dist/worker-cf-entry.js +2928 -1689
- package/dist/worker-cf-entry.js.map +51 -44
- package/dist/worker.d.ts +1 -1
- package/package.json +3 -3
- package/src/arguments/argument-spec.ts +93 -4
- package/src/arguments/arguments.ts +0 -1
- package/src/arrow/impl-arrowjs/index.ts +1 -1
- package/src/arrow/impl-arrowjs/iterate.ts +21 -0
- package/src/arrow/impl-arrowjs/schema.ts +4 -0
- package/src/arrow/impl-flechette/index.ts +1 -1
- package/src/arrow/impl-flechette/iterate.ts +24 -1
- package/src/arrow/impl-flechette/schema.ts +4 -0
- package/src/arrow/index.ts +1 -1
- package/src/arrow/schema-types.ts +4 -0
- package/src/arrow/types.ts +39 -3
- package/src/catalog/composite.ts +26 -26
- package/src/catalog/descriptors.ts +12 -3
- package/src/catalog/interface.ts +217 -72
- package/src/catalog/read-only.ts +141 -84
- package/src/client/client.ts +97 -73
- package/src/client/types.ts +2 -0
- package/src/client-entry.ts +2 -1
- package/src/filter-pushdown/capabilities.ts +13 -0
- package/src/filter-pushdown/collector.ts +22 -35
- package/src/filter-pushdown/deserialize.ts +657 -221
- package/src/filter-pushdown/evaluate.ts +410 -499
- package/src/filter-pushdown/index.ts +16 -2
- package/src/filter-pushdown/types.ts +88 -71
- package/src/functions/aggregate.ts +12 -1
- package/src/functions/copy-from.ts +2 -1
- package/src/functions/copy-to.ts +2 -1
- package/src/functions/registry.ts +24 -22
- package/src/functions/scalar.ts +37 -0
- package/src/functions/table-buffering.ts +48 -6
- package/src/functions/table-in-out.ts +194 -33
- package/src/functions/table.ts +187 -22
- package/src/functions/types.ts +64 -1
- package/src/generated/vgi-client.ts +122 -28
- package/src/generated/vgi-protocol-schemas.ts +455 -58
- package/src/http/fetch.ts +129 -2
- package/src/index.core.ts +4 -2
- package/src/metadata/resolve.ts +43 -1
- package/src/metadata/serialize.ts +43 -5
- package/src/metadata/types.ts +17 -1
- package/src/protocol/dispatch.ts +1 -1
- package/src/protocol/handlers/aggregate.ts +23 -12
- package/src/protocol/handlers/catalog/admin.ts +47 -54
- package/src/protocol/handlers/catalog/index_methods.ts +6 -13
- package/src/protocol/handlers/catalog/macro.ts +12 -20
- package/src/protocol/handlers/catalog/shared.ts +12 -57
- package/src/protocol/handlers/catalog/table.ts +49 -112
- package/src/protocol/handlers/catalog/view.ts +18 -22
- package/src/protocol/handlers/function.ts +311 -18
- package/src/protocol/handlers/shared.ts +12 -3
- package/src/protocol/handlers/table-buffering.ts +11 -8
- package/src/protocol/serializers/bind.ts +69 -67
- package/src/protocol/serializers/cardinality.ts +7 -7
- package/src/protocol/serializers/init.ts +52 -10
- package/src/protocol/serializers/splits.ts +221 -0
- package/src/protocol/state-serializer.ts +55 -1
- package/src/protocol/types.ts +36 -3
- package/src/request-auth.ts +73 -0
- package/src/schema-path.ts +25 -0
- package/src/serve-entry.ts +69 -2
- package/src/split-token.ts +297 -0
- package/src/types.ts +9 -0
- package/src/worker-cf-entry.ts +2 -1
- package/src/worker.ts +79 -14
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
import { type VgiBatch, type VgiSchema, isBatch } from "../arrow/index.js";
|
|
7
7
|
import type { OutputCollector } from "@query-farm/vgi-rpc";
|
|
8
8
|
import { batchFromColumns } from "../util/arrow/index.js";
|
|
9
|
-
import { ComparisonOp, type
|
|
10
|
-
import { PushdownFilters } from "./evaluate.js";
|
|
9
|
+
import { ComparisonOp, type FilterExpression } from "./types.js";
|
|
10
|
+
import { expressionToSql, PushdownFilters } from "./evaluate.js";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Format pushdown filters as a human-readable SQL-like string.
|
|
@@ -40,47 +40,34 @@ function opSymbol(op: ComparisonOp): string {
|
|
|
40
40
|
case ComparisonOp.GE: return ">=";
|
|
41
41
|
case ComparisonOp.LT: return "<";
|
|
42
42
|
case ComparisonOp.LE: return "<=";
|
|
43
|
+
case ComparisonOp.DISTINCT_FROM: return "IS DISTINCT FROM";
|
|
44
|
+
case ComparisonOp.NOT_DISTINCT_FROM: return "IS NOT DISTINCT FROM";
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
47
|
|
|
46
|
-
function reprFilter(f:
|
|
47
|
-
switch (f.
|
|
48
|
-
case "
|
|
49
|
-
|
|
48
|
+
function reprFilter(f: FilterExpression): string {
|
|
49
|
+
switch (f.node) {
|
|
50
|
+
case "comparison": {
|
|
51
|
+
if (f.left.node === "column_ref" && f.right.node === "literal") {
|
|
52
|
+
return `ConstantFilter(${f.left.columnName} ${opSymbol(f.op)} ${reprValue(f.right.value)})`;
|
|
53
|
+
}
|
|
54
|
+
return `V2ExpressionFilter(${expressionToSql(f)})`;
|
|
55
|
+
}
|
|
50
56
|
case "is_null":
|
|
51
|
-
return `
|
|
52
|
-
case "is_not_null":
|
|
53
|
-
return `IsNotNullFilter(${f.columnName} IS NOT NULL)`;
|
|
57
|
+
return `Is${f.negated ? "Not" : ""}NullFilter(${expressionToSql(f)})`;
|
|
54
58
|
case "in": {
|
|
55
|
-
const values =
|
|
59
|
+
const values = f.set.values;
|
|
56
60
|
const preview = values.length > 5
|
|
57
|
-
?
|
|
58
|
-
:
|
|
59
|
-
return `InFilter(${f.
|
|
60
|
-
}
|
|
61
|
-
case "and": {
|
|
62
|
-
const kids = f.children.map(reprFilter).join(" AND ");
|
|
63
|
-
return `AndFilter(${kids})`;
|
|
61
|
+
? `[${values.slice(0, 3).map(reprValue).join(", ")}]...(${values.length} total)`
|
|
62
|
+
: `[${values.map(reprValue).join(", ")}]`;
|
|
63
|
+
return `InFilter(${expressionToSql(f.expression)} IN ${preview})`;
|
|
64
64
|
}
|
|
65
|
-
case "or": {
|
|
66
|
-
const kids = f.children.map(reprFilter).join(" OR ");
|
|
67
|
-
return
|
|
65
|
+
case "and": case "or": {
|
|
66
|
+
const kids = f.children.map(reprFilter).join(f.node === "and" ? " AND " : " OR ");
|
|
67
|
+
return `${f.node === "and" ? "And" : "Or"}Filter(${kids})`;
|
|
68
68
|
}
|
|
69
|
-
|
|
70
|
-
return `
|
|
71
|
-
case "expression":
|
|
72
|
-
return `ExpressionFilter(${f.columnName}: ${reprExpr(f.expr)})`;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function reprExpr(e: ExprNode): string {
|
|
77
|
-
switch (e.expr_type) {
|
|
78
|
-
case "column_ref": return `col#${e.index}`;
|
|
79
|
-
case "constant": return reprValue(e.value);
|
|
80
|
-
case "function": return `${e.function_name}(${e.children.map(reprExpr).join(", ")})`;
|
|
81
|
-
case "comparison": return `(${reprExpr(e.left)} ${opSymbol(e.op)} ${reprExpr(e.right)})`;
|
|
82
|
-
case "conjunction":
|
|
83
|
-
return `(${e.children.map(reprExpr).join(e.conjunction_type === "and" ? " AND " : " OR ")})`;
|
|
69
|
+
default:
|
|
70
|
+
return `V2ExpressionFilter(${expressionToSql(f)})`;
|
|
84
71
|
}
|
|
85
72
|
}
|
|
86
73
|
|