@harperfast/harper 5.2.0-alpha.6 → 5.2.0-beta.2
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/bin/cliOperations.ts +76 -12
- package/bin/run.ts +10 -0
- package/bin/status.ts +1 -1
- package/components/Application.ts +146 -83
- package/components/Scope.ts +4 -0
- package/components/componentLoader.ts +7 -0
- package/components/operations.js +21 -1
- package/config/configUtils.ts +139 -5
- package/config-app.schema.json +70 -0
- package/dataLayer/harperBridge/ResourceBridge.ts +7 -0
- package/dist/bin/cliOperations.js +76 -12
- package/dist/bin/cliOperations.js.map +1 -1
- package/dist/bin/run.js +9 -0
- package/dist/bin/run.js.map +1 -1
- package/dist/bin/status.js +1 -1
- package/dist/bin/status.js.map +1 -1
- package/dist/components/Application.d.ts +12 -5
- package/dist/components/Application.js +121 -60
- package/dist/components/Application.js.map +1 -1
- package/dist/components/Scope.d.ts +1 -0
- package/dist/components/Scope.js +4 -0
- package/dist/components/Scope.js.map +1 -1
- package/dist/components/componentLoader.js +7 -0
- package/dist/components/componentLoader.js.map +1 -1
- package/dist/components/operations.js +20 -1
- package/dist/components/operations.js.map +1 -1
- package/dist/config/configUtils.d.ts +31 -0
- package/dist/config/configUtils.js +127 -5
- package/dist/config/configUtils.js.map +1 -1
- package/dist/dataLayer/harperBridge/ResourceBridge.js +8 -0
- package/dist/dataLayer/harperBridge/ResourceBridge.js.map +1 -1
- package/dist/resources/DatabaseTransaction.d.ts +12 -0
- package/dist/resources/DatabaseTransaction.js +97 -0
- package/dist/resources/DatabaseTransaction.js.map +1 -1
- package/dist/resources/RequestTarget.js +13 -3
- package/dist/resources/RequestTarget.js.map +1 -1
- package/dist/resources/Resource.js +21 -2
- package/dist/resources/Resource.js.map +1 -1
- package/dist/resources/Table.d.ts +3 -1
- package/dist/resources/Table.js +48 -5
- package/dist/resources/Table.js.map +1 -1
- package/dist/resources/analytics/metadata.d.ts +3 -0
- package/dist/resources/analytics/metadata.js +3 -0
- package/dist/resources/analytics/metadata.js.map +1 -1
- package/dist/resources/analytics/write.js +22 -0
- package/dist/resources/analytics/write.js.map +1 -1
- package/dist/resources/databases.js +21 -0
- package/dist/resources/databases.js.map +1 -1
- package/dist/resources/defineResource.js +20 -7
- package/dist/resources/defineResource.js.map +1 -1
- package/dist/resources/jsResource.d.ts +24 -0
- package/dist/resources/jsResource.js +58 -2
- package/dist/resources/jsResource.js.map +1 -1
- package/dist/resources/openApi.js +45 -20
- package/dist/resources/openApi.js.map +1 -1
- package/dist/resources/scheduler/CronExpression.d.ts +71 -0
- package/dist/resources/scheduler/CronExpression.js +367 -0
- package/dist/resources/scheduler/CronExpression.js.map +1 -0
- package/dist/resources/scheduler/engine.d.ts +91 -0
- package/dist/resources/scheduler/engine.js +767 -0
- package/dist/resources/scheduler/engine.js.map +1 -0
- package/dist/resources/scheduler/scheduler.d.ts +33 -0
- package/dist/resources/scheduler/scheduler.js +200 -0
- package/dist/resources/scheduler/scheduler.js.map +1 -0
- package/dist/security/auth.js +1 -0
- package/dist/security/auth.js.map +1 -1
- package/dist/security/jsLoader.js +8 -0
- package/dist/security/jsLoader.js.map +1 -1
- package/dist/security/keys.d.ts +32 -0
- package/dist/security/keys.js +147 -0
- package/dist/security/keys.js.map +1 -1
- package/dist/server/REST.js +67 -1
- package/dist/server/REST.js.map +1 -1
- package/dist/server/Server.d.ts +6 -0
- package/dist/server/Server.js.map +1 -1
- package/dist/server/http.d.ts +2 -0
- package/dist/server/http.js +139 -14
- package/dist/server/http.js.map +1 -1
- package/dist/server/operationsServer.js +3 -3
- package/dist/server/operationsServer.js.map +1 -1
- package/dist/server/serverHelpers/progressEmitter.js +5 -1
- package/dist/server/serverHelpers/progressEmitter.js.map +1 -1
- package/dist/server/threads/threadServer.js +9 -5
- package/dist/server/threads/threadServer.js.map +1 -1
- package/dist/sqlEngine/binder/bind.d.ts +72 -0
- package/dist/sqlEngine/binder/bind.js +289 -0
- package/dist/sqlEngine/binder/bind.js.map +1 -0
- package/dist/sqlEngine/config.d.ts +35 -0
- package/dist/sqlEngine/config.js +62 -0
- package/dist/sqlEngine/config.js.map +1 -0
- package/dist/sqlEngine/diff/differential.d.ts +23 -0
- package/dist/sqlEngine/diff/differential.js +90 -0
- package/dist/sqlEngine/diff/differential.js.map +1 -0
- package/dist/sqlEngine/errors.d.ts +22 -0
- package/dist/sqlEngine/errors.js +36 -0
- package/dist/sqlEngine/errors.js.map +1 -0
- package/dist/sqlEngine/executor/runMutation.d.ts +35 -0
- package/dist/sqlEngine/executor/runMutation.js +352 -0
- package/dist/sqlEngine/executor/runMutation.js.map +1 -0
- package/dist/sqlEngine/executor/runSelect.d.ts +7 -0
- package/dist/sqlEngine/executor/runSelect.js +14 -0
- package/dist/sqlEngine/executor/runSelect.js.map +1 -0
- package/dist/sqlEngine/expressions/compile.d.ts +24 -0
- package/dist/sqlEngine/expressions/compile.js +326 -0
- package/dist/sqlEngine/expressions/compile.js.map +1 -0
- package/dist/sqlEngine/functions/aggregates.d.ts +12 -0
- package/dist/sqlEngine/functions/aggregates.js +299 -0
- package/dist/sqlEngine/functions/aggregates.js.map +1 -0
- package/dist/sqlEngine/functions/registry.d.ts +36 -0
- package/dist/sqlEngine/functions/registry.js +33 -0
- package/dist/sqlEngine/functions/registry.js.map +1 -0
- package/dist/sqlEngine/functions/standard.d.ts +9 -0
- package/dist/sqlEngine/functions/standard.js +86 -0
- package/dist/sqlEngine/functions/standard.js.map +1 -0
- package/dist/sqlEngine/index.d.ts +29 -0
- package/dist/sqlEngine/index.js +62 -0
- package/dist/sqlEngine/index.js.map +1 -0
- package/dist/sqlEngine/logical/build.d.ts +20 -0
- package/dist/sqlEngine/logical/build.js +326 -0
- package/dist/sqlEngine/logical/build.js.map +1 -0
- package/dist/sqlEngine/logical/op.d.ts +105 -0
- package/dist/sqlEngine/logical/op.js +10 -0
- package/dist/sqlEngine/logical/op.js.map +1 -0
- package/dist/sqlEngine/optimizer/joinAnalysis.d.ts +37 -0
- package/dist/sqlEngine/optimizer/joinAnalysis.js +144 -0
- package/dist/sqlEngine/optimizer/joinAnalysis.js.map +1 -0
- package/dist/sqlEngine/optimizer/optimize.d.ts +13 -0
- package/dist/sqlEngine/optimizer/optimize.js +53 -0
- package/dist/sqlEngine/optimizer/optimize.js.map +1 -0
- package/dist/sqlEngine/optimizer/ruleEngine.d.ts +7 -0
- package/dist/sqlEngine/optimizer/ruleEngine.js +26 -0
- package/dist/sqlEngine/optimizer/ruleEngine.js.map +1 -0
- package/dist/sqlEngine/optimizer/rules/limitPushdown.d.ts +19 -0
- package/dist/sqlEngine/optimizer/rules/limitPushdown.js +55 -0
- package/dist/sqlEngine/optimizer/rules/limitPushdown.js.map +1 -0
- package/dist/sqlEngine/optimizer/rules/planJoins.d.ts +19 -0
- package/dist/sqlEngine/optimizer/rules/planJoins.js +62 -0
- package/dist/sqlEngine/optimizer/rules/planJoins.js.map +1 -0
- package/dist/sqlEngine/optimizer/rules/predicateNormalize.d.ts +18 -0
- package/dist/sqlEngine/optimizer/rules/predicateNormalize.js +80 -0
- package/dist/sqlEngine/optimizer/rules/predicateNormalize.js.map +1 -0
- package/dist/sqlEngine/optimizer/rules/predicatePushdown.d.ts +11 -0
- package/dist/sqlEngine/optimizer/rules/predicatePushdown.js +48 -0
- package/dist/sqlEngine/optimizer/rules/predicatePushdown.js.map +1 -0
- package/dist/sqlEngine/optimizer/rules/projectionPushdown.d.ts +23 -0
- package/dist/sqlEngine/optimizer/rules/projectionPushdown.js +160 -0
- package/dist/sqlEngine/optimizer/rules/projectionPushdown.js.map +1 -0
- package/dist/sqlEngine/optimizer/rules/sortFromIndex.d.ts +14 -0
- package/dist/sqlEngine/optimizer/rules/sortFromIndex.js +49 -0
- package/dist/sqlEngine/optimizer/rules/sortFromIndex.js.map +1 -0
- package/dist/sqlEngine/optimizer/rules/validateScannable.d.ts +15 -0
- package/dist/sqlEngine/optimizer/rules/validateScannable.js +60 -0
- package/dist/sqlEngine/optimizer/rules/validateScannable.js.map +1 -0
- package/dist/sqlEngine/optimizer/whereToConditions.d.ts +85 -0
- package/dist/sqlEngine/optimizer/whereToConditions.js +484 -0
- package/dist/sqlEngine/optimizer/whereToConditions.js.map +1 -0
- package/dist/sqlEngine/parser/ast.d.ts +139 -0
- package/dist/sqlEngine/parser/ast.js +10 -0
- package/dist/sqlEngine/parser/ast.js.map +1 -0
- package/dist/sqlEngine/parser/normalizer.d.ts +28 -0
- package/dist/sqlEngine/parser/normalizer.js +413 -0
- package/dist/sqlEngine/parser/normalizer.js.map +1 -0
- package/dist/sqlEngine/parser/parse.d.ts +14 -0
- package/dist/sqlEngine/parser/parse.js +20 -0
- package/dist/sqlEngine/parser/parse.js.map +1 -0
- package/dist/sqlEngine/physical/PhysicalDistinct.d.ts +9 -0
- package/dist/sqlEngine/physical/PhysicalDistinct.js +29 -0
- package/dist/sqlEngine/physical/PhysicalDistinct.js.map +1 -0
- package/dist/sqlEngine/physical/PhysicalFilter.d.ts +10 -0
- package/dist/sqlEngine/physical/PhysicalFilter.js +25 -0
- package/dist/sqlEngine/physical/PhysicalFilter.js.map +1 -0
- package/dist/sqlEngine/physical/PhysicalHashAggregate.d.ts +27 -0
- package/dist/sqlEngine/physical/PhysicalHashAggregate.js +100 -0
- package/dist/sqlEngine/physical/PhysicalHashAggregate.js.map +1 -0
- package/dist/sqlEngine/physical/PhysicalHashJoin.d.ts +29 -0
- package/dist/sqlEngine/physical/PhysicalHashJoin.js +93 -0
- package/dist/sqlEngine/physical/PhysicalHashJoin.js.map +1 -0
- package/dist/sqlEngine/physical/PhysicalIndexNestedLoopJoin.d.ts +36 -0
- package/dist/sqlEngine/physical/PhysicalIndexNestedLoopJoin.js +78 -0
- package/dist/sqlEngine/physical/PhysicalIndexNestedLoopJoin.js.map +1 -0
- package/dist/sqlEngine/physical/PhysicalIndexScan.d.ts +22 -0
- package/dist/sqlEngine/physical/PhysicalIndexScan.js +77 -0
- package/dist/sqlEngine/physical/PhysicalIndexScan.js.map +1 -0
- package/dist/sqlEngine/physical/PhysicalLimit.d.ts +5 -0
- package/dist/sqlEngine/physical/PhysicalLimit.js +28 -0
- package/dist/sqlEngine/physical/PhysicalLimit.js.map +1 -0
- package/dist/sqlEngine/physical/PhysicalNestedLoopJoin.d.ts +20 -0
- package/dist/sqlEngine/physical/PhysicalNestedLoopJoin.js +51 -0
- package/dist/sqlEngine/physical/PhysicalNestedLoopJoin.js.map +1 -0
- package/dist/sqlEngine/physical/PhysicalProject.d.ts +18 -0
- package/dist/sqlEngine/physical/PhysicalProject.js +117 -0
- package/dist/sqlEngine/physical/PhysicalProject.js.map +1 -0
- package/dist/sqlEngine/physical/PhysicalQualify.d.ts +13 -0
- package/dist/sqlEngine/physical/PhysicalQualify.js +29 -0
- package/dist/sqlEngine/physical/PhysicalQualify.js.map +1 -0
- package/dist/sqlEngine/physical/PhysicalSort.d.ts +12 -0
- package/dist/sqlEngine/physical/PhysicalSort.js +59 -0
- package/dist/sqlEngine/physical/PhysicalSort.js.map +1 -0
- package/dist/sqlEngine/physical/op.d.ts +11 -0
- package/dist/sqlEngine/physical/op.js +9 -0
- package/dist/sqlEngine/physical/op.js.map +1 -0
- package/dist/sqlEngine/physical/plan.d.ts +23 -0
- package/dist/sqlEngine/physical/plan.js +162 -0
- package/dist/sqlEngine/physical/plan.js.map +1 -0
- package/dist/sqlEngine/router.d.ts +26 -0
- package/dist/sqlEngine/router.js +48 -0
- package/dist/sqlEngine/router.js.map +1 -0
- package/dist/sqlEngine/types.d.ts +37 -0
- package/dist/sqlEngine/types.js +13 -0
- package/dist/sqlEngine/types.js.map +1 -0
- package/dist/sqlTranslator/index.js +7 -1
- package/dist/sqlTranslator/index.js.map +1 -1
- package/dist/utility/common_utils.js +25 -0
- package/dist/utility/common_utils.js.map +1 -1
- package/dist/utility/install/installer.d.ts +9 -1
- package/dist/utility/install/installer.js +21 -0
- package/dist/utility/install/installer.js.map +1 -1
- package/dist/validation/configValidator.js +3 -0
- package/dist/validation/configValidator.js.map +1 -1
- package/dist/validation/deleteValidator.js +10 -2
- package/dist/validation/deleteValidator.js.map +1 -1
- package/npm-shrinkwrap.json +272 -230
- package/package.json +3 -3
- package/resources/DESIGN.md +17 -16
- package/resources/DatabaseTransaction.ts +95 -0
- package/resources/RequestTarget.ts +12 -3
- package/resources/Resource.ts +23 -2
- package/resources/Table.ts +57 -6
- package/resources/analytics/metadata.ts +3 -0
- package/resources/analytics/write.ts +23 -0
- package/resources/databases.ts +24 -0
- package/resources/defineResource.ts +17 -4
- package/resources/jsResource.ts +61 -2
- package/resources/openApi.ts +44 -19
- package/resources/scheduler/CronExpression.ts +394 -0
- package/resources/scheduler/engine.ts +812 -0
- package/resources/scheduler/scheduler.ts +236 -0
- package/security/auth.ts +1 -0
- package/security/jsLoader.ts +8 -0
- package/security/keys.ts +152 -0
- package/server/REST.ts +70 -1
- package/server/Server.ts +6 -0
- package/server/http.ts +122 -15
- package/server/operationsServer.ts +5 -3
- package/server/serverHelpers/progressEmitter.ts +5 -1
- package/server/threads/threadServer.js +9 -5
- package/sqlTranslator/index.ts +16 -6
- package/studio/web/assets/{Chat-CTjtL8Z4.js → Chat-DHP4XpID.js} +2 -2
- package/studio/web/assets/{Chat-CTjtL8Z4.js.map → Chat-DHP4XpID.js.map} +1 -1
- package/studio/web/assets/{FloatingChat-CafHR4Ur.js → FloatingChat-CJ7PssCv.js} +4 -4
- package/studio/web/assets/{FloatingChat-CafHR4Ur.js.map → FloatingChat-CJ7PssCv.js.map} +1 -1
- package/studio/web/assets/{applications-Buh_q0Vj.js → applications-DxXiGpsR.js} +2 -2
- package/studio/web/assets/{applications-Buh_q0Vj.js.map → applications-DxXiGpsR.js.map} +1 -1
- package/studio/web/assets/{index-0hXeECkS.js → index-BdbBanDP.js} +6 -6
- package/studio/web/assets/{index-0hXeECkS.js.map → index-BdbBanDP.js.map} +1 -1
- package/studio/web/assets/{index.lazy-B00B7VBT.js → index.lazy-B2eH28zD.js} +4 -4
- package/studio/web/assets/{index.lazy-B00B7VBT.js.map → index.lazy-B2eH28zD.js.map} +1 -1
- package/studio/web/assets/{profile-Cg2wwYPn.js → profile-DK5hgucv.js} +2 -2
- package/studio/web/assets/{profile-Cg2wwYPn.js.map → profile-DK5hgucv.js.map} +1 -1
- package/studio/web/assets/{setComponentFile-DCaDIvyB.js → setComponentFile-BVDWRYxx.js} +2 -2
- package/studio/web/assets/{setComponentFile-DCaDIvyB.js.map → setComponentFile-BVDWRYxx.js.map} +1 -1
- package/studio/web/assets/{setup-CAVcAQjK.js → setup-DJ9BInoK.js} +2 -2
- package/studio/web/assets/{setup-CAVcAQjK.js.map → setup-DJ9BInoK.js.map} +1 -1
- package/studio/web/assets/{status-BRXorNdD.js → status-B_qzmgfD.js} +2 -2
- package/studio/web/assets/{status-BRXorNdD.js.map → status-B_qzmgfD.js.map} +1 -1
- package/studio/web/assets/{swagger-ui-react-Dy1D62vO.js → swagger-ui-react-DOL5jCqg.js} +2 -2
- package/studio/web/assets/{swagger-ui-react-Dy1D62vO.js.map → swagger-ui-react-DOL5jCqg.js.map} +1 -1
- package/studio/web/assets/{tsMode-A8gbL74v.js → tsMode-DpxUxfTW.js} +2 -2
- package/studio/web/assets/{tsMode-A8gbL74v.js.map → tsMode-DpxUxfTW.js.map} +1 -1
- package/studio/web/assets/{useEntityRestURL-cDodrVcQ.js → useEntityRestURL-CU_lY6XW.js} +2 -2
- package/studio/web/assets/{useEntityRestURL-cDodrVcQ.js.map → useEntityRestURL-CU_lY6XW.js.map} +1 -1
- package/studio/web/index.html +1 -1
- package/utility/common_utils.ts +26 -0
- package/utility/install/installer.ts +26 -1
- package/validation/configValidator.ts +3 -0
- package/validation/deleteValidator.ts +11 -2
|
@@ -0,0 +1,484 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Converts a (normalized) WHERE predicate into a Resource API condition tree
|
|
4
|
+
* plus an optional residual expression that the engine must apply as a
|
|
5
|
+
* post-scan Filter.
|
|
6
|
+
*
|
|
7
|
+
* The Resource API condition shape (see core/resources/search.ts:581):
|
|
8
|
+
* { attribute, value, comparator? }
|
|
9
|
+
* { conditions: Condition[], operator: 'and'|'or' }
|
|
10
|
+
*
|
|
11
|
+
* Comparator names use the canonical forms in
|
|
12
|
+
* core/resources/search.ts:204 (equals, ne, lt, le, gt, ge, between, gele,
|
|
13
|
+
* gelt, gtlt, gtle, starts_with, ends_with, contains).
|
|
14
|
+
*
|
|
15
|
+
* Anything that can't be represented as a condition (e.g., comparing two
|
|
16
|
+
* columns, function calls in WHERE, OR mixed with non-attribute predicates)
|
|
17
|
+
* is left in the residual.
|
|
18
|
+
*/
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.whereToConditions = whereToConditions;
|
|
21
|
+
exports.conditionIsPushable = conditionIsPushable;
|
|
22
|
+
exports.conditionUsesIndex = conditionUsesIndex;
|
|
23
|
+
exports.sortDrivesIndex = sortDrivesIndex;
|
|
24
|
+
const BINARY_TO_COMPARATOR = {
|
|
25
|
+
'=': 'equals',
|
|
26
|
+
'!=': 'ne',
|
|
27
|
+
'<>': 'ne',
|
|
28
|
+
'<': 'lt',
|
|
29
|
+
'<=': 'le',
|
|
30
|
+
'>': 'gt',
|
|
31
|
+
'>=': 'ge',
|
|
32
|
+
};
|
|
33
|
+
// Single-sided range comparators, split by which bound they set, and the fused
|
|
34
|
+
// comparator name that combines a lower + upper bound (matching the set
|
|
35
|
+
// core/resources/search.ts issues a single bounded getRange for).
|
|
36
|
+
const LOWER_COMPARATORS = { ge: 'ge', gt: 'gt' };
|
|
37
|
+
const UPPER_COMPARATORS = { le: 'le', lt: 'lt' };
|
|
38
|
+
function whereToConditions(predicate, attributes) {
|
|
39
|
+
if (!predicate) {
|
|
40
|
+
return { conditions: [], operator: 'and' };
|
|
41
|
+
}
|
|
42
|
+
const conjuncts = flattenAnd(predicate);
|
|
43
|
+
const conditions = [];
|
|
44
|
+
const residuals = [];
|
|
45
|
+
for (const e of conjuncts) {
|
|
46
|
+
const cond = leafToCondition(e);
|
|
47
|
+
// Only push a conjunct into the Resource API condition tree when every
|
|
48
|
+
// attribute it references is indexed: Table.search runs searchByIndex on
|
|
49
|
+
// each condition and throws "…is not indexed" for an unindexed attribute.
|
|
50
|
+
// A full-scan comparator (e.g. LIKE→contains) on an *indexed* attribute is
|
|
51
|
+
// still pushable — search applies it as a filter once another condition
|
|
52
|
+
// drives the index (validateScannable enforces that a driver exists). When
|
|
53
|
+
// `attributes` is unknown, keep the legacy behavior of pushing any
|
|
54
|
+
// representable condition.
|
|
55
|
+
if (cond && (attributes === undefined || conditionIsPushable(cond, attributes))) {
|
|
56
|
+
conditions.push(cond);
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
// A `!=`/NOT IN conjunct whose only unpushable leg is its not-null guard
|
|
60
|
+
// (search rejects null-valued conditions on an index without indexNulls,
|
|
61
|
+
// F-145): keep the value legs pushed — they carry the quoted-boolean/
|
|
62
|
+
// numeric coercion branches the expression evaluator doesn't replicate —
|
|
63
|
+
// and re-express just the guard as a residual IS NOT NULL filter.
|
|
64
|
+
const split = cond && splitUnpushableNullGuards(cond, attributes);
|
|
65
|
+
if (split) {
|
|
66
|
+
if (split.pushable)
|
|
67
|
+
conditions.push(split.pushable);
|
|
68
|
+
residuals.push(...split.guards);
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
residuals.push(e);
|
|
72
|
+
}
|
|
73
|
+
const result = { conditions: fuseRangeBounds(conditions, attributes), operator: 'and' };
|
|
74
|
+
if (residuals.length > 0) {
|
|
75
|
+
result.residual = residuals.length === 1 ? residuals[0] : { kind: 'logical', op: 'and', args: residuals };
|
|
76
|
+
}
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* If a condition is unpushable ONLY because it contains null-valued legs on
|
|
81
|
+
* attributes whose index can't serve nulls (the `!=`/NOT IN not-null guard, or
|
|
82
|
+
* an IS [NOT] NULL leg), split it: return the remaining pushable legs plus the
|
|
83
|
+
* null legs re-expressed as residual isNull ExprNodes (evaluated post-scan with
|
|
84
|
+
* correct three-valued logic). Returns undefined when the condition is
|
|
85
|
+
* unpushable for any other reason (caller residualizes the whole conjunct) or
|
|
86
|
+
* when nothing needed splitting.
|
|
87
|
+
*/
|
|
88
|
+
function splitUnpushableNullGuards(cond, attributes) {
|
|
89
|
+
if ('attribute' in cond && cond.attribute) {
|
|
90
|
+
if (cond.value !== null)
|
|
91
|
+
return undefined; // unpushable for a non-null-guard reason
|
|
92
|
+
const a = attributes?.find((x) => x.name === cond.attribute);
|
|
93
|
+
if (a?.indexed !== true || a.indexNulls)
|
|
94
|
+
return undefined; // not the indexNulls case
|
|
95
|
+
if (cond.comparator !== 'ne' && cond.comparator !== 'equals')
|
|
96
|
+
return undefined;
|
|
97
|
+
const guard = {
|
|
98
|
+
kind: 'isNull',
|
|
99
|
+
negated: cond.comparator === 'ne',
|
|
100
|
+
expr: { kind: 'column', name: cond.attribute },
|
|
101
|
+
};
|
|
102
|
+
return { guards: [guard] };
|
|
103
|
+
}
|
|
104
|
+
if ('conditions' in cond && cond.operator === 'and') {
|
|
105
|
+
// Salvage AND legs only: an OR containing an unservable null leg can't be
|
|
106
|
+
// split into pushed-conditions + residual (the residual would over-filter).
|
|
107
|
+
const pushable = [];
|
|
108
|
+
const guards = [];
|
|
109
|
+
for (const c of cond.conditions) {
|
|
110
|
+
if (conditionIsPushable(c, attributes)) {
|
|
111
|
+
pushable.push(c);
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
const sub = splitUnpushableNullGuards(c, attributes);
|
|
115
|
+
if (!sub)
|
|
116
|
+
return undefined;
|
|
117
|
+
if (sub.pushable)
|
|
118
|
+
pushable.push(sub.pushable);
|
|
119
|
+
guards.push(...sub.guards);
|
|
120
|
+
}
|
|
121
|
+
if (guards.length === 0)
|
|
122
|
+
return undefined;
|
|
123
|
+
if (pushable.length === 0)
|
|
124
|
+
return { guards };
|
|
125
|
+
return {
|
|
126
|
+
pushable: pushable.length === 1 ? pushable[0] : { conditions: pushable, operator: 'and' },
|
|
127
|
+
guards,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
return undefined;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Comparators that force a full scan even on an indexed attribute, because they
|
|
134
|
+
* can't seek/range a B-tree index (suffix/substring match). These mirror
|
|
135
|
+
* `core/resources/search.ts`'s `needFullScan` set. `ne` against a non-null value
|
|
136
|
+
* is the same (an inequality can't seek); `ne null` (IS NOT NULL) is a range and
|
|
137
|
+
* stays index-servable.
|
|
138
|
+
*/
|
|
139
|
+
const FULL_SCAN_COMPARATORS = new Set(['ends_with', 'contains']);
|
|
140
|
+
/**
|
|
141
|
+
* Whether a condition can be pushed into Table.search at all: every attribute it
|
|
142
|
+
* references must be indexed, because search runs searchByIndex per condition and
|
|
143
|
+
* throws on an unindexed attribute. Comparator-agnostic — a full-scan comparator
|
|
144
|
+
* on an indexed attribute is still pushable (it becomes a filter once another
|
|
145
|
+
* condition drives the index). Null-valued conditions (IS [NOT] NULL and the
|
|
146
|
+
* `!=`/NOT IN not-null guards) are pushable only when the index actually indexes
|
|
147
|
+
* nulls — search throws "not indexed for nulls" otherwise (F-145), even when a
|
|
148
|
+
* different condition drives the scan. Unpushable conditions become a residual
|
|
149
|
+
* Filter (the expression evaluator's three-valued logic keeps NULL exclusion
|
|
150
|
+
* correct on the residual path).
|
|
151
|
+
*/
|
|
152
|
+
function conditionIsPushable(cond, attributes) {
|
|
153
|
+
if ('attribute' in cond && cond.attribute) {
|
|
154
|
+
const a = attributes?.find((x) => x.name === cond.attribute);
|
|
155
|
+
if (a?.indexed !== true)
|
|
156
|
+
return false;
|
|
157
|
+
if (cond.value === null && !a.indexNulls)
|
|
158
|
+
return false;
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
161
|
+
if ('conditions' in cond) {
|
|
162
|
+
// Every leaf attribute must be indexed; a single unindexed leaf (in either
|
|
163
|
+
// an AND or an OR) would make search throw when it evaluates that condition.
|
|
164
|
+
return cond.conditions.every((c) => conditionIsPushable(c, attributes));
|
|
165
|
+
}
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Whether a condition can *drive* an index scan (seek/range), and therefore make
|
|
170
|
+
* the scan valid without a full-table traversal. Stricter than pushability:
|
|
171
|
+
* excludes full-scan comparators and unseekable inequalities. Shared with the R8
|
|
172
|
+
* validateScannable rule so scannability and pushdown decisions can't drift.
|
|
173
|
+
*/
|
|
174
|
+
function conditionUsesIndex(cond, attributes) {
|
|
175
|
+
if ('attribute' in cond && cond.attribute) {
|
|
176
|
+
const a = attributes?.find((x) => x.name === cond.attribute);
|
|
177
|
+
if (!a?.indexed)
|
|
178
|
+
return false;
|
|
179
|
+
if (FULL_SCAN_COMPARATORS.has(cond.comparator ?? ''))
|
|
180
|
+
return false;
|
|
181
|
+
if (cond.comparator === 'ne' && cond.value !== null)
|
|
182
|
+
return false;
|
|
183
|
+
// A null-valued condition can only seek an index that indexes nulls.
|
|
184
|
+
if (cond.value === null && !a.indexNulls)
|
|
185
|
+
return false;
|
|
186
|
+
return true;
|
|
187
|
+
}
|
|
188
|
+
if ('conditions' in cond) {
|
|
189
|
+
// AND: at least one indexable child suffices.
|
|
190
|
+
// OR: every child must be indexable; otherwise the union requires a full scan.
|
|
191
|
+
if (cond.operator === 'and')
|
|
192
|
+
return cond.conditions.some((c) => conditionUsesIndex(c, attributes));
|
|
193
|
+
if (cond.operator === 'or')
|
|
194
|
+
return cond.conditions.every((c) => conditionUsesIndex(c, attributes));
|
|
195
|
+
}
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Whether a pushed sort can itself drive an index-ordered scan: its primary key
|
|
200
|
+
* is a single column on the table's PRIMARY KEY. Table.search aligns such a sort
|
|
201
|
+
* to the index's natural order (resources/Table.ts — it adds a `comparator:
|
|
202
|
+
* 'sort'` condition), so the rows stream from the index already ordered and a
|
|
203
|
+
* pushed LIMIT early-terminates (O(window)) — no separate in-memory sort. Shared
|
|
204
|
+
* by the R8 validateScannable rule and the physical scan builder so scannability
|
|
205
|
+
* and the `allowFullScan` flag can't drift. NOTE: because Table.search flags the
|
|
206
|
+
* sort scan as `needFullScan`, the physical scan must pass `allowFullScan: true`
|
|
207
|
+
* for it — see physicalIndexScan.
|
|
208
|
+
*
|
|
209
|
+
* Restricted to the PRIMARY KEY, because only there does index order provably
|
|
210
|
+
* equal legacy's full-scan-then-stable-sort order. A non-PK secondary index
|
|
211
|
+
* diverges from legacy in two ways (D-219): (1) a DESC sort reverses the whole
|
|
212
|
+
* composite `[value, primaryKey]` entry, so rows tying on `value` come back in
|
|
213
|
+
* primary-key-DESC order, whereas legacy's stable sort preserves primary-key-ASC
|
|
214
|
+
* order for ties; and (2) the secondary index omits rows whose sort attribute is
|
|
215
|
+
* null (they were never indexed), whereas a legacy full scan includes them. The
|
|
216
|
+
* PK is unique (no ties) and always present (no null keys), so its ordered scan
|
|
217
|
+
* matches legacy in both directions. Secondary-index sort streaming can be a
|
|
218
|
+
* follow-up once those two divergences are handled.
|
|
219
|
+
*/
|
|
220
|
+
function sortDrivesIndex(pushedSort, attributes) {
|
|
221
|
+
const key = pushedSort?.[0];
|
|
222
|
+
if (!key || key.expr.kind !== 'column')
|
|
223
|
+
return false;
|
|
224
|
+
const attr = attributes?.find((x) => x.name === key.expr.name);
|
|
225
|
+
return attr?.indexed === true && attr.isPrimaryKey === true;
|
|
226
|
+
}
|
|
227
|
+
function flattenAnd(expr) {
|
|
228
|
+
if (expr.kind === 'logical' && expr.op === 'and') {
|
|
229
|
+
const out = [];
|
|
230
|
+
for (const a of expr.args)
|
|
231
|
+
out.push(...flattenAnd(a));
|
|
232
|
+
return out;
|
|
233
|
+
}
|
|
234
|
+
return [expr];
|
|
235
|
+
}
|
|
236
|
+
/** True for a single-sided range leaf (`col >= a`, `col < b`, …) on the given attribute. */
|
|
237
|
+
function isRangeLeafOn(cond, attribute) {
|
|
238
|
+
if ('conditions' in cond)
|
|
239
|
+
return false;
|
|
240
|
+
const comparator = cond.comparator;
|
|
241
|
+
return (cond.attribute === attribute &&
|
|
242
|
+
comparator != null &&
|
|
243
|
+
(LOWER_COMPARATORS[comparator] != null || UPPER_COMPARATORS[comparator] != null));
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Fuse a two-sided PRIMARY-KEY range written as separate conjuncts
|
|
247
|
+
* (`id >= a AND id < b`) into a single bounded comparator (gele/gelt/gtlt/gtle)
|
|
248
|
+
* so the storage layer issues one range-seek instead of an unbounded scan from
|
|
249
|
+
* one bound filtered by the other (#1822). Without this, a leading `ge` streams
|
|
250
|
+
* from `a` to the end of the table and filters `< b` in memory — O(table), not
|
|
251
|
+
* O(window). (A SQL `BETWEEN` already maps directly to a single `between`
|
|
252
|
+
* condition upstream, so it never needed fusing.)
|
|
253
|
+
*
|
|
254
|
+
* Deliberately limited to the primary key. The PK is always typed, so
|
|
255
|
+
* Table.search's prepareConditions coerces the fused bounds to the key type and
|
|
256
|
+
* the single seek's start/end always match stored-key ordering. A non-PK indexed
|
|
257
|
+
* attribute may be UNTYPED (e.g. system `hdb_job.start_datetime`): coercion is
|
|
258
|
+
* skipped, so a string literal against numeric storage would make the fused seek
|
|
259
|
+
* return nothing. The two-condition path tolerates that mismatch via its
|
|
260
|
+
* in-memory filter (JS type-juggling), so we leave non-PK ranges unfused.
|
|
261
|
+
*
|
|
262
|
+
* Only the unambiguous case is fused: exactly one lower bound (ge/gt) and one
|
|
263
|
+
* upper bound (le/lt) on the PK within this AND group. Extra bounds (rare, e.g.
|
|
264
|
+
* `id > 1 AND id > 5`) are left untouched — still correct, just not fused.
|
|
265
|
+
*/
|
|
266
|
+
function fuseRangeBounds(conditions, attributes) {
|
|
267
|
+
const pk = attributes?.find((a) => a.isPrimaryKey)?.name;
|
|
268
|
+
if (pk == null)
|
|
269
|
+
return conditions;
|
|
270
|
+
let lower;
|
|
271
|
+
let upper;
|
|
272
|
+
let lowerCount = 0;
|
|
273
|
+
let upperCount = 0;
|
|
274
|
+
for (const cond of conditions) {
|
|
275
|
+
if (!isRangeLeafOn(cond, pk))
|
|
276
|
+
continue;
|
|
277
|
+
if (LOWER_COMPARATORS[cond.comparator]) {
|
|
278
|
+
lower = cond;
|
|
279
|
+
lowerCount++;
|
|
280
|
+
}
|
|
281
|
+
else {
|
|
282
|
+
upper = cond;
|
|
283
|
+
upperCount++;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
if (lowerCount !== 1 || upperCount !== 1)
|
|
287
|
+
return conditions;
|
|
288
|
+
const fusedComparator = LOWER_COMPARATORS[lower.comparator] + UPPER_COMPARATORS[upper.comparator];
|
|
289
|
+
const fused = [];
|
|
290
|
+
for (const cond of conditions) {
|
|
291
|
+
if (cond === upper)
|
|
292
|
+
continue; // merged into the lower bound's slot
|
|
293
|
+
if (cond === lower) {
|
|
294
|
+
fused.push({ attribute: pk, comparator: fusedComparator, value: [lower.value, upper.value] });
|
|
295
|
+
continue;
|
|
296
|
+
}
|
|
297
|
+
fused.push(cond);
|
|
298
|
+
}
|
|
299
|
+
return fused;
|
|
300
|
+
}
|
|
301
|
+
function leafToCondition(expr) {
|
|
302
|
+
switch (expr.kind) {
|
|
303
|
+
case 'binop': {
|
|
304
|
+
const comparator = BINARY_TO_COMPARATOR[expr.op];
|
|
305
|
+
if (!comparator)
|
|
306
|
+
return undefined;
|
|
307
|
+
const colLit = pickColumnAndLiteral(expr.left, expr.right);
|
|
308
|
+
if (!colLit)
|
|
309
|
+
return undefined;
|
|
310
|
+
const attribute = colLit.column;
|
|
311
|
+
// `=` matches either form (OR); `!=` must NOT match either form, and (SQL
|
|
312
|
+
// three-valued logic / legacy AlaSQL) must also exclude NULLs, so it's an
|
|
313
|
+
// AND that includes an explicit not-null guard.
|
|
314
|
+
if (comparator === 'ne' && colLit.value !== null) {
|
|
315
|
+
const conditions = equalityBranches(attribute, colLit.value, 'ne');
|
|
316
|
+
// `col != X` is UNKNOWN (not true) for a NULL col, so NULL rows are
|
|
317
|
+
// excluded — match legacy by AND-ing an `IS NOT NULL` guard.
|
|
318
|
+
conditions.push({ attribute, comparator: 'ne', value: null });
|
|
319
|
+
return { conditions, operator: 'and' };
|
|
320
|
+
}
|
|
321
|
+
if (comparator === 'equals') {
|
|
322
|
+
const branches = equalityBranches(attribute, colLit.value, 'equals');
|
|
323
|
+
if (branches.length > 1)
|
|
324
|
+
return { conditions: branches, operator: 'or' };
|
|
325
|
+
}
|
|
326
|
+
return { attribute, comparator, value: colLit.value };
|
|
327
|
+
}
|
|
328
|
+
case 'in': {
|
|
329
|
+
if (expr.expr.kind !== 'column')
|
|
330
|
+
return undefined;
|
|
331
|
+
if (!Array.isArray(expr.list))
|
|
332
|
+
return undefined;
|
|
333
|
+
const attribute = expr.expr.name;
|
|
334
|
+
const variants = [];
|
|
335
|
+
const seen = new Set();
|
|
336
|
+
for (const item of expr.list) {
|
|
337
|
+
if (item.kind !== 'literal')
|
|
338
|
+
return undefined;
|
|
339
|
+
// Legacy AlaSQL evaluates IN with loose (`==`) membership, so a quoted
|
|
340
|
+
// numeric (`id IN ('5')`) matches a numeric value (and vice versa).
|
|
341
|
+
// Single `=` is NOT loose in legacy, so this coercion is IN-only.
|
|
342
|
+
// Expanding to both forms keeps each branch an indexed equality lookup.
|
|
343
|
+
for (const variant of looseEqualVariants(item.value)) {
|
|
344
|
+
if (!seen.has(variant)) {
|
|
345
|
+
seen.add(variant);
|
|
346
|
+
variants.push(variant);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
const conditions = variants.map((v) => ({
|
|
351
|
+
attribute,
|
|
352
|
+
comparator: expr.negated ? 'ne' : 'equals',
|
|
353
|
+
value: v,
|
|
354
|
+
}));
|
|
355
|
+
if (expr.negated) {
|
|
356
|
+
// `col NOT IN (a, b)` is `col != a AND col != b AND col IS NOT NULL`:
|
|
357
|
+
// a NULL col yields UNKNOWN (excluded), matching legacy AlaSQL 3VL.
|
|
358
|
+
// Mirror the `!=` path's explicit not-null guard (without it, a NULL
|
|
359
|
+
// row is returned by the new engine but dropped by legacy — a silent
|
|
360
|
+
// divergence when the NOT IN is ANDed with another indexed conjunct).
|
|
361
|
+
conditions.push({ attribute, comparator: 'ne', value: null });
|
|
362
|
+
}
|
|
363
|
+
return { conditions, operator: expr.negated ? 'and' : 'or' };
|
|
364
|
+
}
|
|
365
|
+
case 'between': {
|
|
366
|
+
if (expr.expr.kind !== 'column')
|
|
367
|
+
return undefined;
|
|
368
|
+
if (expr.low.kind !== 'literal' || expr.high.kind !== 'literal')
|
|
369
|
+
return undefined;
|
|
370
|
+
if (expr.negated)
|
|
371
|
+
return undefined;
|
|
372
|
+
return {
|
|
373
|
+
attribute: expr.expr.name,
|
|
374
|
+
comparator: 'between',
|
|
375
|
+
value: [expr.low.value, expr.high.value],
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
case 'like': {
|
|
379
|
+
if (expr.expr.kind !== 'column')
|
|
380
|
+
return undefined;
|
|
381
|
+
if (expr.pattern.kind !== 'literal' || typeof expr.pattern.value !== 'string')
|
|
382
|
+
return undefined;
|
|
383
|
+
if (expr.negated)
|
|
384
|
+
return undefined;
|
|
385
|
+
const pattern = expr.pattern.value;
|
|
386
|
+
const startsPct = pattern.startsWith('%');
|
|
387
|
+
const endsPct = pattern.endsWith('%');
|
|
388
|
+
const middle = pattern.slice(startsPct ? 1 : 0, endsPct ? pattern.length - 1 : undefined);
|
|
389
|
+
if (middle.includes('%') || middle.includes('_'))
|
|
390
|
+
return undefined;
|
|
391
|
+
if (startsPct && endsPct) {
|
|
392
|
+
return { attribute: expr.expr.name, comparator: 'contains', value: middle };
|
|
393
|
+
}
|
|
394
|
+
if (startsPct) {
|
|
395
|
+
return { attribute: expr.expr.name, comparator: 'ends_with', value: middle };
|
|
396
|
+
}
|
|
397
|
+
if (endsPct) {
|
|
398
|
+
return { attribute: expr.expr.name, comparator: 'starts_with', value: middle };
|
|
399
|
+
}
|
|
400
|
+
return { attribute: expr.expr.name, comparator: 'equals', value: middle };
|
|
401
|
+
}
|
|
402
|
+
case 'isNull': {
|
|
403
|
+
if (expr.expr.kind !== 'column')
|
|
404
|
+
return undefined;
|
|
405
|
+
return {
|
|
406
|
+
attribute: expr.expr.name,
|
|
407
|
+
comparator: expr.negated ? 'ne' : 'equals',
|
|
408
|
+
value: null,
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
case 'logical': {
|
|
412
|
+
if (expr.op !== 'or')
|
|
413
|
+
return undefined;
|
|
414
|
+
const sub = [];
|
|
415
|
+
for (const a of expr.args) {
|
|
416
|
+
const c = leafToCondition(a);
|
|
417
|
+
if (!c)
|
|
418
|
+
return undefined;
|
|
419
|
+
sub.push(c);
|
|
420
|
+
}
|
|
421
|
+
return { conditions: sub, operator: 'or' };
|
|
422
|
+
}
|
|
423
|
+
default:
|
|
424
|
+
return undefined;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
function pickColumnAndLiteral(a, b) {
|
|
428
|
+
if (a.kind === 'column' && b.kind === 'literal')
|
|
429
|
+
return { column: a.name, value: b.value };
|
|
430
|
+
if (b.kind === 'column' && a.kind === 'literal')
|
|
431
|
+
return { column: b.name, value: a.value };
|
|
432
|
+
return undefined;
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* Values an IN literal should match under legacy AlaSQL's loose (`==`) IN
|
|
436
|
+
* semantics: a numeric string also matches the equivalent number and vice versa
|
|
437
|
+
* (so `id IN ('5')` finds a numeric 5). Returns the original value plus any
|
|
438
|
+
* cross-type form; each becomes its own indexed equality branch. The exact
|
|
439
|
+
* round-trip guard (`String(Number(v)) === v`) avoids spurious variants for
|
|
440
|
+
* non-canonical strings like '05' or '5px'.
|
|
441
|
+
*/
|
|
442
|
+
function looseEqualVariants(value) {
|
|
443
|
+
if (typeof value === 'string') {
|
|
444
|
+
if (value.trim() !== '' && String(Number(value)) === value)
|
|
445
|
+
return [value, Number(value)];
|
|
446
|
+
return [value];
|
|
447
|
+
}
|
|
448
|
+
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
449
|
+
return [value, String(value)];
|
|
450
|
+
}
|
|
451
|
+
return [value];
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* The boolean a quoted boolean literal should also match under legacy coercion:
|
|
455
|
+
* `'true'`/`'false'` (case-insensitive, trimmed) → the corresponding boolean.
|
|
456
|
+
* Returns `undefined` for anything else (including actual booleans, which need no
|
|
457
|
+
* expansion). Used for single `=`/`!=` only.
|
|
458
|
+
*/
|
|
459
|
+
function booleanVariant(value) {
|
|
460
|
+
if (typeof value !== 'string')
|
|
461
|
+
return undefined;
|
|
462
|
+
const v = value.trim().toLowerCase();
|
|
463
|
+
if (v === 'true')
|
|
464
|
+
return true;
|
|
465
|
+
if (v === 'false')
|
|
466
|
+
return false;
|
|
467
|
+
return undefined;
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Equality/inequality branches for `col = X` / `col != X`, expanding a quoted
|
|
471
|
+
* boolean literal to also cover the real boolean (legacy AlaSQL coercion). Each
|
|
472
|
+
* branch stays an indexed equality lookup. The string branch is kept so a genuine
|
|
473
|
+
* string column still matches; the boolean branch is added only when the literal
|
|
474
|
+
* is `'true'`/`'false'`. (Numeric strings are NOT expanded for single `=`/`!=` —
|
|
475
|
+
* legacy keeps those strict — so this is boolean-only, unlike the IN path.)
|
|
476
|
+
*/
|
|
477
|
+
function equalityBranches(attribute, value, comparator) {
|
|
478
|
+
const branches = [{ attribute, comparator, value }];
|
|
479
|
+
const boolValue = booleanVariant(value);
|
|
480
|
+
if (boolValue !== undefined)
|
|
481
|
+
branches.push({ attribute, comparator, value: boolValue });
|
|
482
|
+
return branches;
|
|
483
|
+
}
|
|
484
|
+
//# sourceMappingURL=whereToConditions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whereToConditions.js","sourceRoot":"","sources":["../../../sqlEngine/optimizer/whereTo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C;QACzD,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,CAAC,KAAK,CAAC,CAAC;AAChB,CAAC;AAED;;;;;GAKG;AACH,SAAS,cAAc,CAAC,KAAc;IACrC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IAChD,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACrC,IAAI,CAAC,KAAK,MAAM;QAAE,OAAO,IAAI,CAAC;IAC9B,IAAI,CAAC,KAAK,OAAO;QAAE,OAAO,KAAK,CAAC;IAChC,OAAO,SAAS,CAAC;AAClB,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,gBAAgB,CAAC,SAAiB,EAAE,KAAc,EAAE,UAA2B;IACvF,MAAM,QAAQ,GAAsB,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;IACvE,MAAM,SAAS,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;IACxC,IAAI,SAAS,KAAK,SAAS;QAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IACxF,OAAO,QAAQ,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal SQL AST (IR).
|
|
3
|
+
*
|
|
4
|
+
* This is the boundary at which AlaSQL types die. The parser/normalizer.ts
|
|
5
|
+
* walks an `alasql.yy.*` tree and produces these plain objects. Nothing
|
|
6
|
+
* downstream imports from `alasql`.
|
|
7
|
+
*/
|
|
8
|
+
import type { SqlType } from '../types.ts';
|
|
9
|
+
export type StatementNode = SelectNode | InsertNode | UpdateNode | DeleteNode;
|
|
10
|
+
export interface SelectNode {
|
|
11
|
+
kind: 'select';
|
|
12
|
+
distinct: boolean;
|
|
13
|
+
projections: ProjectionNode[];
|
|
14
|
+
from: TableRefNode;
|
|
15
|
+
joins: JoinNode[];
|
|
16
|
+
where?: ExprNode;
|
|
17
|
+
groupBy?: ExprNode[];
|
|
18
|
+
having?: ExprNode;
|
|
19
|
+
orderBy?: SortNode[];
|
|
20
|
+
limit?: number;
|
|
21
|
+
offset?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface InsertNode {
|
|
24
|
+
kind: 'insert';
|
|
25
|
+
table: TableRefNode;
|
|
26
|
+
columns: string[];
|
|
27
|
+
values: ExprNode[][] | SelectNode;
|
|
28
|
+
}
|
|
29
|
+
export interface UpdateNode {
|
|
30
|
+
kind: 'update';
|
|
31
|
+
table: TableRefNode;
|
|
32
|
+
assignments: {
|
|
33
|
+
column: string;
|
|
34
|
+
expr: ExprNode;
|
|
35
|
+
}[];
|
|
36
|
+
where?: ExprNode;
|
|
37
|
+
}
|
|
38
|
+
export interface DeleteNode {
|
|
39
|
+
kind: 'delete';
|
|
40
|
+
table: TableRefNode;
|
|
41
|
+
where?: ExprNode;
|
|
42
|
+
}
|
|
43
|
+
export interface TableRefNode {
|
|
44
|
+
database: string;
|
|
45
|
+
table: string;
|
|
46
|
+
alias?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface JoinNode {
|
|
49
|
+
type: 'inner' | 'left' | 'right' | 'full' | 'cross';
|
|
50
|
+
table: TableRefNode;
|
|
51
|
+
on?: ExprNode;
|
|
52
|
+
using?: string[];
|
|
53
|
+
}
|
|
54
|
+
export interface ProjectionNode {
|
|
55
|
+
expr: ExprNode;
|
|
56
|
+
alias?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Default output-column label when no `alias` is given, computed from the
|
|
59
|
+
* original (pre-aggregate-rewrite) expression to match the legacy AlaSQL
|
|
60
|
+
* column name (e.g. `COUNT(*)`, `SUM(price)`). Without it, an unaliased
|
|
61
|
+
* aggregate would surface under the engine's internal `__agg_N__` name.
|
|
62
|
+
*/
|
|
63
|
+
label?: string;
|
|
64
|
+
}
|
|
65
|
+
export interface SortNode {
|
|
66
|
+
expr: ExprNode;
|
|
67
|
+
descending: boolean;
|
|
68
|
+
nullsFirst?: boolean;
|
|
69
|
+
}
|
|
70
|
+
export type BinaryOp = '=' | '!=' | '<>' | '<' | '<=' | '>' | '>=' | '+' | '-' | '*' | '/' | '%' | '||';
|
|
71
|
+
export type ExprNode = {
|
|
72
|
+
kind: 'column';
|
|
73
|
+
table?: string;
|
|
74
|
+
name: string;
|
|
75
|
+
} | {
|
|
76
|
+
kind: 'literal';
|
|
77
|
+
value: unknown;
|
|
78
|
+
sqlType: SqlType;
|
|
79
|
+
} | {
|
|
80
|
+
kind: 'binop';
|
|
81
|
+
op: BinaryOp;
|
|
82
|
+
left: ExprNode;
|
|
83
|
+
right: ExprNode;
|
|
84
|
+
} | {
|
|
85
|
+
kind: 'logical';
|
|
86
|
+
op: 'and' | 'or' | 'not';
|
|
87
|
+
args: ExprNode[];
|
|
88
|
+
} | {
|
|
89
|
+
kind: 'in';
|
|
90
|
+
expr: ExprNode;
|
|
91
|
+
list: ExprNode[] | SelectNode;
|
|
92
|
+
negated: boolean;
|
|
93
|
+
} | {
|
|
94
|
+
kind: 'between';
|
|
95
|
+
expr: ExprNode;
|
|
96
|
+
low: ExprNode;
|
|
97
|
+
high: ExprNode;
|
|
98
|
+
negated: boolean;
|
|
99
|
+
} | {
|
|
100
|
+
kind: 'like';
|
|
101
|
+
expr: ExprNode;
|
|
102
|
+
pattern: ExprNode;
|
|
103
|
+
escape?: ExprNode;
|
|
104
|
+
negated: boolean;
|
|
105
|
+
} | {
|
|
106
|
+
kind: 'isNull';
|
|
107
|
+
expr: ExprNode;
|
|
108
|
+
negated: boolean;
|
|
109
|
+
} | {
|
|
110
|
+
kind: 'case';
|
|
111
|
+
cases: {
|
|
112
|
+
when: ExprNode;
|
|
113
|
+
then: ExprNode;
|
|
114
|
+
}[];
|
|
115
|
+
else?: ExprNode;
|
|
116
|
+
} | {
|
|
117
|
+
kind: 'funcCall';
|
|
118
|
+
name: string;
|
|
119
|
+
args: ExprNode[];
|
|
120
|
+
distinct?: boolean;
|
|
121
|
+
} | {
|
|
122
|
+
kind: 'aggCall';
|
|
123
|
+
name: string;
|
|
124
|
+
arg: ExprNode | {
|
|
125
|
+
kind: 'star';
|
|
126
|
+
};
|
|
127
|
+
distinct?: boolean;
|
|
128
|
+
} | {
|
|
129
|
+
kind: 'cast';
|
|
130
|
+
expr: ExprNode;
|
|
131
|
+
targetType: SqlType;
|
|
132
|
+
} | {
|
|
133
|
+
kind: 'star';
|
|
134
|
+
table?: string;
|
|
135
|
+
} | {
|
|
136
|
+
kind: 'subquery';
|
|
137
|
+
query: SelectNode;
|
|
138
|
+
correlated: boolean;
|
|
139
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Internal SQL AST (IR).
|
|
4
|
+
*
|
|
5
|
+
* This is the boundary at which AlaSQL types die. The parser/normalizer.ts
|
|
6
|
+
* walks an `alasql.yy.*` tree and produces these plain objects. Nothing
|
|
7
|
+
* downstream imports from `alasql`.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
//# sourceMappingURL=ast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ast.js","sourceRoot":"","sources":["../../../sqlEngine/parser/ast.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG"}
|