@quereus/quereus 4.4.0 → 4.5.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/README.md +6 -1
- package/dist/src/common/types.d.ts +9 -0
- package/dist/src/common/types.d.ts.map +1 -1
- package/dist/src/common/types.js.map +1 -1
- package/dist/src/core/database-events.d.ts +49 -0
- package/dist/src/core/database-events.d.ts.map +1 -1
- package/dist/src/core/database-events.js +148 -0
- package/dist/src/core/database-events.js.map +1 -1
- package/dist/src/core/database-materialized-views-analysis.d.ts.map +1 -1
- package/dist/src/core/database-materialized-views-analysis.js +1 -0
- package/dist/src/core/database-materialized-views-analysis.js.map +1 -1
- package/dist/src/core/database-materialized-views-plan-builders.d.ts +2 -1
- package/dist/src/core/database-materialized-views-plan-builders.d.ts.map +1 -1
- package/dist/src/core/database-materialized-views-plan-builders.js +26 -5
- package/dist/src/core/database-materialized-views-plan-builders.js.map +1 -1
- package/dist/src/core/database-materialized-views-plans.d.ts +6 -3
- package/dist/src/core/database-materialized-views-plans.d.ts.map +1 -1
- package/dist/src/core/database-materialized-views.d.ts +3 -2
- package/dist/src/core/database-materialized-views.d.ts.map +1 -1
- package/dist/src/core/database-materialized-views.js +26 -5
- package/dist/src/core/database-materialized-views.js.map +1 -1
- package/dist/src/core/database.d.ts +5 -0
- package/dist/src/core/database.d.ts.map +1 -1
- package/dist/src/core/database.js +21 -1
- package/dist/src/core/database.js.map +1 -1
- package/dist/src/core/internal-statement-cache.d.ts +18 -0
- package/dist/src/core/internal-statement-cache.d.ts.map +1 -0
- package/dist/src/core/internal-statement-cache.js +211 -0
- package/dist/src/core/internal-statement-cache.js.map +1 -0
- package/dist/src/func/builtins/aggregate.d.ts +13 -12
- package/dist/src/func/builtins/aggregate.d.ts.map +1 -1
- package/dist/src/func/builtins/aggregate.js +45 -67
- package/dist/src/func/builtins/aggregate.js.map +1 -1
- package/dist/src/func/builtins/builtin-window-functions.d.ts.map +1 -1
- package/dist/src/func/builtins/builtin-window-functions.js +63 -48
- package/dist/src/func/builtins/builtin-window-functions.js.map +1 -1
- package/dist/src/func/builtins/scalar.d.ts.map +1 -1
- package/dist/src/func/builtins/scalar.js +92 -3
- package/dist/src/func/builtins/scalar.js.map +1 -1
- package/dist/src/func/registration.d.ts +18 -1
- package/dist/src/func/registration.d.ts.map +1 -1
- package/dist/src/func/registration.js +26 -0
- package/dist/src/func/registration.js.map +1 -1
- package/dist/src/index.d.ts +10 -10
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +13 -12
- package/dist/src/index.js.map +1 -1
- package/dist/src/parser/parser.d.ts +6 -0
- package/dist/src/parser/parser.d.ts.map +1 -1
- package/dist/src/parser/parser.js +45 -34
- package/dist/src/parser/parser.js.map +1 -1
- package/dist/src/planner/analysis/coarsened-key.d.ts +4 -3
- package/dist/src/planner/analysis/coarsened-key.d.ts.map +1 -1
- package/dist/src/planner/analysis/coarsened-key.js +37 -3
- package/dist/src/planner/analysis/coarsened-key.js.map +1 -1
- package/dist/src/planner/analysis/comparison-collation.d.ts +35 -3
- package/dist/src/planner/analysis/comparison-collation.d.ts.map +1 -1
- package/dist/src/planner/analysis/comparison-collation.js +37 -3
- package/dist/src/planner/analysis/comparison-collation.js.map +1 -1
- package/dist/src/planner/analysis/coverage-prover.d.ts +13 -2
- package/dist/src/planner/analysis/coverage-prover.d.ts.map +1 -1
- package/dist/src/planner/analysis/coverage-prover.js +10 -14
- package/dist/src/planner/analysis/coverage-prover.js.map +1 -1
- package/dist/src/planner/analysis/expression-fingerprint.d.ts.map +1 -1
- package/dist/src/planner/analysis/expression-fingerprint.js +29 -0
- package/dist/src/planner/analysis/expression-fingerprint.js.map +1 -1
- package/dist/src/planner/analysis/predicate-conjuncts.d.ts +10 -4
- package/dist/src/planner/analysis/predicate-conjuncts.d.ts.map +1 -1
- package/dist/src/planner/analysis/predicate-conjuncts.js +28 -7
- package/dist/src/planner/analysis/predicate-conjuncts.js.map +1 -1
- package/dist/src/planner/analysis/query-rewrite-matcher.d.ts +6 -0
- package/dist/src/planner/analysis/query-rewrite-matcher.d.ts.map +1 -1
- package/dist/src/planner/analysis/query-rewrite-matcher.js +19 -29
- package/dist/src/planner/analysis/query-rewrite-matcher.js.map +1 -1
- package/dist/src/planner/analysis/sat-checker.d.ts.map +1 -1
- package/dist/src/planner/analysis/sat-checker.js +43 -4
- package/dist/src/planner/analysis/sat-checker.js.map +1 -1
- package/dist/src/planner/analysis/scalar-subqueries.d.ts +22 -3
- package/dist/src/planner/analysis/scalar-subqueries.d.ts.map +1 -1
- package/dist/src/planner/analysis/scalar-subqueries.js +32 -3
- package/dist/src/planner/analysis/scalar-subqueries.js.map +1 -1
- package/dist/src/planner/analysis/set-op-type-merge.d.ts +64 -0
- package/dist/src/planner/analysis/set-op-type-merge.d.ts.map +1 -0
- package/dist/src/planner/analysis/set-op-type-merge.js +97 -0
- package/dist/src/planner/analysis/set-op-type-merge.js.map +1 -0
- package/dist/src/planner/building/coercion.d.ts +78 -0
- package/dist/src/planner/building/coercion.d.ts.map +1 -0
- package/dist/src/planner/building/coercion.js +137 -0
- package/dist/src/planner/building/coercion.js.map +1 -0
- package/dist/src/planner/building/constraint-builder.d.ts.map +1 -1
- package/dist/src/planner/building/constraint-builder.js +5 -18
- package/dist/src/planner/building/constraint-builder.js.map +1 -1
- package/dist/src/planner/building/delete.d.ts.map +1 -1
- package/dist/src/planner/building/delete.js +10 -3
- package/dist/src/planner/building/delete.js.map +1 -1
- package/dist/src/planner/building/expression.d.ts.map +1 -1
- package/dist/src/planner/building/expression.js +13 -35
- package/dist/src/planner/building/expression.js.map +1 -1
- package/dist/src/planner/building/foreign-key-builder.d.ts +44 -1
- package/dist/src/planner/building/foreign-key-builder.d.ts.map +1 -1
- package/dist/src/planner/building/foreign-key-builder.js +54 -0
- package/dist/src/planner/building/foreign-key-builder.js.map +1 -1
- package/dist/src/planner/building/function-call.d.ts.map +1 -1
- package/dist/src/planner/building/function-call.js +8 -0
- package/dist/src/planner/building/function-call.js.map +1 -1
- package/dist/src/planner/building/insert.d.ts.map +1 -1
- package/dist/src/planner/building/insert.js +9 -12
- package/dist/src/planner/building/insert.js.map +1 -1
- package/dist/src/planner/building/select-compound.d.ts.map +1 -1
- package/dist/src/planner/building/select-compound.js +10 -6
- package/dist/src/planner/building/select-compound.js.map +1 -1
- package/dist/src/planner/building/update.d.ts.map +1 -1
- package/dist/src/planner/building/update.js +13 -4
- package/dist/src/planner/building/update.js.map +1 -1
- package/dist/src/planner/cost/conjunct-cost.d.ts +42 -0
- package/dist/src/planner/cost/conjunct-cost.d.ts.map +1 -0
- package/dist/src/planner/cost/conjunct-cost.js +62 -0
- package/dist/src/planner/cost/conjunct-cost.js.map +1 -0
- package/dist/src/planner/framework/pass.js +3 -3
- package/dist/src/planner/mutation/propagate.d.ts.map +1 -1
- package/dist/src/planner/mutation/propagate.js +1 -0
- package/dist/src/planner/mutation/propagate.js.map +1 -1
- package/dist/src/planner/nodes/async-gather-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/async-gather-node.js +19 -8
- package/dist/src/planner/nodes/async-gather-node.js.map +1 -1
- package/dist/src/planner/nodes/bloom-join-node.d.ts +2 -0
- package/dist/src/planner/nodes/bloom-join-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/bloom-join-node.js +10 -5
- package/dist/src/planner/nodes/bloom-join-node.js.map +1 -1
- package/dist/src/planner/nodes/dml-executor-node.d.ts +0 -9
- package/dist/src/planner/nodes/dml-executor-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/dml-executor-node.js.map +1 -1
- package/dist/src/planner/nodes/join-node.d.ts +5 -0
- package/dist/src/planner/nodes/join-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/join-node.js +8 -1
- package/dist/src/planner/nodes/join-node.js.map +1 -1
- package/dist/src/planner/nodes/join-utils.d.ts +57 -0
- package/dist/src/planner/nodes/join-utils.d.ts.map +1 -1
- package/dist/src/planner/nodes/join-utils.js +47 -0
- package/dist/src/planner/nodes/join-utils.js.map +1 -1
- package/dist/src/planner/nodes/key-set-semi-join-node.d.ts +87 -0
- package/dist/src/planner/nodes/key-set-semi-join-node.d.ts.map +1 -0
- package/dist/src/planner/nodes/key-set-semi-join-node.js +137 -0
- package/dist/src/planner/nodes/key-set-semi-join-node.js.map +1 -0
- package/dist/src/planner/nodes/merge-join-node.d.ts +2 -0
- package/dist/src/planner/nodes/merge-join-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/merge-join-node.js +14 -6
- package/dist/src/planner/nodes/merge-join-node.js.map +1 -1
- package/dist/src/planner/nodes/plan-node-type.d.ts +1 -0
- package/dist/src/planner/nodes/plan-node-type.d.ts.map +1 -1
- package/dist/src/planner/nodes/plan-node-type.js +1 -0
- package/dist/src/planner/nodes/plan-node-type.js.map +1 -1
- package/dist/src/planner/nodes/scalar.d.ts.map +1 -1
- package/dist/src/planner/nodes/scalar.js +26 -3
- package/dist/src/planner/nodes/scalar.js.map +1 -1
- package/dist/src/planner/nodes/set-operation-node.d.ts +68 -16
- package/dist/src/planner/nodes/set-operation-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/set-operation-node.js +147 -26
- package/dist/src/planner/nodes/set-operation-node.js.map +1 -1
- package/dist/src/planner/nodes/table-access-nodes.d.ts +19 -1
- package/dist/src/planner/nodes/table-access-nodes.d.ts.map +1 -1
- package/dist/src/planner/nodes/table-access-nodes.js +13 -2
- package/dist/src/planner/nodes/table-access-nodes.js.map +1 -1
- package/dist/src/planner/optimizer.d.ts.map +1 -1
- package/dist/src/planner/optimizer.js +54 -12
- package/dist/src/planner/optimizer.js.map +1 -1
- package/dist/src/planner/rules/access/rule-key-set-seek.d.ts +68 -0
- package/dist/src/planner/rules/access/rule-key-set-seek.d.ts.map +1 -0
- package/dist/src/planner/rules/access/rule-key-set-seek.js +408 -0
- package/dist/src/planner/rules/access/rule-key-set-seek.js.map +1 -0
- package/dist/src/planner/rules/access/rule-monotonic-range-access.d.ts.map +1 -1
- package/dist/src/planner/rules/access/rule-monotonic-range-access.js +2 -2
- package/dist/src/planner/rules/access/rule-monotonic-range-access.js.map +1 -1
- package/dist/src/planner/rules/access/rule-select-access-path.d.ts +27 -0
- package/dist/src/planner/rules/access/rule-select-access-path.d.ts.map +1 -1
- package/dist/src/planner/rules/access/rule-select-access-path.js +74 -29
- package/dist/src/planner/rules/access/rule-select-access-path.js.map +1 -1
- package/dist/src/planner/rules/cache/rule-materialized-view-rewrite.d.ts.map +1 -1
- package/dist/src/planner/rules/cache/rule-materialized-view-rewrite.js +23 -4
- package/dist/src/planner/rules/cache/rule-materialized-view-rewrite.js.map +1 -1
- package/dist/src/planner/rules/cache/rule-scalar-subquery-cache.d.ts +10 -8
- package/dist/src/planner/rules/cache/rule-scalar-subquery-cache.d.ts.map +1 -1
- package/dist/src/planner/rules/cache/rule-scalar-subquery-cache.js +10 -8
- package/dist/src/planner/rules/cache/rule-scalar-subquery-cache.js.map +1 -1
- package/dist/src/planner/rules/join/equi-pair-extractor.d.ts +67 -41
- package/dist/src/planner/rules/join/equi-pair-extractor.d.ts.map +1 -1
- package/dist/src/planner/rules/join/equi-pair-extractor.js +72 -36
- package/dist/src/planner/rules/join/equi-pair-extractor.js.map +1 -1
- package/dist/src/planner/rules/join/rule-join-physical-selection.d.ts.map +1 -1
- package/dist/src/planner/rules/join/rule-join-physical-selection.js +14 -2
- package/dist/src/planner/rules/join/rule-join-physical-selection.js.map +1 -1
- package/dist/src/planner/rules/join/rule-monotonic-merge-join.d.ts.map +1 -1
- package/dist/src/planner/rules/join/rule-monotonic-merge-join.js +11 -1
- package/dist/src/planner/rules/join/rule-monotonic-merge-join.js.map +1 -1
- package/dist/src/planner/rules/predicate/rule-empty-relation-folding.d.ts +1 -1
- package/dist/src/planner/rules/predicate/rule-empty-relation-folding.js +1 -1
- package/dist/src/planner/rules/predicate/rule-filter-conjunct-ordering.d.ts +30 -0
- package/dist/src/planner/rules/predicate/rule-filter-conjunct-ordering.d.ts.map +1 -0
- package/dist/src/planner/rules/predicate/rule-filter-conjunct-ordering.js +63 -0
- package/dist/src/planner/rules/predicate/rule-filter-conjunct-ordering.js.map +1 -0
- package/dist/src/planner/rules/predicate/rule-filter-selectivity.d.ts +17 -1
- package/dist/src/planner/rules/predicate/rule-filter-selectivity.d.ts.map +1 -1
- package/dist/src/planner/rules/predicate/rule-filter-selectivity.js +206 -12
- package/dist/src/planner/rules/predicate/rule-filter-selectivity.js.map +1 -1
- package/dist/src/planner/rules/predicate/rule-predicate-inference-equivalence.js +8 -1
- package/dist/src/planner/rules/predicate/rule-predicate-inference-equivalence.js.map +1 -1
- package/dist/src/planner/rules/predicate/rule-predicate-pushdown.d.ts +3 -1
- package/dist/src/planner/rules/predicate/rule-predicate-pushdown.d.ts.map +1 -1
- package/dist/src/planner/rules/predicate/rule-predicate-pushdown.js +13 -1
- package/dist/src/planner/rules/predicate/rule-predicate-pushdown.js.map +1 -1
- package/dist/src/planner/rules/retrieve/rule-grow-retrieve.d.ts.map +1 -1
- package/dist/src/planner/rules/retrieve/rule-grow-retrieve.js +18 -3
- package/dist/src/planner/rules/retrieve/rule-grow-retrieve.js.map +1 -1
- package/dist/src/planner/rules/shared/index-style-context.d.ts +17 -0
- package/dist/src/planner/rules/shared/index-style-context.d.ts.map +1 -1
- package/dist/src/planner/rules/shared/index-style-context.js +7 -0
- package/dist/src/planner/rules/shared/index-style-context.js.map +1 -1
- package/dist/src/planner/rules/subquery/rule-scalar-agg-decorrelation.js +4 -0
- package/dist/src/planner/rules/subquery/rule-scalar-agg-decorrelation.js.map +1 -1
- package/dist/src/planner/rules/subquery/rule-subquery-decorrelation.d.ts +24 -6
- package/dist/src/planner/rules/subquery/rule-subquery-decorrelation.d.ts.map +1 -1
- package/dist/src/planner/rules/subquery/rule-subquery-decorrelation.js +175 -60
- package/dist/src/planner/rules/subquery/rule-subquery-decorrelation.js.map +1 -1
- package/dist/src/planner/stats/catalog-stats.d.ts +52 -0
- package/dist/src/planner/stats/catalog-stats.d.ts.map +1 -1
- package/dist/src/planner/stats/catalog-stats.js +151 -5
- package/dist/src/planner/stats/catalog-stats.js.map +1 -1
- package/dist/src/planner/stats/index.d.ts +15 -0
- package/dist/src/planner/stats/index.d.ts.map +1 -1
- package/dist/src/planner/stats/index.js.map +1 -1
- package/dist/src/planner/stats/selectivity-combine.d.ts +53 -0
- package/dist/src/planner/stats/selectivity-combine.d.ts.map +1 -0
- package/dist/src/planner/stats/selectivity-combine.js +75 -0
- package/dist/src/planner/stats/selectivity-combine.js.map +1 -0
- package/dist/src/planner/util/column-origins.d.ts +58 -0
- package/dist/src/planner/util/column-origins.d.ts.map +1 -0
- package/dist/src/planner/util/column-origins.js +90 -0
- package/dist/src/planner/util/column-origins.js.map +1 -0
- package/dist/src/runtime/deferred-constraint-queue.d.ts +40 -0
- package/dist/src/runtime/deferred-constraint-queue.d.ts.map +1 -1
- package/dist/src/runtime/deferred-constraint-queue.js +91 -0
- package/dist/src/runtime/deferred-constraint-queue.js.map +1 -1
- package/dist/src/runtime/emit/aggregate-setup.d.ts +49 -0
- package/dist/src/runtime/emit/aggregate-setup.d.ts.map +1 -0
- package/dist/src/runtime/emit/aggregate-setup.js +99 -0
- package/dist/src/runtime/emit/aggregate-setup.js.map +1 -0
- package/dist/src/runtime/emit/aggregate.d.ts.map +1 -1
- package/dist/src/runtime/emit/aggregate.js +4 -69
- package/dist/src/runtime/emit/aggregate.js.map +1 -1
- package/dist/src/runtime/emit/alter-table.d.ts.map +1 -1
- package/dist/src/runtime/emit/alter-table.js +354 -165
- package/dist/src/runtime/emit/alter-table.js.map +1 -1
- package/dist/src/runtime/emit/asof-scan.d.ts.map +1 -1
- package/dist/src/runtime/emit/asof-scan.js +11 -0
- package/dist/src/runtime/emit/asof-scan.js.map +1 -1
- package/dist/src/runtime/emit/between.d.ts.map +1 -1
- package/dist/src/runtime/emit/between.js +7 -12
- package/dist/src/runtime/emit/between.js.map +1 -1
- package/dist/src/runtime/emit/binary.d.ts.map +1 -1
- package/dist/src/runtime/emit/binary.js +24 -25
- package/dist/src/runtime/emit/binary.js.map +1 -1
- package/dist/src/runtime/emit/bloom-join.d.ts.map +1 -1
- package/dist/src/runtime/emit/bloom-join.js +8 -16
- package/dist/src/runtime/emit/bloom-join.js.map +1 -1
- package/dist/src/runtime/emit/case.d.ts.map +1 -1
- package/dist/src/runtime/emit/case.js +40 -6
- package/dist/src/runtime/emit/case.js.map +1 -1
- package/dist/src/runtime/emit/cast.d.ts.map +1 -1
- package/dist/src/runtime/emit/cast.js +10 -23
- package/dist/src/runtime/emit/cast.js.map +1 -1
- package/dist/src/runtime/emit/constraint-check.d.ts.map +1 -1
- package/dist/src/runtime/emit/constraint-check.js +72 -51
- package/dist/src/runtime/emit/constraint-check.js.map +1 -1
- package/dist/src/runtime/emit/create-view.d.ts.map +1 -1
- package/dist/src/runtime/emit/create-view.js +6 -0
- package/dist/src/runtime/emit/create-view.js.map +1 -1
- package/dist/src/runtime/emit/distinct.d.ts.map +1 -1
- package/dist/src/runtime/emit/distinct.js +6 -3
- package/dist/src/runtime/emit/distinct.js.map +1 -1
- package/dist/src/runtime/emit/dml-executor.d.ts.map +1 -1
- package/dist/src/runtime/emit/dml-executor.js +188 -84
- package/dist/src/runtime/emit/dml-executor.js.map +1 -1
- package/dist/src/runtime/emit/filter.d.ts +18 -0
- package/dist/src/runtime/emit/filter.d.ts.map +1 -1
- package/dist/src/runtime/emit/filter.js +52 -10
- package/dist/src/runtime/emit/filter.js.map +1 -1
- package/dist/src/runtime/emit/hash-aggregate.d.ts.map +1 -1
- package/dist/src/runtime/emit/hash-aggregate.js +16 -65
- package/dist/src/runtime/emit/hash-aggregate.js.map +1 -1
- package/dist/src/runtime/emit/insert.d.ts.map +1 -1
- package/dist/src/runtime/emit/insert.js +18 -7
- package/dist/src/runtime/emit/insert.js.map +1 -1
- package/dist/src/runtime/emit/join-key-extractor.d.ts +46 -0
- package/dist/src/runtime/emit/join-key-extractor.d.ts.map +1 -0
- package/dist/src/runtime/emit/join-key-extractor.js +60 -0
- package/dist/src/runtime/emit/join-key-extractor.js.map +1 -0
- package/dist/src/runtime/emit/join.d.ts.map +1 -1
- package/dist/src/runtime/emit/join.js +37 -11
- package/dist/src/runtime/emit/join.js.map +1 -1
- package/dist/src/runtime/emit/key-set-semi-join.d.ts +29 -0
- package/dist/src/runtime/emit/key-set-semi-join.d.ts.map +1 -0
- package/dist/src/runtime/emit/key-set-semi-join.js +143 -0
- package/dist/src/runtime/emit/key-set-semi-join.js.map +1 -0
- package/dist/src/runtime/emit/materialized-view-helpers.d.ts +14 -1
- package/dist/src/runtime/emit/materialized-view-helpers.d.ts.map +1 -1
- package/dist/src/runtime/emit/materialized-view-helpers.js +33 -3
- package/dist/src/runtime/emit/materialized-view-helpers.js.map +1 -1
- package/dist/src/runtime/emit/materialized-view.d.ts.map +1 -1
- package/dist/src/runtime/emit/materialized-view.js +47 -6
- package/dist/src/runtime/emit/materialized-view.js.map +1 -1
- package/dist/src/runtime/emit/merge-join.d.ts.map +1 -1
- package/dist/src/runtime/emit/merge-join.js +32 -15
- package/dist/src/runtime/emit/merge-join.js.map +1 -1
- package/dist/src/runtime/emit/operand-comparator.d.ts +40 -0
- package/dist/src/runtime/emit/operand-comparator.d.ts.map +1 -0
- package/dist/src/runtime/emit/operand-comparator.js +59 -0
- package/dist/src/runtime/emit/operand-comparator.js.map +1 -0
- package/dist/src/runtime/emit/scan.d.ts.map +1 -1
- package/dist/src/runtime/emit/scan.js +11 -2
- package/dist/src/runtime/emit/scan.js.map +1 -1
- package/dist/src/runtime/emit/set-object-tags.d.ts +8 -0
- package/dist/src/runtime/emit/set-object-tags.d.ts.map +1 -1
- package/dist/src/runtime/emit/set-object-tags.js +8 -0
- package/dist/src/runtime/emit/set-object-tags.js.map +1 -1
- package/dist/src/runtime/emit/set-operation.d.ts.map +1 -1
- package/dist/src/runtime/emit/set-operation.js +7 -4
- package/dist/src/runtime/emit/set-operation.js.map +1 -1
- package/dist/src/runtime/emit/sort.d.ts.map +1 -1
- package/dist/src/runtime/emit/sort.js +5 -2
- package/dist/src/runtime/emit/sort.js.map +1 -1
- package/dist/src/runtime/emit/subquery.d.ts.map +1 -1
- package/dist/src/runtime/emit/subquery.js +113 -13
- package/dist/src/runtime/emit/subquery.js.map +1 -1
- package/dist/src/runtime/emit/temporal-arithmetic.d.ts +7 -0
- package/dist/src/runtime/emit/temporal-arithmetic.d.ts.map +1 -1
- package/dist/src/runtime/emit/temporal-arithmetic.js +15 -7
- package/dist/src/runtime/emit/temporal-arithmetic.js.map +1 -1
- package/dist/src/runtime/emit/update.d.ts.map +1 -1
- package/dist/src/runtime/emit/update.js +44 -3
- package/dist/src/runtime/emit/update.js.map +1 -1
- package/dist/src/runtime/emit/window.d.ts.map +1 -1
- package/dist/src/runtime/emit/window.js +72 -55
- package/dist/src/runtime/emit/window.js.map +1 -1
- package/dist/src/runtime/foreign-key-actions.d.ts +36 -1
- package/dist/src/runtime/foreign-key-actions.d.ts.map +1 -1
- package/dist/src/runtime/foreign-key-actions.js +238 -116
- package/dist/src/runtime/foreign-key-actions.js.map +1 -1
- package/dist/src/runtime/parallel-driver.d.ts +10 -2
- package/dist/src/runtime/parallel-driver.d.ts.map +1 -1
- package/dist/src/runtime/parallel-driver.js +12 -2
- package/dist/src/runtime/parallel-driver.js.map +1 -1
- package/dist/src/runtime/register.d.ts.map +1 -1
- package/dist/src/runtime/register.js +2 -0
- package/dist/src/runtime/register.js.map +1 -1
- package/dist/src/runtime/types.d.ts +25 -0
- package/dist/src/runtime/types.d.ts.map +1 -1
- package/dist/src/runtime/types.js.map +1 -1
- package/dist/src/schema/catalog-persistability.d.ts +58 -0
- package/dist/src/schema/catalog-persistability.d.ts.map +1 -0
- package/dist/src/schema/catalog-persistability.js +87 -0
- package/dist/src/schema/catalog-persistability.js.map +1 -0
- package/dist/src/schema/catalog.d.ts +17 -1
- package/dist/src/schema/catalog.d.ts.map +1 -1
- package/dist/src/schema/catalog.js +25 -3
- package/dist/src/schema/catalog.js.map +1 -1
- package/dist/src/schema/constraint-builder.d.ts +20 -22
- package/dist/src/schema/constraint-builder.d.ts.map +1 -1
- package/dist/src/schema/constraint-builder.js +43 -36
- package/dist/src/schema/constraint-builder.js.map +1 -1
- package/dist/src/schema/ddl-generator.d.ts +23 -0
- package/dist/src/schema/ddl-generator.d.ts.map +1 -1
- package/dist/src/schema/ddl-generator.js +27 -0
- package/dist/src/schema/ddl-generator.js.map +1 -1
- package/dist/src/schema/function.d.ts +39 -1
- package/dist/src/schema/function.d.ts.map +1 -1
- package/dist/src/schema/function.js.map +1 -1
- package/dist/src/schema/manager.d.ts +28 -0
- package/dist/src/schema/manager.d.ts.map +1 -1
- package/dist/src/schema/manager.js +82 -14
- package/dist/src/schema/manager.js.map +1 -1
- package/dist/src/schema/schema-differ.d.ts.map +1 -1
- package/dist/src/schema/schema-differ.js +51 -12
- package/dist/src/schema/schema-differ.js.map +1 -1
- package/dist/src/schema/unique-enforcement.d.ts +31 -0
- package/dist/src/schema/unique-enforcement.d.ts.map +1 -1
- package/dist/src/schema/unique-enforcement.js +37 -1
- package/dist/src/schema/unique-enforcement.js.map +1 -1
- package/dist/src/schema/window-function.d.ts +30 -10
- package/dist/src/schema/window-function.d.ts.map +1 -1
- package/dist/src/schema/window-function.js +20 -16
- package/dist/src/schema/window-function.js.map +1 -1
- package/dist/src/types/builtin-types.d.ts.map +1 -1
- package/dist/src/types/builtin-types.js +30 -4
- package/dist/src/types/builtin-types.js.map +1 -1
- package/dist/src/types/cast-semantics.d.ts +43 -0
- package/dist/src/types/cast-semantics.d.ts.map +1 -0
- package/dist/src/types/cast-semantics.js +59 -0
- package/dist/src/types/cast-semantics.js.map +1 -0
- package/dist/src/types/index.d.ts +1 -1
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/src/types/index.js +1 -1
- package/dist/src/types/index.js.map +1 -1
- package/dist/src/types/json-type.d.ts.map +1 -1
- package/dist/src/types/json-type.js +31 -10
- package/dist/src/types/json-type.js.map +1 -1
- package/dist/src/types/logical-type.d.ts +22 -0
- package/dist/src/types/logical-type.d.ts.map +1 -1
- package/dist/src/types/logical-type.js.map +1 -1
- package/dist/src/types/temporal-types.d.ts.map +1 -1
- package/dist/src/types/temporal-types.js +33 -11
- package/dist/src/types/temporal-types.js.map +1 -1
- package/dist/src/types/validation.d.ts +39 -1
- package/dist/src/types/validation.d.ts.map +1 -1
- package/dist/src/types/validation.js +60 -0
- package/dist/src/types/validation.js.map +1 -1
- package/dist/src/util/ast-spine-clone.d.ts +23 -0
- package/dist/src/util/ast-spine-clone.d.ts.map +1 -0
- package/dist/src/util/ast-spine-clone.js +41 -0
- package/dist/src/util/ast-spine-clone.js.map +1 -0
- package/dist/src/util/coercion.d.ts +13 -0
- package/dist/src/util/coercion.d.ts.map +1 -1
- package/dist/src/util/coercion.js +10 -1
- package/dist/src/util/coercion.js.map +1 -1
- package/dist/src/util/comparison.d.ts +114 -0
- package/dist/src/util/comparison.d.ts.map +1 -1
- package/dist/src/util/comparison.js +187 -27
- package/dist/src/util/comparison.js.map +1 -1
- package/dist/src/vtab/best-access-plan.d.ts +87 -0
- package/dist/src/vtab/best-access-plan.d.ts.map +1 -1
- package/dist/src/vtab/best-access-plan.js +87 -0
- package/dist/src/vtab/best-access-plan.js.map +1 -1
- package/dist/src/vtab/manifest.d.ts +7 -0
- package/dist/src/vtab/manifest.d.ts.map +1 -1
- package/dist/src/vtab/memory/connection.d.ts +14 -1
- package/dist/src/vtab/memory/connection.d.ts.map +1 -1
- package/dist/src/vtab/memory/connection.js +20 -2
- package/dist/src/vtab/memory/connection.js.map +1 -1
- package/dist/src/vtab/memory/layer/base.d.ts +12 -5
- package/dist/src/vtab/memory/layer/base.d.ts.map +1 -1
- package/dist/src/vtab/memory/layer/base.js +20 -9
- package/dist/src/vtab/memory/layer/base.js.map +1 -1
- package/dist/src/vtab/memory/layer/connection.d.ts +17 -0
- package/dist/src/vtab/memory/layer/connection.d.ts.map +1 -1
- package/dist/src/vtab/memory/layer/connection.js +26 -0
- package/dist/src/vtab/memory/layer/connection.js.map +1 -1
- package/dist/src/vtab/memory/layer/manager.d.ts +156 -31
- package/dist/src/vtab/memory/layer/manager.d.ts.map +1 -1
- package/dist/src/vtab/memory/layer/manager.js +695 -158
- package/dist/src/vtab/memory/layer/manager.js.map +1 -1
- package/dist/src/vtab/memory/layer/plan-filter.d.ts +41 -20
- package/dist/src/vtab/memory/layer/plan-filter.d.ts.map +1 -1
- package/dist/src/vtab/memory/layer/plan-filter.js +57 -27
- package/dist/src/vtab/memory/layer/plan-filter.js.map +1 -1
- package/dist/src/vtab/memory/layer/row-convert.d.ts +21 -0
- package/dist/src/vtab/memory/layer/row-convert.d.ts.map +1 -0
- package/dist/src/vtab/memory/layer/row-convert.js +30 -0
- package/dist/src/vtab/memory/layer/row-convert.js.map +1 -0
- package/dist/src/vtab/memory/layer/scan-layer.d.ts +6 -3
- package/dist/src/vtab/memory/layer/scan-layer.d.ts.map +1 -1
- package/dist/src/vtab/memory/layer/scan-layer.js +48 -34
- package/dist/src/vtab/memory/layer/scan-layer.js.map +1 -1
- package/dist/src/vtab/memory/layer/transaction.d.ts +142 -19
- package/dist/src/vtab/memory/layer/transaction.d.ts.map +1 -1
- package/dist/src/vtab/memory/layer/transaction.js +237 -73
- package/dist/src/vtab/memory/layer/transaction.js.map +1 -1
- package/dist/src/vtab/memory/module.d.ts +14 -2
- package/dist/src/vtab/memory/module.d.ts.map +1 -1
- package/dist/src/vtab/memory/module.js +60 -41
- package/dist/src/vtab/memory/module.js.map +1 -1
- package/dist/src/vtab/memory/table.d.ts +1 -1
- package/dist/src/vtab/memory/table.d.ts.map +1 -1
- package/dist/src/vtab/memory/table.js +12 -4
- package/dist/src/vtab/memory/table.js.map +1 -1
- package/dist/src/vtab/memory/types.d.ts +27 -1
- package/dist/src/vtab/memory/types.d.ts.map +1 -1
- package/dist/src/vtab/memory/types.js +16 -1
- package/dist/src/vtab/memory/types.js.map +1 -1
- package/dist/src/vtab/memory/utils/primary-key.d.ts +9 -0
- package/dist/src/vtab/memory/utils/primary-key.d.ts.map +1 -1
- package/dist/src/vtab/memory/utils/primary-key.js +11 -0
- package/dist/src/vtab/memory/utils/primary-key.js.map +1 -1
- package/dist/src/vtab/module.d.ts +63 -0
- package/dist/src/vtab/module.d.ts.map +1 -1
- package/dist/src/vtab/table.d.ts +33 -7
- package/dist/src/vtab/table.d.ts.map +1 -1
- package/dist/src/vtab/table.js.map +1 -1
- package/package.json +3 -3
- package/dist/src/planner/rules/cache/rule-in-subquery-cache.d.ts +0 -26
- package/dist/src/planner/rules/cache/rule-in-subquery-cache.d.ts.map +0 -1
- package/dist/src/planner/rules/cache/rule-in-subquery-cache.js +0 -66
- package/dist/src/planner/rules/cache/rule-in-subquery-cache.js.map +0 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { SqlValue } from "../../common/types.js";
|
|
2
|
+
import type { CollationFunction, LogicalType } from "../../types/logical-type.js";
|
|
3
|
+
/** Three-way comparison of a probe value against one operand value. */
|
|
4
|
+
export type OperandComparator = (probe: SqlValue, operand: SqlValue) => number;
|
|
5
|
+
/**
|
|
6
|
+
* Comparator for a group of declared operand types that are all compared against
|
|
7
|
+
* one another, selecting the SAME path `emitComparisonOp` would select for the
|
|
8
|
+
* equivalent binary comparison, so every comparison construct and its desugared
|
|
9
|
+
* form agree:
|
|
10
|
+
* - every operand declares the same semantic-ordering type (TIMESPAN, JSON) ⇒ that
|
|
11
|
+
* type's compare, matching the operator's typed fast path;
|
|
12
|
+
* - no operand is temporal and all share a category (all numeric or all textual) ⇒
|
|
13
|
+
* plain storage-class + collation compare, matching the operator's same-category
|
|
14
|
+
* fast path. Notably a plain TEXT column holding duration-shaped text ('PT30M')
|
|
15
|
+
* stays text-ordered here, exactly as `>=` leaves it;
|
|
16
|
+
* - otherwise ⇒ a runtime duration check first, matching the operator's generic path.
|
|
17
|
+
* This is what makes `greatest(timespan_col, 'PT30M')` rank by elapsed time even
|
|
18
|
+
* though the literal declares TEXT.
|
|
19
|
+
*
|
|
20
|
+
* This is THE one copy of the routing rule — {@link makeOperandComparator} is the
|
|
21
|
+
* two-operand case of it — so BETWEEN, `=`, simple CASE and the comparison builtins
|
|
22
|
+
* cannot drift apart. The collation must already be resolved through the shared
|
|
23
|
+
* provenance lattice (`planner/analysis/comparison-collation.ts`) by the caller.
|
|
24
|
+
*/
|
|
25
|
+
export declare function makeGroupComparator(logicals: readonly LogicalType[], collationFunc: CollationFunction): OperandComparator;
|
|
26
|
+
/**
|
|
27
|
+
* Comparator for ONE operand of a "probe against N independently-typed operands"
|
|
28
|
+
* construct (a BETWEEN bound, a simple-CASE WHEN value, a `nullif` pair) — the
|
|
29
|
+
* two-operand case of {@link makeGroupComparator}.
|
|
30
|
+
*/
|
|
31
|
+
export declare function makeOperandComparator(probeLogical: LogicalType, operandLogical: LogicalType, collationFunc: CollationFunction): OperandComparator;
|
|
32
|
+
/**
|
|
33
|
+
* Build the collation suffix for an instruction note over per-operand collations:
|
|
34
|
+
* nothing when every operand resolved to BINARY, a single name when they all agree,
|
|
35
|
+
* or the slash-joined per-operand list when they differ (BETWEEN's `lower/upper`
|
|
36
|
+
* generalizes to a simple CASE's one entry per WHEN clause). So `explain` shows what
|
|
37
|
+
* each operand is actually compared under.
|
|
38
|
+
*/
|
|
39
|
+
export declare function formatOperandCollationNote(collationNames: readonly string[]): string;
|
|
40
|
+
//# sourceMappingURL=operand-comparator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operand-comparator.d.ts","sourceRoot":"","sources":["../../../../src/runtime/emit/operand-comparator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAGlF,uEAAuE;AACvE,MAAM,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,KAAK,MAAM,CAAC;AAE/E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,mBAAmB,CAClC,QAAQ,EAAE,SAAS,WAAW,EAAE,EAChC,aAAa,EAAE,iBAAiB,GAC9B,iBAAiB,CAanB;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACpC,YAAY,EAAE,WAAW,EACzB,cAAc,EAAE,WAAW,EAC3B,aAAa,EAAE,iBAAiB,GAC9B,iBAAiB,CAEnB;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAOpF"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { compareSqlValuesFast, createTypedComparator, hasSemanticOrdering } from "../../util/comparison.js";
|
|
2
|
+
import { tryTemporalCompare } from "./temporal-arithmetic.js";
|
|
3
|
+
/**
|
|
4
|
+
* Comparator for a group of declared operand types that are all compared against
|
|
5
|
+
* one another, selecting the SAME path `emitComparisonOp` would select for the
|
|
6
|
+
* equivalent binary comparison, so every comparison construct and its desugared
|
|
7
|
+
* form agree:
|
|
8
|
+
* - every operand declares the same semantic-ordering type (TIMESPAN, JSON) ⇒ that
|
|
9
|
+
* type's compare, matching the operator's typed fast path;
|
|
10
|
+
* - no operand is temporal and all share a category (all numeric or all textual) ⇒
|
|
11
|
+
* plain storage-class + collation compare, matching the operator's same-category
|
|
12
|
+
* fast path. Notably a plain TEXT column holding duration-shaped text ('PT30M')
|
|
13
|
+
* stays text-ordered here, exactly as `>=` leaves it;
|
|
14
|
+
* - otherwise ⇒ a runtime duration check first, matching the operator's generic path.
|
|
15
|
+
* This is what makes `greatest(timespan_col, 'PT30M')` rank by elapsed time even
|
|
16
|
+
* though the literal declares TEXT.
|
|
17
|
+
*
|
|
18
|
+
* This is THE one copy of the routing rule — {@link makeOperandComparator} is the
|
|
19
|
+
* two-operand case of it — so BETWEEN, `=`, simple CASE and the comparison builtins
|
|
20
|
+
* cannot drift apart. The collation must already be resolved through the shared
|
|
21
|
+
* provenance lattice (`planner/analysis/comparison-collation.ts`) by the caller.
|
|
22
|
+
*/
|
|
23
|
+
export function makeGroupComparator(logicals, collationFunc) {
|
|
24
|
+
const first = logicals[0];
|
|
25
|
+
if (first && logicals.every(l => l === first) && hasSemanticOrdering(first)) {
|
|
26
|
+
return createTypedComparator(first, collationFunc);
|
|
27
|
+
}
|
|
28
|
+
const needsTemporalCheck = logicals.some(l => l.isTemporal);
|
|
29
|
+
const sameCategory = logicals.every(l => l.isNumeric) || logicals.every(l => l.isTextual);
|
|
30
|
+
if (!needsTemporalCheck && sameCategory) {
|
|
31
|
+
return (a, b) => compareSqlValuesFast(a, b, collationFunc);
|
|
32
|
+
}
|
|
33
|
+
return (a, b) => tryTemporalCompare(a, b) ?? compareSqlValuesFast(a, b, collationFunc);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Comparator for ONE operand of a "probe against N independently-typed operands"
|
|
37
|
+
* construct (a BETWEEN bound, a simple-CASE WHEN value, a `nullif` pair) — the
|
|
38
|
+
* two-operand case of {@link makeGroupComparator}.
|
|
39
|
+
*/
|
|
40
|
+
export function makeOperandComparator(probeLogical, operandLogical, collationFunc) {
|
|
41
|
+
return makeGroupComparator([probeLogical, operandLogical], collationFunc);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Build the collation suffix for an instruction note over per-operand collations:
|
|
45
|
+
* nothing when every operand resolved to BINARY, a single name when they all agree,
|
|
46
|
+
* or the slash-joined per-operand list when they differ (BETWEEN's `lower/upper`
|
|
47
|
+
* generalizes to a simple CASE's one entry per WHEN clause). So `explain` shows what
|
|
48
|
+
* each operand is actually compared under.
|
|
49
|
+
*/
|
|
50
|
+
export function formatOperandCollationNote(collationNames) {
|
|
51
|
+
if (collationNames.length === 0)
|
|
52
|
+
return '';
|
|
53
|
+
const first = collationNames[0];
|
|
54
|
+
if (collationNames.every(name => name === first)) {
|
|
55
|
+
return first !== 'BINARY' ? ` ${first}` : '';
|
|
56
|
+
}
|
|
57
|
+
return ` ${collationNames.join('/')}`;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=operand-comparator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operand-comparator.js","sourceRoot":"","sources":["../../../../src/runtime/emit/operand-comparator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE5G,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAK9D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,mBAAmB,CAClC,QAAgC,EAChC,aAAgC;IAEhC,MAAM,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC1B,IAAI,KAAK,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC,IAAI,mBAAmB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7E,OAAO,qBAAqB,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;IACpD,CAAC;IAED,MAAM,kBAAkB,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;IAC5D,MAAM,YAAY,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAC1F,IAAI,CAAC,kBAAkB,IAAI,YAAY,EAAE,CAAC;QACzC,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,oBAAoB,CAAC,CAAC,EAAE,CAAC,EAAE,aAAa,CAAC,CAAC;IAC5D,CAAC;IAED,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,CAA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AAU,EAC1B,UAAU,EAAE,cAAc,EAC1B,WAAW,EAAE,QAAQ,EAAE,KACnB,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC;;;;;;GAMG;AACH,wBAAgB,WAAW,CAC1B,IAAI,EAAE,WAAW,GAAG,aAAa,GAAG,aAAa,EACjD,GAAG,EAAE,eAAe,EACpB,kBAAkB,CAAC,EAAE,kBAAkB,GACrC,WAAW,
|
|
1
|
+
{"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../../../../src/runtime/emit/scan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAItG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAM9D;;;;;;;;GAQG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAChC,cAAc,EAAE,UAAU,EAC1B,UAAU,EAAE,cAAc,EAC1B,WAAW,EAAE,QAAQ,EAAE,KACnB,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC;;;;;;GAMG;AACH,wBAAgB,WAAW,CAC1B,IAAI,EAAE,WAAW,GAAG,aAAa,GAAG,aAAa,EACjD,GAAG,EAAE,eAAe,EACpB,kBAAkB,CAAC,EAAE,kBAAkB,GACrC,WAAW,CAoJb"}
|
|
@@ -58,16 +58,25 @@ export function emitSeqScan(plan, ctx, filterInfoOverride) {
|
|
|
58
58
|
vtabInstance = cachedInstance;
|
|
59
59
|
}
|
|
60
60
|
else {
|
|
61
|
+
// `schema.name` is the name this scan was EMITTED against. A deferred constraint
|
|
62
|
+
// evaluates a plan frozen at row-write time, so an `ALTER TABLE ... RENAME TO`
|
|
63
|
+
// later in the same transaction leaves that name pointing at nothing. The queue
|
|
64
|
+
// stamps the entry's old→new mapping onto the context while it evaluates; resolve
|
|
65
|
+
// through it so we connect under the name the table carries now. Undefined for
|
|
66
|
+
// every other execution, so this costs one optional lookup. Nothing else in this
|
|
67
|
+
// scan is name-bound — `schema.columns`, the row descriptor and the `FilterInfo`
|
|
68
|
+
// are positional, and a table rename changes no column.
|
|
69
|
+
const effectiveName = runtimeCtx.tableNameRemap?.get(`${schema.schemaName}.${schema.name}`.toLowerCase()) ?? schema.name;
|
|
61
70
|
try {
|
|
62
71
|
const options = {
|
|
63
72
|
...(schema.vtabArgs ?? {}),
|
|
64
73
|
...(source.readCommitted ? { _readCommitted: true } : {})
|
|
65
74
|
};
|
|
66
|
-
vtabInstance = await module.connect(runtimeCtx.db, capturedModuleInfo.auxData, schema.vtabModuleName, schema.schemaName,
|
|
75
|
+
vtabInstance = await module.connect(runtimeCtx.db, capturedModuleInfo.auxData, schema.vtabModuleName, schema.schemaName, effectiveName, options);
|
|
67
76
|
}
|
|
68
77
|
catch (e) {
|
|
69
78
|
const message = e instanceof Error ? e.message : String(e);
|
|
70
|
-
throw new QuereusError(`Module '${schema.vtabModuleName}' connect failed for table '${
|
|
79
|
+
throw new QuereusError(`Module '${schema.vtabModuleName}' connect failed for table '${effectiveName}': ${message}`, e instanceof QuereusError ? e.code : StatusCode.ERROR, e instanceof Error ? e : undefined);
|
|
71
80
|
}
|
|
72
81
|
if (connectionCache) {
|
|
73
82
|
connectionCache.set(scanConnectionKey, vtabInstance);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scan.js","sourceRoot":"","sources":["../../../../src/runtime/emit/scan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA2B,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAA8B,aAAa,EAAE,MAAM,2CAA2C,CAAC;AACtG,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,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AAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QAC/K,CAAC;gBAAS,CAAC;YACV,+DAA+D;YAC/D,OAAO,CAAC,KAAK,EAAE,CAAC;YAChB,2EAA2E;YAC3E,4EAA4E;YAC5E,wDAAwD;YACxD,IAAI,YAAY,EAAE,CAAC;gBAClB,MAAM,gBAAgB,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;YAClD,CAAC;QACF,CAAC;IACF,CAAC;IAED,qEAAqE;IACrE,MAAM,MAAM,GAAkB,EAAE,CAAC;IACjC,IAAI,IAAI,YAAY,aAAa,EAAE,CAAC;QACnC,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YACtC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;QACrC,CAAC;IACF,CAAC;IAED,OAAO,0BAA0B,CAChC,MAAM,EACN,KAAK,CAAC,GAAG,CAAC,EACV,GAAG,EACH,GAAG,IAAI,CAAC,QAAQ,IAAI,MAAM,CAAC,IAAI,GAAG,CAClC,CAAC;AACH,CAAC"}
|
|
@@ -11,6 +11,14 @@ import type { EmissionContext } from '../emission-context.js';
|
|
|
11
11
|
* invalidate. Reserved-tag validation already ran at plan-build time (SET/ADD
|
|
12
12
|
* only). NOTFOUND on a missing object — or a drop-of-absent key — surfaces from
|
|
13
13
|
* the setter.
|
|
14
|
+
*
|
|
15
|
+
* NOTE: deliberately NOT covered by the `ddl_transaction_policy = 'strict'` gate
|
|
16
|
+
* (see ddl-transaction-policy.ts), because it dispatches to no module — matching
|
|
17
|
+
* the gate's stated scope ("module-dispatching DDL"; `create view` and friends
|
|
18
|
+
* are out too). This does leave one asymmetry: `alter table t set tags` IS gated,
|
|
19
|
+
* since the ALTER emitter gates every arm uniformly rather than per-arm. If a
|
|
20
|
+
* module ever persists tags such that a tag edit survives rollback — or the gate's
|
|
21
|
+
* scope is restated as "anything that escapes the transaction" — gate here too.
|
|
14
22
|
*/
|
|
15
23
|
export declare function emitSetObjectTags(plan: SetObjectTagsNode, _ctx: EmissionContext): Instruction;
|
|
16
24
|
//# sourceMappingURL=set-object-tags.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-object-tags.d.ts","sourceRoot":"","sources":["../../../../src/runtime/emit/set-object-tags.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,KAAK,EAAE,WAAW,EAAkB,MAAM,aAAa,CAAC;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAM9D
|
|
1
|
+
{"version":3,"file":"set-object-tags.d.ts","sourceRoot":"","sources":["../../../../src/runtime/emit/set-object-tags.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,KAAK,EAAE,WAAW,EAAkB,MAAM,aAAa,CAAC;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAM9D;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,eAAe,GAAG,WAAW,CAmC7F"}
|
|
@@ -10,6 +10,14 @@ const log = createLogger('runtime:emit:set-object-tags');
|
|
|
10
10
|
* invalidate. Reserved-tag validation already ran at plan-build time (SET/ADD
|
|
11
11
|
* only). NOTFOUND on a missing object — or a drop-of-absent key — surfaces from
|
|
12
12
|
* the setter.
|
|
13
|
+
*
|
|
14
|
+
* NOTE: deliberately NOT covered by the `ddl_transaction_policy = 'strict'` gate
|
|
15
|
+
* (see ddl-transaction-policy.ts), because it dispatches to no module — matching
|
|
16
|
+
* the gate's stated scope ("module-dispatching DDL"; `create view` and friends
|
|
17
|
+
* are out too). This does leave one asymmetry: `alter table t set tags` IS gated,
|
|
18
|
+
* since the ALTER emitter gates every arm uniformly rather than per-arm. If a
|
|
19
|
+
* module ever persists tags such that a tag edit survives rollback — or the gate's
|
|
20
|
+
* scope is restated as "anything that escapes the transaction" — gate here too.
|
|
13
21
|
*/
|
|
14
22
|
export function emitSetObjectTags(plan, _ctx) {
|
|
15
23
|
async function run(rctx) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-object-tags.js","sourceRoot":"","sources":["../../../../src/runtime/emit/set-object-tags.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,MAAM,GAAG,GAAG,YAAY,CAAC,8BAA8B,CAAC,CAAC;AAEzD
|
|
1
|
+
{"version":3,"file":"set-object-tags.js","sourceRoot":"","sources":["../../../../src/runtime/emit/set-object-tags.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,MAAM,GAAG,GAAG,YAAY,CAAC,8BAA8B,CAAC,CAAC;AAEzD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAuB,EAAE,IAAqB;IAC/E,KAAK,UAAU,GAAG,CAAC,IAAoB;QACtC,yEAAyE;QACzE,MAAM,IAAI,CAAC,EAAE,CAAC,kBAAkB,EAAE,CAAC;QAEnC,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC;QACjC,MAAM,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC;QACxB,4EAA4E;QAC5E,4EAA4E;QAC5E,QAAQ,IAAI,CAAC,UAAU,EAAE,CAAC;YACzB,KAAK,MAAM;gBACV,IAAI,CAAC,CAAC,EAAE,KAAK,MAAM;oBAAE,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,CAA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ACR,CAAC;QACD,GAAG,CAAC,qBAAqB,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAC9E,OAAO,IAAI,CAAC;IACb,CAAC;IAED,OAAO;QACN,MAAM,EAAE,EAAE;QACV,GAAG;QACH,IAAI,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,EAAE,cAAc,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,IAAI,GAAG;KACzF,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-operation.d.ts","sourceRoot":"","sources":["../../../../src/runtime/emit/set-operation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAClF,OAAO,KAAK,EAAE,WAAW,EAAkC,MAAM,aAAa,CAAC;AAE/E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAM9D,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,gBAAgB,EAAE,GAAG,EAAE,eAAe,GAAG,WAAW,
|
|
1
|
+
{"version":3,"file":"set-operation.d.ts","sourceRoot":"","sources":["../../../../src/runtime/emit/set-operation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAClF,OAAO,KAAK,EAAE,WAAW,EAAkC,MAAM,aAAa,CAAC;AAE/E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAM9D,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,gBAAgB,EAAE,GAAG,EAAE,eAAe,GAAG,WAAW,CA6P1F"}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { asRun } from '../types.js';
|
|
2
2
|
import { emitPlanNode } from '../emitters.js';
|
|
3
3
|
import { BTree } from 'inheritree';
|
|
4
|
-
import {
|
|
4
|
+
import { createSemanticRowComparator, BINARY_COLLATION } from '../../util/comparison.js';
|
|
5
5
|
export function emitSetOperation(plan, ctx) {
|
|
6
6
|
const leftInst = emitPlanNode(plan.left, ctx);
|
|
7
7
|
const rightInst = emitPlanNode(plan.right, ctx);
|
|
8
|
-
// Pre-resolve
|
|
8
|
+
// Pre-resolve the row-identity comparator (safe for mixed-type rows in set
|
|
9
9
|
// operations). The comparator runs over the DATA columns only — membership flags
|
|
10
10
|
// are appended after, but dedup / probe identity is on data columns alone, so set
|
|
11
|
-
// identity is never perturbed by the flags.
|
|
11
|
+
// identity is never perturbed by the flags. Columns whose merged output type has
|
|
12
|
+
// semantic ordering (TIMESPAN, JSON) compare through the type's compare so set
|
|
13
|
+
// identity agrees with `=` (see createSemanticRowComparator).
|
|
12
14
|
//
|
|
13
15
|
// Each data column's collation is the CROSS-INPUT resolved collation: `SetOperationNode`
|
|
14
16
|
// merges both operands' column types through the shared comparison lattice and writes
|
|
@@ -20,7 +22,8 @@ export function emitSetOperation(plan, ctx) {
|
|
|
20
22
|
// DATA arity is recursive (`plan.dataColumnCount()`), NOT `plan.left.getType().columns.length`
|
|
21
23
|
// — a flagged inner set-op operand on the left would over-count by its surfaced flags.
|
|
22
24
|
const dataColCount = plan.dataColumnCount();
|
|
23
|
-
const
|
|
25
|
+
const dataAttributes = attributes.slice(0, dataColCount);
|
|
26
|
+
const dataComparator = createSemanticRowComparator(dataAttributes.map(attr => attr.type.logicalType), dataAttributes.map(attr => attr.type.collationName ? ctx.resolveCollation(attr.type.collationName) : BINARY_COLLATION));
|
|
24
27
|
// Helper function to create a properly structured DATA row (flags excluded; the
|
|
25
28
|
// membership runner appends them after the operator produces its rows).
|
|
26
29
|
function createOutputRow(inputRow) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-operation.js","sourceRoot":"","sources":["../../../../src/runtime/emit/set-operation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,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E,IAAI,CAAC,EAAE;KACd,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../../../../src/runtime/emit/sort.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAkB,MAAM,aAAa,CAAC;AAI/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAK9D,wBAAgB,QAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,eAAe,GAAG,WAAW,
|
|
1
|
+
{"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../../../../src/runtime/emit/sort.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAkB,MAAM,aAAa,CAAC;AAI/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAK9D,wBAAgB,QAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,eAAe,GAAG,WAAW,CAoE1E"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { asRun } from '../types.js';
|
|
2
2
|
import { emitPlanNode, emitCallFromPlan } from '../emitters.js';
|
|
3
|
-
import {
|
|
3
|
+
import { createTypedOrderByComparator } from '../../util/comparison.js';
|
|
4
4
|
import { buildRowDescriptor } from '../../util/row-descriptor.js';
|
|
5
5
|
import { withAsyncRowContext } from '../context-helpers.js';
|
|
6
6
|
export function emitSort(plan, ctx) {
|
|
@@ -13,7 +13,10 @@ export function emitSort(plan, ctx) {
|
|
|
13
13
|
const keyType = key.expression.getType();
|
|
14
14
|
const collationName = keyType.collationName || 'BINARY';
|
|
15
15
|
const collationFunc = ctx.resolveCollation(collationName);
|
|
16
|
-
|
|
16
|
+
// Semantic-ordering key types (TIMESPAN, JSON) rank by the type's compare;
|
|
17
|
+
// everything else keeps the storage-class + collation fast path. Per-key
|
|
18
|
+
// selection, so composite sorts mix typed and plain keys correctly.
|
|
19
|
+
return createTypedOrderByComparator(keyType.logicalType, key.direction, key.nulls, collationFunc);
|
|
17
20
|
});
|
|
18
21
|
async function* run(ctx, source, ...sortKeyFunctions) {
|
|
19
22
|
// Collect all rows with their sort key values
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sort.js","sourceRoot":"","sources":["../../../../src/runtime/emit/sort.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGhE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"sort.js","sourceRoot":"","sources":["../../../../src/runtime/emit/sort.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGhE,OAAO,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,QAAQ,CAAC,IAAc,EAAE,GAAoB;IAC5D,MAAM,iBAAiB,GAAG,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAEzD,8CAA8C;IAC9C,MAAM,mBAAmB,GAAG,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC;IAE5E,2FAA2F;IAC3F,MAAM,mBAAmB,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,gBAAgB,CAAC,GAAG,CAAC,UAAU,EA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d.ts","sourceRoot":"","sources":["../../../../src/runtime/emit/subquery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAC9F,OAAO,KAAK,EAAE,WAAW,EAAkC,MAAM,aAAa,CAAC;AAI/E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AA0B9D,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,kBAAkB,EAAE,GAAG,EAAE,eAAe,GAAG,WAAW,CAoE9F;AA+BD,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,eAAe,GAAG,WAAW,CAqRtE;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,eAAe,GAAG,WAAW,CA+C9E"}
|
|
@@ -3,9 +3,10 @@ import { emitPlanNode } from '../emitters.js';
|
|
|
3
3
|
import { QuereusError } from '../../common/errors.js';
|
|
4
4
|
import { StatusCode } from '../../common/types.js';
|
|
5
5
|
import { BTree } from 'inheritree';
|
|
6
|
-
import { compareSqlValuesFast } from '../../util/comparison.js';
|
|
6
|
+
import { compareSqlValuesFast, hasSemanticOrdering, semanticKeyTransform } from '../../util/comparison.js';
|
|
7
7
|
import { PlanNodeCharacteristics } from '../../planner/framework/characteristics.js';
|
|
8
|
-
import { effectiveInCollation } from '../../planner/analysis/comparison-collation.js';
|
|
8
|
+
import { effectiveInCollation, inRhsTypes } from '../../planner/analysis/comparison-collation.js';
|
|
9
|
+
import { isCorrelatedSubquery } from '../../planner/cache/correlation-detector.js';
|
|
9
10
|
/**
|
|
10
11
|
* Once-per-execution memo for impure (DML-bearing) subquery inners. The cell
|
|
11
12
|
* lives on the {@link RuntimeContext} — rebuilt for every statement execution —
|
|
@@ -77,6 +78,34 @@ export function emitScalarSubquery(plan, ctx) {
|
|
|
77
78
|
note: 'SCALAR_SUBQUERY'
|
|
78
79
|
};
|
|
79
80
|
}
|
|
81
|
+
const IDENTITY_KEY = (value) => value;
|
|
82
|
+
/**
|
|
83
|
+
* Membership key transform for `condition IN (...)`. IN is an identity test, so when
|
|
84
|
+
* an operand declares a semantic-ordering logical type (see
|
|
85
|
+
* {@link hasSemanticOrdering}) the probe AND every RHS value are normalized through
|
|
86
|
+
* that type's canonical group key before comparing. Without it, `d IN ('PT120M')` on a
|
|
87
|
+
* TIMESPAN column compares raw duration text and misses, while `d = 'PT120M'` matches
|
|
88
|
+
* on elapsed time — IN must not disagree with the equality it desugars to.
|
|
89
|
+
*
|
|
90
|
+
* Normalizing (rather than routing the type's `compare` straight into the comparator,
|
|
91
|
+
* as `emitComparisonOp`/BETWEEN do) is what keeps the BTree paths sound: the keys are
|
|
92
|
+
* ranked by plain storage-class + collation order, which is total even when a list
|
|
93
|
+
* literal is not a valid value of the type — `TIMESPAN.compare` mixes elapsed-time and
|
|
94
|
+
* text ordering in that case and is not.
|
|
95
|
+
*
|
|
96
|
+
* A mixed pair (typed column vs plain text literal) still normalizes, matching
|
|
97
|
+
* `emitComparisonOp`'s generic path, whose runtime temporal check compares
|
|
98
|
+
* duration-vs-text semantically. Types with semantic ordering but no `groupKey` (JSON,
|
|
99
|
+
* whose canonical text is already identity-faithful) take no transform, as do
|
|
100
|
+
* membership tests whose operands declare two different semantic types.
|
|
101
|
+
*/
|
|
102
|
+
function inMembershipKey(plan) {
|
|
103
|
+
const types = [plan.condition.getType().logicalType, ...inRhsTypes(plan).map(t => t.logicalType)];
|
|
104
|
+
const semantic = new Set(types.filter(hasSemanticOrdering));
|
|
105
|
+
if (semantic.size !== 1)
|
|
106
|
+
return IDENTITY_KEY;
|
|
107
|
+
return semanticKeyTransform(semantic.values().next().value) ?? IDENTITY_KEY;
|
|
108
|
+
}
|
|
80
109
|
export function emitIn(plan, ctx) {
|
|
81
110
|
// ONE collation for the whole membership test (condition vs every RHS
|
|
82
111
|
// value), resolved through the shared provenance lattice — the BTree build
|
|
@@ -84,6 +113,9 @@ export function emitIn(plan, ctx) {
|
|
|
84
113
|
// already rejected conflicts at plan time.
|
|
85
114
|
const collationName = effectiveInCollation(plan);
|
|
86
115
|
const collation = ctx.resolveCollation(collationName);
|
|
116
|
+
// Canonical identity key applied to both sides of every comparison below.
|
|
117
|
+
const memberKey = inMembershipKey(plan);
|
|
118
|
+
const keyNote = memberKey === IDENTITY_KEY ? '' : ' semantic';
|
|
87
119
|
if (plan.source) {
|
|
88
120
|
const isImpure = PlanNodeCharacteristics.subtreeHasSideEffects(plan.source);
|
|
89
121
|
if (isImpure) {
|
|
@@ -98,13 +130,14 @@ export function emitIn(plan, ctx) {
|
|
|
98
130
|
let matched = false;
|
|
99
131
|
let hasNull = false;
|
|
100
132
|
const shouldCompare = condition !== null;
|
|
133
|
+
const conditionKey = shouldCompare ? memberKey(condition) : null;
|
|
101
134
|
for await (const row of input) {
|
|
102
135
|
if (row.length > 0) {
|
|
103
136
|
const rowValue = row[0];
|
|
104
137
|
if (rowValue === null) {
|
|
105
138
|
hasNull = true;
|
|
106
139
|
}
|
|
107
|
-
else if (shouldCompare && !matched && compareSqlValuesFast(
|
|
140
|
+
else if (shouldCompare && !matched && compareSqlValuesFast(conditionKey, memberKey(rowValue), collation) === 0) {
|
|
108
141
|
matched = true;
|
|
109
142
|
}
|
|
110
143
|
}
|
|
@@ -128,15 +161,81 @@ export function emitIn(plan, ctx) {
|
|
|
128
161
|
return {
|
|
129
162
|
params: [sourceInstruction, conditionExpr],
|
|
130
163
|
run: asRun(runImpure),
|
|
131
|
-
note:
|
|
164
|
+
note: `IN(impure)${keyNote}`
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
// Uncorrelated + functional (deterministic, read-only) source: materialize
|
|
168
|
+
// the subquery result once per execution into a lookup set and probe it per
|
|
169
|
+
// outer row — O(K + N·log K). This replaces re-driving the subquery for every
|
|
170
|
+
// candidate row, the O(N×K) cliff that a per-row streaming scan degrades to at
|
|
171
|
+
// scale (see quereus-in-subquery-set-probe). The gate matches the retired
|
|
172
|
+
// `rule-in-subquery-cache`: a correlated source must re-evaluate per outer row,
|
|
173
|
+
// and a non-deterministic source must keep its per-row semantics — both route
|
|
174
|
+
// to the streaming path below. Parameter references inside the subquery are NOT
|
|
175
|
+
// correlation (they are ParameterReference, not ColumnReference), so a
|
|
176
|
+
// parameterized-but-uncorrelated subquery takes this path and rebuilds per
|
|
177
|
+
// execution as the bound value changes.
|
|
178
|
+
if (!isCorrelatedSubquery(plan.source) && PlanNodeCharacteristics.isFunctional(plan.source)) {
|
|
179
|
+
// Per-execution memo: the set lives on the RuntimeContext (rebuilt each
|
|
180
|
+
// execution), keyed by a symbol minted here at emit time. The emit-time
|
|
181
|
+
// closure persists across prepared-statement runs but holds only the
|
|
182
|
+
// symbol — never the tree — so the set resets between executions and a
|
|
183
|
+
// re-run re-drains the source with current data. Same rule as the
|
|
184
|
+
// impure-IN memo and emitCache.
|
|
185
|
+
const probeKey = Symbol('IN(set-probe)');
|
|
186
|
+
// NOTE: the set holds deduplicated scalar values — strictly less memory
|
|
187
|
+
// than the row cache it replaces, and the literal `IN (a, b, …)` path is
|
|
188
|
+
// already uncapped, so no size cap here. If enormous inner results ever
|
|
189
|
+
// need bounding, add a threshold that spills to the streaming path.
|
|
190
|
+
async function runSetProbe(rctx, input, condition) {
|
|
191
|
+
// Condition NULL → NULL, and do NOT force the build (short-circuit).
|
|
192
|
+
if (condition === null) {
|
|
193
|
+
return null;
|
|
194
|
+
}
|
|
195
|
+
let probe = rctx.inSetProbes?.get(probeKey);
|
|
196
|
+
if (!probe) {
|
|
197
|
+
// First evaluation that needs the set: drain the source once into a
|
|
198
|
+
// BTree keyed under the membership collation, tracking inner NULLs.
|
|
199
|
+
const tree = new BTree((val) => val, (a, b) => compareSqlValuesFast(a, b, collation));
|
|
200
|
+
let hasNull = false;
|
|
201
|
+
for await (const row of input) {
|
|
202
|
+
if (row.length > 0) {
|
|
203
|
+
const rowValue = row[0];
|
|
204
|
+
if (rowValue === null) {
|
|
205
|
+
hasNull = true;
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
// Duplicate keys are a no-op insert — the set only tracks membership.
|
|
209
|
+
tree.insert(memberKey(rowValue));
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
probe = { tree, hasNull };
|
|
214
|
+
(rctx.inSetProbes ??= new Map()).set(probeKey, probe);
|
|
215
|
+
}
|
|
216
|
+
// Three-valued membership, identical to the streaming and value-list paths:
|
|
217
|
+
// hit → true; miss → NULL if the inner had a NULL, else false.
|
|
218
|
+
if (probe.tree.find(memberKey(condition)).on) {
|
|
219
|
+
return true;
|
|
220
|
+
}
|
|
221
|
+
return probe.hasNull ? null : false;
|
|
222
|
+
}
|
|
223
|
+
const sourceInstruction = emitPlanNode(plan.source, ctx);
|
|
224
|
+
const conditionExpr = emitPlanNode(plan.condition, ctx);
|
|
225
|
+
return {
|
|
226
|
+
params: [sourceInstruction, conditionExpr],
|
|
227
|
+
run: asRun(runSetProbe),
|
|
228
|
+
note: `IN (subquery set-probe)${keyNote}`
|
|
132
229
|
};
|
|
133
230
|
}
|
|
134
|
-
//
|
|
231
|
+
// Correlated or non-deterministic source: streaming + early exit on match,
|
|
232
|
+
// re-evaluated per outer row.
|
|
135
233
|
async function runSubqueryStreaming(_rctx, input, condition) {
|
|
136
234
|
// If condition is NULL, result is NULL
|
|
137
235
|
if (condition === null) {
|
|
138
236
|
return null;
|
|
139
237
|
}
|
|
238
|
+
const conditionKey = memberKey(condition);
|
|
140
239
|
let hasNull = false;
|
|
141
240
|
for await (const row of input) {
|
|
142
241
|
if (row.length > 0) {
|
|
@@ -146,7 +245,7 @@ export function emitIn(plan, ctx) {
|
|
|
146
245
|
continue;
|
|
147
246
|
}
|
|
148
247
|
// Check for match immediately - no need to materialize
|
|
149
|
-
if (compareSqlValuesFast(
|
|
248
|
+
if (compareSqlValuesFast(conditionKey, memberKey(rowValue), collation) === 0) {
|
|
150
249
|
return true; // Found a match
|
|
151
250
|
}
|
|
152
251
|
}
|
|
@@ -159,7 +258,7 @@ export function emitIn(plan, ctx) {
|
|
|
159
258
|
return {
|
|
160
259
|
params: [sourceInstruction, conditionExpr],
|
|
161
260
|
run: asRun(runSubqueryStreaming),
|
|
162
|
-
note: `IN (subquery)`
|
|
261
|
+
note: `IN (subquery)${keyNote}`
|
|
163
262
|
};
|
|
164
263
|
}
|
|
165
264
|
else if (plan.values) {
|
|
@@ -176,7 +275,7 @@ export function emitIn(plan, ctx) {
|
|
|
176
275
|
return null;
|
|
177
276
|
}
|
|
178
277
|
// Check if condition exists in pre-built tree
|
|
179
|
-
const path = tree.find(condition);
|
|
278
|
+
const path = tree.find(memberKey(condition));
|
|
180
279
|
if (path.on) {
|
|
181
280
|
return true; // Found a match
|
|
182
281
|
}
|
|
@@ -194,7 +293,7 @@ export function emitIn(plan, ctx) {
|
|
|
194
293
|
hasNull = true;
|
|
195
294
|
continue;
|
|
196
295
|
}
|
|
197
|
-
tree.insert(value);
|
|
296
|
+
tree.insert(memberKey(value));
|
|
198
297
|
}
|
|
199
298
|
return innerConstantRun(rctx, condition);
|
|
200
299
|
});
|
|
@@ -205,7 +304,7 @@ export function emitIn(plan, ctx) {
|
|
|
205
304
|
hasNull = true;
|
|
206
305
|
continue;
|
|
207
306
|
}
|
|
208
|
-
tree.insert(value);
|
|
307
|
+
tree.insert(memberKey(value));
|
|
209
308
|
}
|
|
210
309
|
runFunc = asRun(innerConstantRun);
|
|
211
310
|
}
|
|
@@ -213,7 +312,7 @@ export function emitIn(plan, ctx) {
|
|
|
213
312
|
return {
|
|
214
313
|
params: [conditionExpr],
|
|
215
314
|
run: runFunc,
|
|
216
|
-
note: `IN (${plan.values.length} constant values)`
|
|
315
|
+
note: `IN (${plan.values.length} constant values)${keyNote}`
|
|
217
316
|
};
|
|
218
317
|
}
|
|
219
318
|
else {
|
|
@@ -224,13 +323,14 @@ export function emitIn(plan, ctx) {
|
|
|
224
323
|
return null;
|
|
225
324
|
}
|
|
226
325
|
// Linear scan is optimal since we're only doing one lookup per execution
|
|
326
|
+
const conditionKey = memberKey(condition);
|
|
227
327
|
let hasNull = false;
|
|
228
328
|
for (const value of values) {
|
|
229
329
|
if (value === null) {
|
|
230
330
|
hasNull = true;
|
|
231
331
|
continue;
|
|
232
332
|
}
|
|
233
|
-
if (compareSqlValuesFast(
|
|
333
|
+
if (compareSqlValuesFast(conditionKey, memberKey(value), collation) === 0) {
|
|
234
334
|
return true; // Found a match
|
|
235
335
|
}
|
|
236
336
|
}
|
|
@@ -242,7 +342,7 @@ export function emitIn(plan, ctx) {
|
|
|
242
342
|
return {
|
|
243
343
|
params: [conditionExpr, ...valueExprs],
|
|
244
344
|
run: asRun(runDynamicValues),
|
|
245
|
-
note: `IN (${plan.values.length} dynamic values)`
|
|
345
|
+
note: `IN (${plan.values.length} dynamic values)${keyNote}`
|
|
246
346
|
};
|
|
247
347
|
}
|
|
248
348
|
}
|