@quereus/quereus 2.8.0 → 3.0.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 +224 -222
- package/dist/src/core/database-assertions.d.ts +36 -16
- package/dist/src/core/database-assertions.d.ts.map +1 -1
- package/dist/src/core/database-assertions.js +222 -118
- package/dist/src/core/database-assertions.js.map +1 -1
- package/dist/src/core/database-transaction.d.ts +96 -13
- package/dist/src/core/database-transaction.d.ts.map +1 -1
- package/dist/src/core/database-transaction.js +294 -35
- package/dist/src/core/database-transaction.js.map +1 -1
- package/dist/src/core/database-watchers.d.ts +58 -0
- package/dist/src/core/database-watchers.d.ts.map +1 -0
- package/dist/src/core/database-watchers.js +206 -0
- package/dist/src/core/database-watchers.js.map +1 -0
- package/dist/src/core/database.d.ts +78 -5
- package/dist/src/core/database.d.ts.map +1 -1
- package/dist/src/core/database.js +120 -20
- package/dist/src/core/database.js.map +1 -1
- package/dist/src/core/statement.d.ts +9 -0
- package/dist/src/core/statement.d.ts.map +1 -1
- package/dist/src/core/statement.js +29 -0
- package/dist/src/core/statement.js.map +1 -1
- package/dist/src/core/table-handle.d.ts +45 -0
- package/dist/src/core/table-handle.d.ts.map +1 -0
- package/dist/src/core/table-handle.js +54 -0
- package/dist/src/core/table-handle.js.map +1 -0
- package/dist/src/emit/ast-stringify.d.ts.map +1 -1
- package/dist/src/emit/ast-stringify.js +0 -3
- package/dist/src/emit/ast-stringify.js.map +1 -1
- package/dist/src/func/builtins/conversion.d.ts.map +1 -1
- package/dist/src/func/builtins/conversion.js +12 -1
- package/dist/src/func/builtins/conversion.js.map +1 -1
- package/dist/src/func/builtins/explain.d.ts.map +1 -1
- package/dist/src/func/builtins/explain.js +22 -8
- package/dist/src/func/builtins/explain.js.map +1 -1
- package/dist/src/func/builtins/generation.d.ts.map +1 -1
- package/dist/src/func/builtins/generation.js +26 -1
- package/dist/src/func/builtins/generation.js.map +1 -1
- package/dist/src/func/builtins/index.d.ts.map +1 -1
- package/dist/src/func/builtins/index.js +5 -1
- package/dist/src/func/builtins/index.js.map +1 -1
- package/dist/src/func/builtins/json-tvf.d.ts.map +1 -1
- package/dist/src/func/builtins/json-tvf.js +16 -2
- package/dist/src/func/builtins/json-tvf.js.map +1 -1
- package/dist/src/func/builtins/schema.d.ts +4 -0
- package/dist/src/func/builtins/schema.d.ts.map +1 -1
- package/dist/src/func/builtins/schema.js +270 -11
- package/dist/src/func/builtins/schema.js.map +1 -1
- package/dist/src/func/registration.d.ts +19 -1
- package/dist/src/func/registration.d.ts.map +1 -1
- package/dist/src/func/registration.js +8 -3
- package/dist/src/func/registration.js.map +1 -1
- package/dist/src/index.d.ts +7 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +5 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/parser/ast.d.ts +3 -2
- package/dist/src/parser/ast.d.ts.map +1 -1
- package/dist/src/parser/parser.d.ts.map +1 -1
- package/dist/src/parser/parser.js +25 -8
- package/dist/src/parser/parser.js.map +1 -1
- package/dist/src/planner/analysis/assertion-classifier.d.ts +71 -0
- package/dist/src/planner/analysis/assertion-classifier.d.ts.map +1 -0
- package/dist/src/planner/analysis/assertion-classifier.js +286 -0
- package/dist/src/planner/analysis/assertion-classifier.js.map +1 -0
- package/dist/src/planner/analysis/assertion-hoist-cache.d.ts +34 -0
- package/dist/src/planner/analysis/assertion-hoist-cache.d.ts.map +1 -0
- package/dist/src/planner/analysis/assertion-hoist-cache.js +119 -0
- package/dist/src/planner/analysis/assertion-hoist-cache.js.map +1 -0
- package/dist/src/planner/analysis/binding-extractor.d.ts +58 -0
- package/dist/src/planner/analysis/binding-extractor.d.ts.map +1 -0
- package/dist/src/planner/analysis/binding-extractor.js +110 -0
- package/dist/src/planner/analysis/binding-extractor.js.map +1 -0
- package/dist/src/planner/analysis/change-scope.d.ts +184 -0
- package/dist/src/planner/analysis/change-scope.d.ts.map +1 -0
- package/dist/src/planner/analysis/change-scope.js +825 -0
- package/dist/src/planner/analysis/change-scope.js.map +1 -0
- package/dist/src/planner/analysis/check-extraction.d.ts +29 -0
- package/dist/src/planner/analysis/check-extraction.d.ts.map +1 -0
- package/dist/src/planner/analysis/check-extraction.js +420 -0
- package/dist/src/planner/analysis/check-extraction.js.map +1 -0
- package/dist/src/planner/analysis/constraint-extractor.d.ts +47 -7
- package/dist/src/planner/analysis/constraint-extractor.d.ts.map +1 -1
- package/dist/src/planner/analysis/constraint-extractor.js +169 -92
- package/dist/src/planner/analysis/constraint-extractor.js.map +1 -1
- package/dist/src/planner/analysis/partial-unique-extraction.d.ts +68 -0
- package/dist/src/planner/analysis/partial-unique-extraction.d.ts.map +1 -0
- package/dist/src/planner/analysis/partial-unique-extraction.js +347 -0
- package/dist/src/planner/analysis/partial-unique-extraction.js.map +1 -0
- package/dist/src/planner/analysis/predicate-conjuncts.d.ts +14 -0
- package/dist/src/planner/analysis/predicate-conjuncts.d.ts.map +1 -0
- package/dist/src/planner/analysis/predicate-conjuncts.js +31 -0
- package/dist/src/planner/analysis/predicate-conjuncts.js.map +1 -0
- package/dist/src/planner/analysis/predicate-shape.d.ts +52 -0
- package/dist/src/planner/analysis/predicate-shape.d.ts.map +1 -0
- package/dist/src/planner/analysis/predicate-shape.js +119 -0
- package/dist/src/planner/analysis/predicate-shape.js.map +1 -0
- package/dist/src/planner/analysis/sat-checker.d.ts +43 -0
- package/dist/src/planner/analysis/sat-checker.d.ts.map +1 -0
- package/dist/src/planner/analysis/sat-checker.js +393 -0
- package/dist/src/planner/analysis/sat-checker.js.map +1 -0
- package/dist/src/planner/building/foreign-key-builder.d.ts.map +1 -1
- package/dist/src/planner/building/foreign-key-builder.js +3 -2
- package/dist/src/planner/building/foreign-key-builder.js.map +1 -1
- package/dist/src/planner/building/select.js +14 -2
- package/dist/src/planner/building/select.js.map +1 -1
- package/dist/src/planner/building/table.d.ts.map +1 -1
- package/dist/src/planner/building/table.js +1 -1
- package/dist/src/planner/building/table.js.map +1 -1
- package/dist/src/planner/building/update.d.ts.map +1 -1
- package/dist/src/planner/building/update.js +10 -6
- package/dist/src/planner/building/update.js.map +1 -1
- package/dist/src/planner/framework/characteristics.d.ts +13 -2
- package/dist/src/planner/framework/characteristics.d.ts.map +1 -1
- package/dist/src/planner/framework/characteristics.js +31 -5
- package/dist/src/planner/framework/characteristics.js.map +1 -1
- package/dist/src/planner/framework/pass.d.ts.map +1 -1
- package/dist/src/planner/framework/pass.js +46 -16
- package/dist/src/planner/framework/pass.js.map +1 -1
- package/dist/src/planner/framework/physical-utils.d.ts +21 -9
- package/dist/src/planner/framework/physical-utils.d.ts.map +1 -1
- package/dist/src/planner/framework/physical-utils.js +47 -31
- package/dist/src/planner/framework/physical-utils.js.map +1 -1
- package/dist/src/planner/nodes/aggregate-node.d.ts +25 -0
- package/dist/src/planner/nodes/aggregate-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/aggregate-node.js +75 -8
- package/dist/src/planner/nodes/aggregate-node.js.map +1 -1
- package/dist/src/planner/nodes/alias-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/alias-node.js +8 -1
- package/dist/src/planner/nodes/alias-node.js.map +1 -1
- package/dist/src/planner/nodes/asof-scan-node.d.ts +137 -0
- package/dist/src/planner/nodes/asof-scan-node.d.ts.map +1 -0
- package/dist/src/planner/nodes/asof-scan-node.js +237 -0
- package/dist/src/planner/nodes/asof-scan-node.js.map +1 -0
- package/dist/src/planner/nodes/bloom-join-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/bloom-join-node.js +19 -9
- package/dist/src/planner/nodes/bloom-join-node.js.map +1 -1
- package/dist/src/planner/nodes/constraint-check-node.d.ts +3 -0
- package/dist/src/planner/nodes/constraint-check-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/constraint-check-node.js.map +1 -1
- package/dist/src/planner/nodes/distinct-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/distinct-node.js +17 -6
- package/dist/src/planner/nodes/distinct-node.js.map +1 -1
- package/dist/src/planner/nodes/empty-relation-node.d.ts +27 -0
- package/dist/src/planner/nodes/empty-relation-node.d.ts.map +1 -0
- package/dist/src/planner/nodes/empty-relation-node.js +61 -0
- package/dist/src/planner/nodes/empty-relation-node.js.map +1 -0
- package/dist/src/planner/nodes/filter.d.ts.map +1 -1
- package/dist/src/planner/nodes/filter.js +67 -5
- package/dist/src/planner/nodes/filter.js.map +1 -1
- package/dist/src/planner/nodes/function.d.ts +11 -1
- package/dist/src/planner/nodes/function.d.ts.map +1 -1
- package/dist/src/planner/nodes/function.js +94 -1
- package/dist/src/planner/nodes/function.js.map +1 -1
- package/dist/src/planner/nodes/hash-aggregate.d.ts +1 -1
- package/dist/src/planner/nodes/hash-aggregate.d.ts.map +1 -1
- package/dist/src/planner/nodes/hash-aggregate.js +10 -6
- package/dist/src/planner/nodes/hash-aggregate.js.map +1 -1
- package/dist/src/planner/nodes/join-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/join-node.js +21 -10
- package/dist/src/planner/nodes/join-node.js.map +1 -1
- package/dist/src/planner/nodes/join-utils.d.ts +42 -1
- package/dist/src/planner/nodes/join-utils.d.ts.map +1 -1
- package/dist/src/planner/nodes/join-utils.js +132 -0
- package/dist/src/planner/nodes/join-utils.js.map +1 -1
- package/dist/src/planner/nodes/limit-offset.d.ts.map +1 -1
- package/dist/src/planner/nodes/limit-offset.js +8 -1
- package/dist/src/planner/nodes/limit-offset.js.map +1 -1
- package/dist/src/planner/nodes/merge-join-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/merge-join-node.js +22 -9
- package/dist/src/planner/nodes/merge-join-node.js.map +1 -1
- package/dist/src/planner/nodes/ordinal-slice-node.d.ts +50 -0
- package/dist/src/planner/nodes/ordinal-slice-node.d.ts.map +1 -0
- package/dist/src/planner/nodes/ordinal-slice-node.js +130 -0
- package/dist/src/planner/nodes/ordinal-slice-node.js.map +1 -0
- package/dist/src/planner/nodes/plan-node-type.d.ts +3 -0
- package/dist/src/planner/nodes/plan-node-type.d.ts.map +1 -1
- package/dist/src/planner/nodes/plan-node-type.js +3 -0
- package/dist/src/planner/nodes/plan-node-type.js.map +1 -1
- package/dist/src/planner/nodes/plan-node.d.ts +316 -5
- package/dist/src/planner/nodes/plan-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/plan-node.js +49 -0
- package/dist/src/planner/nodes/plan-node.js.map +1 -1
- package/dist/src/planner/nodes/project-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/project-node.js +78 -28
- package/dist/src/planner/nodes/project-node.js.map +1 -1
- package/dist/src/planner/nodes/reference.d.ts +27 -2
- package/dist/src/planner/nodes/reference.d.ts.map +1 -1
- package/dist/src/planner/nodes/reference.js +117 -1
- package/dist/src/planner/nodes/reference.js.map +1 -1
- package/dist/src/planner/nodes/retrieve-node.d.ts +9 -1
- package/dist/src/planner/nodes/retrieve-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/retrieve-node.js +21 -0
- package/dist/src/planner/nodes/retrieve-node.js.map +1 -1
- package/dist/src/planner/nodes/returning-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/returning-node.js +64 -28
- package/dist/src/planner/nodes/returning-node.js.map +1 -1
- package/dist/src/planner/nodes/scalar.d.ts +8 -1
- package/dist/src/planner/nodes/scalar.d.ts.map +1 -1
- package/dist/src/planner/nodes/scalar.js +112 -1
- package/dist/src/planner/nodes/scalar.js.map +1 -1
- package/dist/src/planner/nodes/set-operation-node.d.ts +2 -1
- package/dist/src/planner/nodes/set-operation-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/set-operation-node.js +24 -0
- package/dist/src/planner/nodes/set-operation-node.js.map +1 -1
- package/dist/src/planner/nodes/single-row.d.ts.map +1 -1
- package/dist/src/planner/nodes/single-row.js +3 -1
- package/dist/src/planner/nodes/single-row.js.map +1 -1
- package/dist/src/planner/nodes/sort.d.ts.map +1 -1
- package/dist/src/planner/nodes/sort.js +28 -1
- package/dist/src/planner/nodes/sort.js.map +1 -1
- package/dist/src/planner/nodes/stream-aggregate.d.ts +1 -1
- package/dist/src/planner/nodes/stream-aggregate.d.ts.map +1 -1
- package/dist/src/planner/nodes/stream-aggregate.js +10 -8
- package/dist/src/planner/nodes/stream-aggregate.js.map +1 -1
- package/dist/src/planner/nodes/table-access-nodes.d.ts +40 -5
- package/dist/src/planner/nodes/table-access-nodes.d.ts.map +1 -1
- package/dist/src/planner/nodes/table-access-nodes.js +113 -18
- package/dist/src/planner/nodes/table-access-nodes.js.map +1 -1
- package/dist/src/planner/nodes/table-function-call.d.ts +4 -1
- package/dist/src/planner/nodes/table-function-call.d.ts.map +1 -1
- package/dist/src/planner/nodes/table-function-call.js +224 -14
- package/dist/src/planner/nodes/table-function-call.js.map +1 -1
- package/dist/src/planner/nodes/update-node.d.ts +1 -3
- package/dist/src/planner/nodes/update-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/update-node.js +3 -9
- package/dist/src/planner/nodes/update-node.js.map +1 -1
- package/dist/src/planner/nodes/window-node.d.ts +61 -2
- package/dist/src/planner/nodes/window-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/window-node.js +71 -3
- package/dist/src/planner/nodes/window-node.js.map +1 -1
- package/dist/src/planner/optimizer-tuning.d.ts +38 -1
- package/dist/src/planner/optimizer-tuning.d.ts.map +1 -1
- package/dist/src/planner/optimizer-tuning.js +6 -0
- package/dist/src/planner/optimizer-tuning.js.map +1 -1
- package/dist/src/planner/optimizer.d.ts.map +1 -1
- package/dist/src/planner/optimizer.js +278 -0
- package/dist/src/planner/optimizer.js.map +1 -1
- package/dist/src/planner/rules/access/rule-asof-strategy-select.d.ts +30 -0
- package/dist/src/planner/rules/access/rule-asof-strategy-select.d.ts.map +1 -0
- package/dist/src/planner/rules/access/rule-asof-strategy-select.js +112 -0
- package/dist/src/planner/rules/access/rule-asof-strategy-select.js.map +1 -0
- package/dist/src/planner/rules/access/rule-monotonic-limit-pushdown.d.ts +33 -0
- package/dist/src/planner/rules/access/rule-monotonic-limit-pushdown.d.ts.map +1 -0
- package/dist/src/planner/rules/access/rule-monotonic-limit-pushdown.js +162 -0
- package/dist/src/planner/rules/access/rule-monotonic-limit-pushdown.js.map +1 -0
- package/dist/src/planner/rules/access/rule-monotonic-range-access.d.ts +29 -0
- package/dist/src/planner/rules/access/rule-monotonic-range-access.d.ts.map +1 -0
- package/dist/src/planner/rules/access/rule-monotonic-range-access.js +175 -0
- package/dist/src/planner/rules/access/rule-monotonic-range-access.js.map +1 -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 +53 -17
- package/dist/src/planner/rules/access/rule-select-access-path.js.map +1 -1
- package/dist/src/planner/rules/aggregate/rule-groupby-fd-simplification.d.ts +30 -0
- package/dist/src/planner/rules/aggregate/rule-groupby-fd-simplification.d.ts.map +1 -0
- package/dist/src/planner/rules/aggregate/rule-groupby-fd-simplification.js +116 -0
- package/dist/src/planner/rules/aggregate/rule-groupby-fd-simplification.js.map +1 -0
- package/dist/src/planner/rules/distinct/rule-distinct-elimination.d.ts +7 -7
- package/dist/src/planner/rules/distinct/rule-distinct-elimination.d.ts.map +1 -1
- package/dist/src/planner/rules/distinct/rule-distinct-elimination.js +18 -16
- package/dist/src/planner/rules/distinct/rule-distinct-elimination.js.map +1 -1
- package/dist/src/planner/rules/join/equi-pair-extractor.d.ts +61 -0
- package/dist/src/planner/rules/join/equi-pair-extractor.d.ts.map +1 -0
- package/dist/src/planner/rules/join/equi-pair-extractor.js +155 -0
- package/dist/src/planner/rules/join/equi-pair-extractor.js.map +1 -0
- package/dist/src/planner/rules/join/rule-join-elimination.d.ts +56 -0
- package/dist/src/planner/rules/join/rule-join-elimination.d.ts.map +1 -0
- package/dist/src/planner/rules/join/rule-join-elimination.js +326 -0
- package/dist/src/planner/rules/join/rule-join-elimination.js.map +1 -0
- package/dist/src/planner/rules/join/rule-join-greedy-commute.d.ts.map +1 -1
- package/dist/src/planner/rules/join/rule-join-greedy-commute.js +10 -2
- package/dist/src/planner/rules/join/rule-join-greedy-commute.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 +2 -122
- package/dist/src/planner/rules/join/rule-join-physical-selection.js.map +1 -1
- package/dist/src/planner/rules/join/rule-lateral-top1-asof.d.ts +21 -0
- package/dist/src/planner/rules/join/rule-lateral-top1-asof.d.ts.map +1 -0
- package/dist/src/planner/rules/join/rule-lateral-top1-asof.js +405 -0
- package/dist/src/planner/rules/join/rule-lateral-top1-asof.js.map +1 -0
- package/dist/src/planner/rules/join/rule-monotonic-merge-join.d.ts +31 -0
- package/dist/src/planner/rules/join/rule-monotonic-merge-join.d.ts.map +1 -0
- package/dist/src/planner/rules/join/rule-monotonic-merge-join.js +113 -0
- package/dist/src/planner/rules/join/rule-monotonic-merge-join.js.map +1 -0
- package/dist/src/planner/rules/predicate/rule-aggregate-predicate-pushdown.d.ts +20 -0
- package/dist/src/planner/rules/predicate/rule-aggregate-predicate-pushdown.d.ts.map +1 -0
- package/dist/src/planner/rules/predicate/rule-aggregate-predicate-pushdown.js +181 -0
- package/dist/src/planner/rules/predicate/rule-aggregate-predicate-pushdown.js.map +1 -0
- package/dist/src/planner/rules/predicate/rule-empty-relation-folding.d.ts +46 -0
- package/dist/src/planner/rules/predicate/rule-empty-relation-folding.d.ts.map +1 -0
- package/dist/src/planner/rules/predicate/rule-empty-relation-folding.js +156 -0
- package/dist/src/planner/rules/predicate/rule-empty-relation-folding.js.map +1 -0
- package/dist/src/planner/rules/predicate/rule-filter-contradiction.d.ts +30 -0
- package/dist/src/planner/rules/predicate/rule-filter-contradiction.d.ts.map +1 -0
- package/dist/src/planner/rules/predicate/rule-filter-contradiction.js +60 -0
- package/dist/src/planner/rules/predicate/rule-filter-contradiction.js.map +1 -0
- package/dist/src/planner/rules/predicate/rule-predicate-inference-equivalence.d.ts +45 -0
- package/dist/src/planner/rules/predicate/rule-predicate-inference-equivalence.d.ts.map +1 -0
- package/dist/src/planner/rules/predicate/rule-predicate-inference-equivalence.js +210 -0
- package/dist/src/planner/rules/predicate/rule-predicate-inference-equivalence.js.map +1 -0
- package/dist/src/planner/rules/predicate/rule-sargable-range-rewrite.d.ts +29 -0
- package/dist/src/planner/rules/predicate/rule-sargable-range-rewrite.d.ts.map +1 -0
- package/dist/src/planner/rules/predicate/rule-sargable-range-rewrite.js +161 -0
- package/dist/src/planner/rules/predicate/rule-sargable-range-rewrite.js.map +1 -0
- package/dist/src/planner/rules/sort/rule-orderby-fd-pruning.d.ts +39 -0
- package/dist/src/planner/rules/sort/rule-orderby-fd-pruning.d.ts.map +1 -0
- package/dist/src/planner/rules/sort/rule-orderby-fd-pruning.js +91 -0
- package/dist/src/planner/rules/sort/rule-orderby-fd-pruning.js.map +1 -0
- package/dist/src/planner/rules/subquery/rule-anti-join-fk-empty.d.ts +35 -0
- package/dist/src/planner/rules/subquery/rule-anti-join-fk-empty.d.ts.map +1 -0
- package/dist/src/planner/rules/subquery/rule-anti-join-fk-empty.js +74 -0
- package/dist/src/planner/rules/subquery/rule-anti-join-fk-empty.js.map +1 -0
- package/dist/src/planner/rules/subquery/rule-semi-join-fk-trivial.d.ts +27 -0
- package/dist/src/planner/rules/subquery/rule-semi-join-fk-trivial.d.ts.map +1 -0
- package/dist/src/planner/rules/subquery/rule-semi-join-fk-trivial.js +103 -0
- package/dist/src/planner/rules/subquery/rule-semi-join-fk-trivial.js.map +1 -0
- package/dist/src/planner/rules/subquery/rule-subquery-decorrelation.d.ts.map +1 -1
- package/dist/src/planner/rules/subquery/rule-subquery-decorrelation.js +1 -25
- package/dist/src/planner/rules/subquery/rule-subquery-decorrelation.js.map +1 -1
- package/dist/src/planner/rules/window/rule-monotonic-window.d.ts +47 -0
- package/dist/src/planner/rules/window/rule-monotonic-window.d.ts.map +1 -0
- package/dist/src/planner/rules/window/rule-monotonic-window.js +341 -0
- package/dist/src/planner/rules/window/rule-monotonic-window.js.map +1 -0
- package/dist/src/planner/scopes/global.js +2 -2
- package/dist/src/planner/scopes/global.js.map +1 -1
- package/dist/src/planner/type-utils.d.ts.map +1 -1
- package/dist/src/planner/type-utils.js +11 -0
- package/dist/src/planner/type-utils.js.map +1 -1
- package/dist/src/planner/util/fd-utils.d.ts +245 -0
- package/dist/src/planner/util/fd-utils.d.ts.map +1 -0
- package/dist/src/planner/util/fd-utils.js +1416 -0
- package/dist/src/planner/util/fd-utils.js.map +1 -0
- package/dist/src/planner/util/ind-utils.d.ts +79 -0
- package/dist/src/planner/util/ind-utils.d.ts.map +1 -0
- package/dist/src/planner/util/ind-utils.js +146 -0
- package/dist/src/planner/util/ind-utils.js.map +1 -0
- package/dist/src/planner/util/key-utils.d.ts +75 -14
- package/dist/src/planner/util/key-utils.d.ts.map +1 -1
- package/dist/src/planner/util/key-utils.js +234 -57
- package/dist/src/planner/util/key-utils.js.map +1 -1
- package/dist/src/runtime/context-helpers.d.ts +9 -0
- package/dist/src/runtime/context-helpers.d.ts.map +1 -1
- package/dist/src/runtime/context-helpers.js +5 -0
- package/dist/src/runtime/context-helpers.js.map +1 -1
- package/dist/src/runtime/delta-executor.d.ts +134 -0
- package/dist/src/runtime/delta-executor.d.ts.map +1 -0
- package/dist/src/runtime/delta-executor.js +382 -0
- package/dist/src/runtime/delta-executor.js.map +1 -0
- package/dist/src/runtime/emit/alter-table.d.ts.map +1 -1
- package/dist/src/runtime/emit/alter-table.js +52 -16
- package/dist/src/runtime/emit/alter-table.js.map +1 -1
- package/dist/src/runtime/emit/asof-scan.d.ts +10 -0
- package/dist/src/runtime/emit/asof-scan.d.ts.map +1 -0
- package/dist/src/runtime/emit/asof-scan.js +467 -0
- package/dist/src/runtime/emit/asof-scan.js.map +1 -0
- package/dist/src/runtime/emit/constraint-check.d.ts.map +1 -1
- package/dist/src/runtime/emit/constraint-check.js +20 -0
- package/dist/src/runtime/emit/constraint-check.js.map +1 -1
- package/dist/src/runtime/emit/create-assertion.d.ts.map +1 -1
- package/dist/src/runtime/emit/create-assertion.js +3 -2
- package/dist/src/runtime/emit/create-assertion.js.map +1 -1
- package/dist/src/runtime/emit/dml-executor.d.ts.map +1 -1
- package/dist/src/runtime/emit/dml-executor.js +40 -13
- package/dist/src/runtime/emit/dml-executor.js.map +1 -1
- package/dist/src/runtime/emit/drop-assertion.js +1 -1
- package/dist/src/runtime/emit/drop-assertion.js.map +1 -1
- package/dist/src/runtime/emit/empty-relation.d.ts +5 -0
- package/dist/src/runtime/emit/empty-relation.d.ts.map +1 -0
- package/dist/src/runtime/emit/empty-relation.js +11 -0
- package/dist/src/runtime/emit/empty-relation.js.map +1 -0
- package/dist/src/runtime/emit/ordinal-slice.d.ts +13 -0
- package/dist/src/runtime/emit/ordinal-slice.d.ts.map +1 -0
- package/dist/src/runtime/emit/ordinal-slice.js +89 -0
- package/dist/src/runtime/emit/ordinal-slice.js.map +1 -0
- package/dist/src/runtime/emit/returning.d.ts.map +1 -1
- package/dist/src/runtime/emit/returning.js +9 -4
- package/dist/src/runtime/emit/returning.js.map +1 -1
- package/dist/src/runtime/emit/scan.d.ts +19 -3
- package/dist/src/runtime/emit/scan.d.ts.map +1 -1
- package/dist/src/runtime/emit/scan.js +12 -8
- package/dist/src/runtime/emit/scan.js.map +1 -1
- package/dist/src/runtime/emit/schema-declarative.d.ts.map +1 -1
- package/dist/src/runtime/emit/schema-declarative.js +91 -14
- package/dist/src/runtime/emit/schema-declarative.js.map +1 -1
- package/dist/src/runtime/emit/window.d.ts.map +1 -1
- package/dist/src/runtime/emit/window.js +732 -37
- package/dist/src/runtime/emit/window.js.map +1 -1
- package/dist/src/runtime/foreign-key-actions.d.ts +16 -0
- package/dist/src/runtime/foreign-key-actions.d.ts.map +1 -1
- package/dist/src/runtime/foreign-key-actions.js +86 -5
- package/dist/src/runtime/foreign-key-actions.js.map +1 -1
- package/dist/src/runtime/register.d.ts.map +1 -1
- package/dist/src/runtime/register.js +6 -0
- package/dist/src/runtime/register.js.map +1 -1
- package/dist/src/schema/assertion.d.ts +8 -0
- package/dist/src/schema/assertion.d.ts.map +1 -1
- package/dist/src/schema/catalog.d.ts +10 -0
- package/dist/src/schema/catalog.d.ts.map +1 -1
- package/dist/src/schema/catalog.js +29 -6
- package/dist/src/schema/catalog.js.map +1 -1
- package/dist/src/schema/change-events.d.ts +5 -1
- package/dist/src/schema/change-events.d.ts.map +1 -1
- package/dist/src/schema/change-events.js.map +1 -1
- package/dist/src/schema/function.d.ts +89 -1
- package/dist/src/schema/function.d.ts.map +1 -1
- package/dist/src/schema/function.js +31 -0
- package/dist/src/schema/function.js.map +1 -1
- package/dist/src/schema/manager.d.ts +43 -0
- package/dist/src/schema/manager.d.ts.map +1 -1
- package/dist/src/schema/manager.js +105 -4
- package/dist/src/schema/manager.js.map +1 -1
- package/dist/src/schema/rename-rewriter.d.ts.map +1 -1
- package/dist/src/schema/rename-rewriter.js +303 -102
- package/dist/src/schema/rename-rewriter.js.map +1 -1
- package/dist/src/schema/schema-differ.d.ts +18 -1
- package/dist/src/schema/schema-differ.d.ts.map +1 -1
- package/dist/src/schema/schema-differ.js +307 -42
- package/dist/src/schema/schema-differ.js.map +1 -1
- package/dist/src/schema/table.d.ts +21 -2
- package/dist/src/schema/table.d.ts.map +1 -1
- package/dist/src/schema/table.js +17 -8
- package/dist/src/schema/table.js.map +1 -1
- package/dist/src/types/logical-type.d.ts +11 -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 +32 -0
- package/dist/src/types/temporal-types.js.map +1 -1
- package/dist/src/util/ast-literal.d.ts +11 -0
- package/dist/src/util/ast-literal.d.ts.map +1 -0
- package/dist/src/util/ast-literal.js +26 -0
- package/dist/src/util/ast-literal.js.map +1 -0
- package/dist/src/vtab/best-access-plan.d.ts +41 -0
- package/dist/src/vtab/best-access-plan.d.ts.map +1 -1
- package/dist/src/vtab/best-access-plan.js +29 -0
- package/dist/src/vtab/best-access-plan.js.map +1 -1
- package/dist/src/vtab/events.d.ts +9 -0
- package/dist/src/vtab/events.d.ts.map +1 -1
- package/dist/src/vtab/events.js +19 -0
- package/dist/src/vtab/events.js.map +1 -1
- package/dist/src/vtab/filter-info.d.ts +14 -0
- package/dist/src/vtab/filter-info.d.ts.map +1 -1
- package/dist/src/vtab/memory/layer/manager.d.ts.map +1 -1
- package/dist/src/vtab/memory/layer/manager.js +24 -5
- package/dist/src/vtab/memory/layer/manager.js.map +1 -1
- package/dist/src/vtab/memory/module.d.ts +39 -1
- package/dist/src/vtab/memory/module.d.ts.map +1 -1
- package/dist/src/vtab/memory/module.js +206 -44
- package/dist/src/vtab/memory/module.js.map +1 -1
- package/dist/src/vtab/memory/utils/predicate.d.ts +2 -1
- package/dist/src/vtab/memory/utils/predicate.d.ts.map +1 -1
- package/dist/src/vtab/memory/utils/predicate.js +32 -1
- package/dist/src/vtab/memory/utils/predicate.js.map +1 -1
- package/dist/src/vtab/module.d.ts +24 -0
- package/dist/src/vtab/module.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -2,7 +2,179 @@ import { PlanNodeType } from './plan-node-type.js';
|
|
|
2
2
|
import type { Scope } from '../scopes/scope.js';
|
|
3
3
|
import type { BaseType, RelationType, ScalarType } from '../../common/datatype.js';
|
|
4
4
|
import type { Expression } from '../../parser/ast.js';
|
|
5
|
-
import type { OutputValue, Row } from '../../common/types.js';
|
|
5
|
+
import type { OutputValue, Row, SqlValue } from '../../common/types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Information about an attribute the relation is monotonically ordered on.
|
|
8
|
+
* Stronger than `ordering`: meaningful only for total-order-preserving sources
|
|
9
|
+
* (vtab access plans that advertise it; sort nodes; certain merge operators)
|
|
10
|
+
* and survives only the propagation rules documented in characteristics.ts.
|
|
11
|
+
*/
|
|
12
|
+
export interface MonotonicOnInfo {
|
|
13
|
+
/** Attribute over which the relation is ordered. Stable across plan transformations. */
|
|
14
|
+
readonly attrId: number;
|
|
15
|
+
/** True iff the relation guarantees no two rows share the value of attrId. */
|
|
16
|
+
readonly strict: boolean;
|
|
17
|
+
/** Direction; default 'asc'. */
|
|
18
|
+
readonly direction: 'asc' | 'desc';
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A functional dependency on a relational node's output columns: when the
|
|
22
|
+
* values of `determinants` are fixed, the values of `dependents` are also
|
|
23
|
+
* fixed for every row.
|
|
24
|
+
*
|
|
25
|
+
* Column indices are output-column indices.
|
|
26
|
+
*
|
|
27
|
+
* - `determinants` empty means "constant": the dependents take a single value
|
|
28
|
+
* for every row in the relation. An FD `∅ → all_cols` is the canonical
|
|
29
|
+
* marker for an "at-most-one-row" relation.
|
|
30
|
+
* - A unique key `K` is encoded as the FD `K → (all_cols \ K)`. Consumers ask
|
|
31
|
+
* "is K a superkey?" via `isSuperkey(K, fds, columnCount)` from
|
|
32
|
+
* `planner/util/fd-utils.ts`.
|
|
33
|
+
* - The set is non-canonical — only the FDs each operator can prove are
|
|
34
|
+
* stored. Use `computeClosure` to derive what a set of attributes implies.
|
|
35
|
+
* - The full-relation case (`K = all_cols`, i.e. set semantics with no smaller
|
|
36
|
+
* discoverable key) is communicated via `RelationType.isSet`, not an FD.
|
|
37
|
+
* - `guard`, when present, restricts the FD to predicates that entail every
|
|
38
|
+
* clause in the conjunction. A guarded FD never participates in closure;
|
|
39
|
+
* `FilterNode` activates it (strips the guard) when its predicate implies
|
|
40
|
+
* the guard, after which it propagates as an ordinary unconditional FD.
|
|
41
|
+
*/
|
|
42
|
+
export interface FunctionalDependency {
|
|
43
|
+
/** Determinant column indices in the node's output. Empty array means "constant" (no row variation). */
|
|
44
|
+
readonly determinants: readonly number[];
|
|
45
|
+
/** Dependent column indices in the node's output. Non-empty. */
|
|
46
|
+
readonly dependents: readonly number[];
|
|
47
|
+
/** When defined, the FD only activates if a surrounding predicate entails every clause. */
|
|
48
|
+
readonly guard?: GuardPredicate;
|
|
49
|
+
/** Optional provenance tag — informational for diagnostics, ignored by dedup. */
|
|
50
|
+
readonly source?: ConstraintProvenance;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Origin of an inferred constraint (FD / binding / domain). Optional and
|
|
54
|
+
* informational — dedup helpers in `fd-utils.ts` compare structural fields
|
|
55
|
+
* only, so identical constraints from different sources collapse to one and
|
|
56
|
+
* the kept entry's provenance is whichever was merged first. When a declared
|
|
57
|
+
* CHECK and a hoisted assertion produce structurally-identical contributions,
|
|
58
|
+
* the table reference merges declared-check facts first, so `declared-check`
|
|
59
|
+
* wins.
|
|
60
|
+
*/
|
|
61
|
+
export interface ConstraintProvenance {
|
|
62
|
+
readonly kind: 'declared-check' | 'assertion';
|
|
63
|
+
/** Lowercased assertion name when kind === 'assertion'. */
|
|
64
|
+
readonly name?: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Predicate guarding a conditional functional dependency. All clauses must be
|
|
68
|
+
* entailed by the surrounding predicate (conjunctively) before the guarded FD
|
|
69
|
+
* activates.
|
|
70
|
+
*/
|
|
71
|
+
export interface GuardPredicate {
|
|
72
|
+
readonly clauses: readonly GuardClause[];
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Narrow guard-clause vocabulary recognized by predicate-implies-guard
|
|
76
|
+
* checking. Each shape is something `extractEqualityFds` / EC / binding layers
|
|
77
|
+
* can already reason about, so activation is a structural check.
|
|
78
|
+
*
|
|
79
|
+
* Shapes:
|
|
80
|
+
* - `eq-literal` / `eq-column` / `is-null` — equality and null-test atoms.
|
|
81
|
+
* - `range` — open or closed interval on one column, matching `DomainConstraint`
|
|
82
|
+
* range shape. Inclusivity flags for absent bounds are unobservable but
|
|
83
|
+
* stored conservatively as `false`. Discharge subsumption ("filter ⊆ guard")
|
|
84
|
+
* is via per-side bound comparison.
|
|
85
|
+
* - `or-of` — flat disjunction of the other shapes; recognizers flatten nested
|
|
86
|
+
* `or-of` clauses at construction time so a sub-clause is never itself an
|
|
87
|
+
* `or-of`.
|
|
88
|
+
*
|
|
89
|
+
* `IN (lit, ...)` and `NOT col` shapes are pre-normalized at recognition time
|
|
90
|
+
* into the same vocabulary (IN-list → `or-of [eq-literal]`, `NOT col` →
|
|
91
|
+
* `eq-literal { col, value: 0 }`).
|
|
92
|
+
*/
|
|
93
|
+
export type GuardClause = {
|
|
94
|
+
readonly kind: 'eq-literal';
|
|
95
|
+
readonly column: number;
|
|
96
|
+
readonly value: SqlValue;
|
|
97
|
+
} | {
|
|
98
|
+
readonly kind: 'eq-column';
|
|
99
|
+
readonly left: number;
|
|
100
|
+
readonly right: number;
|
|
101
|
+
} | {
|
|
102
|
+
readonly kind: 'is-null';
|
|
103
|
+
readonly column: number;
|
|
104
|
+
readonly negated: boolean;
|
|
105
|
+
} | {
|
|
106
|
+
readonly kind: 'range';
|
|
107
|
+
readonly column: number;
|
|
108
|
+
readonly min?: SqlValue;
|
|
109
|
+
readonly max?: SqlValue;
|
|
110
|
+
readonly minInclusive: boolean;
|
|
111
|
+
readonly maxInclusive: boolean;
|
|
112
|
+
} | {
|
|
113
|
+
readonly kind: 'or-of';
|
|
114
|
+
readonly clauses: readonly GuardClause[];
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* A pinned-constant value associated with a `ConstantBinding`. Either a
|
|
118
|
+
* compile-time literal `SqlValue`, or a bound parameter identified by
|
|
119
|
+
* `paramRef` (numeric 1-based index for `?`, string name for `:foo`-style).
|
|
120
|
+
*/
|
|
121
|
+
export type ConstantValue = {
|
|
122
|
+
readonly kind: 'literal';
|
|
123
|
+
readonly value: SqlValue;
|
|
124
|
+
} | {
|
|
125
|
+
readonly kind: 'parameter';
|
|
126
|
+
readonly paramRef: string | number;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Output columns pinned to a single value across every row of one execution.
|
|
130
|
+
* Companion to `∅ → col` FDs: that FD records *that* a column is constant,
|
|
131
|
+
* while a `ConstantBinding` additionally records *what value* it is pinned
|
|
132
|
+
* to. Downstream rules (predicate inference through ECs, ordering pruning)
|
|
133
|
+
* consume bindings directly instead of re-walking predicate ASTs.
|
|
134
|
+
*/
|
|
135
|
+
export interface ConstantBinding {
|
|
136
|
+
/** Output column indices pinned to `value`. */
|
|
137
|
+
readonly attrs: readonly number[];
|
|
138
|
+
readonly value: ConstantValue;
|
|
139
|
+
/** Optional provenance tag — informational, ignored by dedup. */
|
|
140
|
+
readonly source?: ConstraintProvenance;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* A bound on the values a single output column can take across every row of one
|
|
144
|
+
* execution. Sourced from declared CHECK constraints at the table reference and
|
|
145
|
+
* propagated like FDs/ECs/bindings — see `planner/util/fd-utils.ts` for the
|
|
146
|
+
* merge/project/shift helpers.
|
|
147
|
+
*
|
|
148
|
+
* - `range`: an open or closed interval. `min`/`max` are absent for unbounded
|
|
149
|
+
* sides; `minInclusive`/`maxInclusive` are ignored when the corresponding
|
|
150
|
+
* bound is absent.
|
|
151
|
+
* - `enum`: a finite set of allowed values.
|
|
152
|
+
*
|
|
153
|
+
* Multiple constraints may exist on the same column (and even on the same kind)
|
|
154
|
+
* — intersection is deferred to the predicate-contradiction-detection ticket.
|
|
155
|
+
*/
|
|
156
|
+
export type DomainConstraint = {
|
|
157
|
+
readonly kind: 'range';
|
|
158
|
+
/** Output column index. */
|
|
159
|
+
readonly column: number;
|
|
160
|
+
/** Lower bound, when known. */
|
|
161
|
+
readonly min?: SqlValue;
|
|
162
|
+
/** Upper bound, when known. */
|
|
163
|
+
readonly max?: SqlValue;
|
|
164
|
+
/** Lower bound is inclusive. Ignored when `min` is absent. */
|
|
165
|
+
readonly minInclusive: boolean;
|
|
166
|
+
/** Upper bound is inclusive. Ignored when `max` is absent. */
|
|
167
|
+
readonly maxInclusive: boolean;
|
|
168
|
+
/** Optional provenance tag — informational, ignored by dedup. */
|
|
169
|
+
readonly source?: ConstraintProvenance;
|
|
170
|
+
} | {
|
|
171
|
+
readonly kind: 'enum';
|
|
172
|
+
/** Output column index. */
|
|
173
|
+
readonly column: number;
|
|
174
|
+
readonly values: ReadonlyArray<SqlValue>;
|
|
175
|
+
/** Optional provenance tag — informational, ignored by dedup. */
|
|
176
|
+
readonly source?: ConstraintProvenance;
|
|
177
|
+
};
|
|
6
178
|
/**
|
|
7
179
|
* Physical properties that execution nodes can provide or require
|
|
8
180
|
*/
|
|
@@ -15,11 +187,83 @@ export interface PhysicalProperties {
|
|
|
15
187
|
/** Estimated number of rows this node will produce */
|
|
16
188
|
estimatedRows?: number;
|
|
17
189
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
190
|
+
* Functional dependencies that hold over the output stream. The canonical
|
|
191
|
+
* representation of "what determines what" — unique keys are encoded as
|
|
192
|
+
* FDs `K → (all_cols \ K)`, and `∅ → all_cols` encodes "at-most-one-row".
|
|
193
|
+
* Use `computeClosure` / `isSuperkey` / `hasAnyKey` / `hasSingletonFd`
|
|
194
|
+
* from `planner/util/fd-utils.ts` to query them.
|
|
195
|
+
*/
|
|
196
|
+
fds?: ReadonlyArray<FunctionalDependency>;
|
|
197
|
+
/**
|
|
198
|
+
* Equivalence classes over the node's output columns. Each class is a set
|
|
199
|
+
* of column indices known to hold equal values for every row. Derived from
|
|
200
|
+
* equality predicates and equi-join conditions.
|
|
201
|
+
*/
|
|
202
|
+
equivClasses?: ReadonlyArray<ReadonlyArray<number>>;
|
|
203
|
+
/**
|
|
204
|
+
* Output columns pinned to a known constant value within a single execution.
|
|
205
|
+
* Mirrors `∅ → col` FDs but carries the *value* so downstream rules
|
|
206
|
+
* (predicate inference, ordering pruning) can rewrite predicates without
|
|
207
|
+
* re-walking the source predicate AST. Parameters (`?` / `:foo`) count as
|
|
208
|
+
* constants here because they are bound once before iteration.
|
|
21
209
|
*/
|
|
22
|
-
|
|
210
|
+
constantBindings?: ReadonlyArray<ConstantBinding>;
|
|
211
|
+
/**
|
|
212
|
+
* Per-column value bounds (range or enum) provable for every row in the
|
|
213
|
+
* stream. Sourced from declared CHECK constraints at the table reference and
|
|
214
|
+
* propagated through unary/binary operators using the same projection rules
|
|
215
|
+
* as FDs/ECs/bindings. Multiple constraints on the same column may coexist;
|
|
216
|
+
* intersection across constraints is deferred to a follow-up ticket.
|
|
217
|
+
*/
|
|
218
|
+
domainConstraints?: ReadonlyArray<DomainConstraint>;
|
|
219
|
+
/**
|
|
220
|
+
* Attributes the relation is monotonically ordered on. Stronger than `ordering`:
|
|
221
|
+
* meaningful only for total-order-preserving sources (vtab access plans that
|
|
222
|
+
* advertise it; sort nodes; certain merge operators) and survives only the
|
|
223
|
+
* propagation rules documented in characteristics.ts.
|
|
224
|
+
*
|
|
225
|
+
* `monotonicOn` strictly implies `ordering` on the same attribute in the same
|
|
226
|
+
* direction; nodes are permitted (not required) to populate one from the other.
|
|
227
|
+
*/
|
|
228
|
+
monotonicOn?: readonly MonotonicOnInfo[];
|
|
229
|
+
/**
|
|
230
|
+
* Capability flags advertised by the underlying access path. Unlike
|
|
231
|
+
* `monotonicOn`, these are not relational characteristics — they describe
|
|
232
|
+
* what the access path's iterator can be driven to do (ordinal seek for
|
|
233
|
+
* pushed-down LIMIT/OFFSET, forward-only repositioning for asof joins).
|
|
234
|
+
*
|
|
235
|
+
* These survive only on the physical leaf node where the access plan was
|
|
236
|
+
* resolved. Single-input pass-through nodes (Filter, LimitOffset, Alias,
|
|
237
|
+
* etc.) MUST NOT propagate these — once another operator sits between the
|
|
238
|
+
* vtab leaf and the consumer, the leaf's iterator is no longer the
|
|
239
|
+
* consumer's iterator.
|
|
240
|
+
*/
|
|
241
|
+
accessCapabilities?: {
|
|
242
|
+
/** Path supports O(log N) seek to the kth monotonic row. Implies monotonicOn. */
|
|
243
|
+
ordinalSeek?: boolean;
|
|
244
|
+
/** Path can be driven as the right side of a streaming asof join. Implies monotonicOn. */
|
|
245
|
+
asofRight?: boolean;
|
|
246
|
+
};
|
|
247
|
+
/**
|
|
248
|
+
* Symbolic range bound that downstream rules / EXPLAIN can read off. Set by
|
|
249
|
+
* rule-monotonic-range-access on physical leaves whose access plan walks a
|
|
250
|
+
* MonotonicOn(x) path bounded by a recognized range predicate on x. The
|
|
251
|
+
* lower/upper fields are absent for unbounded sides (half-open ranges).
|
|
252
|
+
*
|
|
253
|
+
* Non-relational: lives on the physical leaf where the access plan was
|
|
254
|
+
* resolved. Pass-through nodes do NOT propagate it.
|
|
255
|
+
*/
|
|
256
|
+
rangeBoundedOn?: {
|
|
257
|
+
attrId: number;
|
|
258
|
+
lower?: {
|
|
259
|
+
op: '>=' | '>';
|
|
260
|
+
valueLiteral?: SqlValue;
|
|
261
|
+
};
|
|
262
|
+
upper?: {
|
|
263
|
+
op: '<=' | '<';
|
|
264
|
+
valueLiteral?: SqlValue;
|
|
265
|
+
};
|
|
266
|
+
};
|
|
23
267
|
/**
|
|
24
268
|
* Whether this node is read-only (does not mutate external state).
|
|
25
269
|
* false = has side effects, true = pure/read-only
|
|
@@ -46,6 +290,47 @@ export interface PhysicalProperties {
|
|
|
46
290
|
* Default physical properties for plan nodes
|
|
47
291
|
*/
|
|
48
292
|
export declare const DEFAULT_PHYSICAL: PhysicalProperties;
|
|
293
|
+
/**
|
|
294
|
+
* Monotonicity of a scalar expression with respect to a given input attribute.
|
|
295
|
+
* Direction is "as the attribute's value increases, what happens to the expression":
|
|
296
|
+
* - 'increasing' — strictly non-decreasing (compatible with `asc` ordering)
|
|
297
|
+
* - 'decreasing' — strictly non-increasing
|
|
298
|
+
* - 'constant' — does not depend on the attribute (flat in attrId)
|
|
299
|
+
* - 'non_monotone' — depends on the attribute but provably not monotone
|
|
300
|
+
* - 'unknown' — cannot prove a property; safe default
|
|
301
|
+
*
|
|
302
|
+
* Other inputs are held constant when reasoning about monotonicity in attrId.
|
|
303
|
+
*/
|
|
304
|
+
export type Monotonicity = 'increasing' | 'decreasing' | 'constant' | 'non_monotone' | 'unknown';
|
|
305
|
+
export interface InjectivityResult {
|
|
306
|
+
/** True iff distinct values of the input attribute always produce distinct expression values
|
|
307
|
+
* (with all other inputs held constant). */
|
|
308
|
+
readonly injective: boolean;
|
|
309
|
+
/** Optional explanation for diagnostics. */
|
|
310
|
+
readonly reason?: string;
|
|
311
|
+
}
|
|
312
|
+
export interface MonotonicityResult {
|
|
313
|
+
readonly monotonicity: Monotonicity;
|
|
314
|
+
readonly reason?: string;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Equivalent half-open range on input x for a predicate `f(x) op c` where f is
|
|
318
|
+
* monotone but lossy (e.g. `f(x) = date(x); f(x) = D` corresponds to a
|
|
319
|
+
* one-day half-open range on x). `lowerInclusive ≤ x < upperExclusive`.
|
|
320
|
+
*
|
|
321
|
+
* The boundary computation is type-driven; see LogicalType.bucketBounds.
|
|
322
|
+
*/
|
|
323
|
+
export interface RangeRewrite {
|
|
324
|
+
readonly lowerInclusive: SqlValue;
|
|
325
|
+
readonly upperExclusive: SqlValue;
|
|
326
|
+
}
|
|
327
|
+
/** Conservative defaults for the scalar property surface. Exposed for tests / consumers. */
|
|
328
|
+
export declare const DEFAULT_INJECTIVITY: InjectivityResult;
|
|
329
|
+
export declare const DEFAULT_MONOTONICITY: MonotonicityResult;
|
|
330
|
+
/** Negate (flip) a monotonicity direction; constant/non_monotone/unknown pass through unchanged. */
|
|
331
|
+
export declare function negateMonotonicity(m: Monotonicity): Monotonicity;
|
|
332
|
+
/** Combine monotonicities for `a + b` (addition rules). */
|
|
333
|
+
export declare function addMonotonicity(a: Monotonicity, b: Monotonicity): Monotonicity;
|
|
49
334
|
/**
|
|
50
335
|
* Represents a column with a unique identifier that persists across plan transformations
|
|
51
336
|
*/
|
|
@@ -131,6 +416,24 @@ export declare abstract class PlanNode {
|
|
|
131
416
|
* Override to provide node-specific logical information.
|
|
132
417
|
*/
|
|
133
418
|
getLogicalAttributes(): Record<string, unknown>;
|
|
419
|
+
/**
|
|
420
|
+
* Is this scalar expression injective in the given input attribute?
|
|
421
|
+
* Default is the conservative "no" — only meaningful for ScalarPlanNode subclasses
|
|
422
|
+
* that override. Other inputs are assumed held constant when reasoning.
|
|
423
|
+
*/
|
|
424
|
+
isInjectiveIn(_inputAttrId: number): InjectivityResult;
|
|
425
|
+
/**
|
|
426
|
+
* Monotonicity of this scalar expression in the given input attribute, with
|
|
427
|
+
* other inputs held constant. Default is the conservative 'unknown'.
|
|
428
|
+
*/
|
|
429
|
+
monotonicityIn(_inputAttrId: number): MonotonicityResult;
|
|
430
|
+
/**
|
|
431
|
+
* For monotone-but-lossy scalar transforms only: given a constant `c` from a
|
|
432
|
+
* predicate `f(x) op c`, return the equivalent half-open range on x. Return
|
|
433
|
+
* undefined when not applicable / unsafe. Implementations must be consistent
|
|
434
|
+
* with `monotonicityIn`.
|
|
435
|
+
*/
|
|
436
|
+
rangeRewriteIn(_inputAttrId: number, _constant: SqlValue): RangeRewrite | undefined;
|
|
134
437
|
/** Infer and cache the physical properties of this node */
|
|
135
438
|
get physical(): PhysicalProperties;
|
|
136
439
|
/** Helper to generate unique attribute IDs */
|
|
@@ -176,10 +479,18 @@ export declare function isRelationalNode(node: PlanNode): node is RelationalPlan
|
|
|
176
479
|
/**
|
|
177
480
|
* Base interface for PlanNodes that produce a scalar value (Expression Nodes).
|
|
178
481
|
* Note: this is an interface that concrete ScalarNode classes will implement.
|
|
482
|
+
*
|
|
483
|
+
* The injectivity / monotonicity / rangeRewrite methods all have safe defaults
|
|
484
|
+
* on `PlanNode`, so concrete classes opt in by overriding only the cases they
|
|
485
|
+
* can prove. Conservatively defaulting to "unknown / not injective" is critical:
|
|
486
|
+
* downstream optimizer rules treat these as load-bearing correctness claims.
|
|
179
487
|
*/
|
|
180
488
|
export interface ScalarPlanNode extends PlanNode {
|
|
181
489
|
readonly expression: Expression;
|
|
182
490
|
getType(): ScalarType;
|
|
491
|
+
isInjectiveIn(inputAttrId: number): InjectivityResult;
|
|
492
|
+
monotonicityIn(inputAttrId: number): MonotonicityResult;
|
|
493
|
+
rangeRewriteIn(inputAttrId: number, constant: SqlValue): RangeRewrite | undefined;
|
|
183
494
|
}
|
|
184
495
|
/**
|
|
185
496
|
* Characteristically check if a node is a scalar node
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan-node.d.ts","sourceRoot":"","sources":["../../../../src/planner/nodes/plan-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACnF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAG9D;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,iFAAiF;IACjF,QAAQ,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC;IAE/C,sDAAsD;IACtD,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC;IAExB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAMD;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,kBAKrB,CAAC;AAEX;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,iDAAiD;IACjD,EAAE,EAAE,MAAM,CAAC;IACX,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,IAAI,EAAE,UAAU,CAAC;IACjB,2DAA2D;IAC3D,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oEAAoE;IACp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AsB,iBAAkB,SAAQ,QAAS,YAAW,iBAAiB;IACnF,QAAQ,CAAC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IACzC,QAAQ,CAAC,OAAO,IAAI,UAAU;IAC9B,QAAQ,CAAC,WAAW,IAAI,SAAS,CAAC,cAAc,EAAE,cAAc,EAAE,cAAc,CAAC;IAEjF,QAAQ,CAAC,YAAY,CAAC,WAAW,EAAE,SAAS,QAAQ,EAAE,GAAG,QAAQ;CAClE;AAED;;GAEG;AACH,8BAAsB,cAAe,SAAQ,QAAS,YAAW,cAAc;IAC7E,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;IAC1D,QAAQ,CAAC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IACzC,QAAQ,CAAC,OAAO,IAAI,UAAU;IAE9B,WAAW,IAAI,SAAS,cAAc,EAAE;IAIxC,QAAQ,CAAC,YAAY,CAAC,WAAW,EAAE,SAAS,QAAQ,EAAE,GAAG,QAAQ;CAClE;AAED;;;GAGG;AACH,MAAM,WAAW,YAAa,SAAQ,QAAQ;IAC7C,QAAQ,IAAI,WAAW,CAAC;CACxB"}
|
|
@@ -11,6 +11,31 @@ export const DEFAULT_PHYSICAL = {
|
|
|
11
11
|
idempotent: true, // Default true for readonly nodes
|
|
12
12
|
constant: false,
|
|
13
13
|
};
|
|
14
|
+
/** Conservative defaults for the scalar property surface. Exposed for tests / consumers. */
|
|
15
|
+
export const DEFAULT_INJECTIVITY = { injective: false };
|
|
16
|
+
export const DEFAULT_MONOTONICITY = { monotonicity: 'unknown' };
|
|
17
|
+
/** Negate (flip) a monotonicity direction; constant/non_monotone/unknown pass through unchanged. */
|
|
18
|
+
export function negateMonotonicity(m) {
|
|
19
|
+
switch (m) {
|
|
20
|
+
case 'increasing': return 'decreasing';
|
|
21
|
+
case 'decreasing': return 'increasing';
|
|
22
|
+
default: return m;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/** Combine monotonicities for `a + b` (addition rules). */
|
|
26
|
+
export function addMonotonicity(a, b) {
|
|
27
|
+
if (a === 'unknown' || b === 'unknown')
|
|
28
|
+
return 'unknown';
|
|
29
|
+
if (a === 'non_monotone' || b === 'non_monotone')
|
|
30
|
+
return 'non_monotone';
|
|
31
|
+
if (a === 'constant')
|
|
32
|
+
return b;
|
|
33
|
+
if (b === 'constant')
|
|
34
|
+
return a;
|
|
35
|
+
if (a === b)
|
|
36
|
+
return a; // both increasing or both decreasing
|
|
37
|
+
return 'unknown'; // mixed directions
|
|
38
|
+
}
|
|
14
39
|
/**
|
|
15
40
|
* Base class for all nodes in the logical query plan.
|
|
16
41
|
* PlanNodes are immutable once constructed.
|
|
@@ -57,6 +82,30 @@ export class PlanNode {
|
|
|
57
82
|
getLogicalAttributes() {
|
|
58
83
|
return {};
|
|
59
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Is this scalar expression injective in the given input attribute?
|
|
87
|
+
* Default is the conservative "no" — only meaningful for ScalarPlanNode subclasses
|
|
88
|
+
* that override. Other inputs are assumed held constant when reasoning.
|
|
89
|
+
*/
|
|
90
|
+
isInjectiveIn(_inputAttrId) {
|
|
91
|
+
return DEFAULT_INJECTIVITY;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Monotonicity of this scalar expression in the given input attribute, with
|
|
95
|
+
* other inputs held constant. Default is the conservative 'unknown'.
|
|
96
|
+
*/
|
|
97
|
+
monotonicityIn(_inputAttrId) {
|
|
98
|
+
return DEFAULT_MONOTONICITY;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* For monotone-but-lossy scalar transforms only: given a constant `c` from a
|
|
102
|
+
* predicate `f(x) op c`, return the equivalent half-open range on x. Return
|
|
103
|
+
* undefined when not applicable / unsafe. Implementations must be consistent
|
|
104
|
+
* with `monotonicityIn`.
|
|
105
|
+
*/
|
|
106
|
+
rangeRewriteIn(_inputAttrId, _constant) {
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
60
109
|
/** Infer and cache the physical properties of this node */
|
|
61
110
|
get physical() {
|
|
62
111
|
if (!this._physical) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan-node.js","sourceRoot":"","sources":["../../../../src/planner/nodes/plan-node.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"plan-node.js","sourceRoot":"","sources":["../../../../src/planner/nodes/plan-node.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AA6RtD,6CAA6C;AAC7C,qEAAqE;AACrE,mDAAmD;AAEnD;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAuB;IACnD,aAAa,EAAE,IAAI;IACnB,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE,IAAI,EAAE,kCAAkC;IACpD,QAAQ,EAAE,KAAK;CACN,CAAC;AAwCX,4FAA4F;AAC5F,MAAM,CAAC,MAAM,mBAAmB,GAAsB,EAAE,SAAS,EAAE,KAAK,EAAW,CAAC;AACpF,MAAM,CAAC,MAAM,oBAAoB,GAAuB,EAAE,YAAY,EAAE,SAAS,EAAW,CAAC;AAE7F,oGAAoG;AACpG,MAAM,UAAU,kBAAkB,CAAC,CAAe;IACjD,QAAQ,CAAC,EAAE,CAAC;QACX,KAAK,YAAY,CAAC,CAAC,OAAO,YAAY,CAAC;QACvC,KAAK,YAAY,CAAC,CAAC,OAAO,YAAY,CAAC;QACvC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC;IACnB,CAAC;AACF,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAU,eAAe,CAAC,CAAe,EAAE,CAAe;IAC/D,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACzD,IAAI,CAAC,KAAK,cAAc,IAAI,CAAC,KAAK,cAAc;QAAE,OAAO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CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;CAGF;AAED;;GAEG;AACH,MAAM,OAAgB,iBAAkB,SAAQ,QAAQ;CAMvD;AAED;;GAEG;AACH,MAAM,OAAgB,cAAe,SAAQ,QAAQ;IAKnD,WAAW;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CAGF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-node.d.ts","sourceRoot":"","sources":["../../../../src/planner/nodes/project-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,KAAK,kBAAkB,EAAE,KAAK,mBAAmB,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAoB,MAAM,gBAAgB,CAAC;AACpJ,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"project-node.d.ts","sourceRoot":"","sources":["../../../../src/planner/nodes/project-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,KAAK,kBAAkB,EAAE,KAAK,mBAAmB,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAoB,MAAM,gBAAgB,CAAC;AACpJ,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAShD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAGzD,MAAM,WAAW,UAAU;IAC1B,IAAI,EAAE,cAAc,CAAC;IACrB,KAAK,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,SAAS;QAAE,IAAI,EAAE,cAAc,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,EAAE,GAAG,QAAQ;CAsC/G"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { PlanNodeType } from './plan-node-type.js';
|
|
2
2
|
import { PlanNode, isRelationalNode } from './plan-node.js';
|
|
3
3
|
import { Cached } from '../../util/cached.js';
|
|
4
|
-
import { projectKeys } from '../util/key-utils.js';
|
|
4
|
+
import { deriveProjectionColumnMap, projectKeys } from '../util/key-utils.js';
|
|
5
|
+
import { addFd, projectConstantBindings, projectDomainConstraints, projectFds, superkeyToFd } from '../util/fd-utils.js';
|
|
5
6
|
import { expressionToString } from '../../emit/ast-stringify.js';
|
|
6
7
|
import { formatProjection } from '../../util/plan-formatter.js';
|
|
7
8
|
import { ColumnReferenceNode } from './reference.js';
|
|
8
9
|
import { quereusError } from '../../common/errors.js';
|
|
9
10
|
import { StatusCode } from '../../common/types.js';
|
|
10
|
-
import { projectOrdering } from '../framework/physical-utils.js';
|
|
11
|
+
import { projectMonotonicOnByAttrId, projectOrdering } from '../framework/physical-utils.js';
|
|
11
12
|
/**
|
|
12
13
|
* Represents a projection operation (SELECT list) without DISTINCT.
|
|
13
14
|
* It takes an input relation and outputs a new relation with specified columns/expressions.
|
|
@@ -72,16 +73,7 @@ export class ProjectNode extends PlanNode {
|
|
|
72
73
|
isSet: sourceType.isSet,
|
|
73
74
|
columns,
|
|
74
75
|
keys: (() => {
|
|
75
|
-
|
|
76
|
-
const map = new Map();
|
|
77
|
-
this.projections.forEach((proj, outIdx) => {
|
|
78
|
-
if (proj.node instanceof ColumnReferenceNode) {
|
|
79
|
-
const colRef = proj.node;
|
|
80
|
-
const srcIndex = this.source.getAttributes().findIndex(a => a.id === colRef.attributeId);
|
|
81
|
-
if (srcIndex >= 0)
|
|
82
|
-
map.set(srcIndex, outIdx);
|
|
83
|
-
}
|
|
84
|
-
});
|
|
76
|
+
const { map } = deriveProjectionColumnMap(this.source.getAttributes(), this.projections.map((p, outIndex) => ({ expr: p.node, outIndex })));
|
|
85
77
|
return projectKeys(sourceType.keys, map);
|
|
86
78
|
})(),
|
|
87
79
|
// TODO: propagate row constraints that don't have projected off columns
|
|
@@ -142,33 +134,91 @@ export class ProjectNode extends PlanNode {
|
|
|
142
134
|
}
|
|
143
135
|
computePhysical(childrenPhysical) {
|
|
144
136
|
const sourcePhysical = childrenPhysical[0];
|
|
145
|
-
// Build mapping from source index -> projected index for ColumnReferences
|
|
146
|
-
const map = new Map();
|
|
147
137
|
const sourceAttrs = this.source.getAttributes();
|
|
148
|
-
this.projections.
|
|
138
|
+
const outputColCount = this.projections.length;
|
|
139
|
+
// monotonicOn only propagates through bare-column-reference projections —
|
|
140
|
+
// attribute identity must survive, which injectively-derived columns don't
|
|
141
|
+
// preserve (the column changes value space).
|
|
142
|
+
const preservedAttrIds = new Set();
|
|
143
|
+
for (const proj of this.projections) {
|
|
149
144
|
if (proj.node instanceof ColumnReferenceNode) {
|
|
150
|
-
|
|
151
|
-
const srcIndex = sourceAttrs.findIndex(a => a.id === colRef.attributeId);
|
|
152
|
-
if (srcIndex >= 0 && !map.has(srcIndex))
|
|
153
|
-
map.set(srcIndex, outIdx);
|
|
145
|
+
preservedAttrIds.add(proj.node.attributeId);
|
|
154
146
|
}
|
|
155
|
-
}
|
|
156
|
-
const
|
|
157
|
-
|
|
147
|
+
}
|
|
148
|
+
const { map, injectivePairs } = deriveProjectionColumnMap(sourceAttrs, this.projections.map((p, outIndex) => ({ expr: p.node, outIndex })));
|
|
149
|
+
// Project the source's logical unique keys (from RelationType) through the
|
|
150
|
+
// column map: each surviving key K' becomes the FD `K' → (all_other_out_cols)`
|
|
151
|
+
// on the projection's output, carrying the "key-ness" claim through.
|
|
152
|
+
const sourceLogicalKeys = this.source.getType().keys.map(k => k.map(ref => ref.index));
|
|
153
|
+
const projectedKeys = [];
|
|
154
|
+
for (const key of sourceLogicalKeys) {
|
|
158
155
|
const projected = [];
|
|
156
|
+
let miss = false;
|
|
159
157
|
for (const col of key) {
|
|
160
158
|
const outIdx = map.get(col);
|
|
161
|
-
if (outIdx === undefined)
|
|
162
|
-
|
|
159
|
+
if (outIdx === undefined) {
|
|
160
|
+
miss = true;
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
163
|
projected.push(outIdx);
|
|
164
164
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
165
|
+
if (!miss)
|
|
166
|
+
projectedKeys.push(projected);
|
|
167
|
+
}
|
|
168
|
+
// When both a bare-column projection and an injective derivation of the
|
|
169
|
+
// same source column appear (`SELECT id, id+1 FROM t`), the derived column
|
|
170
|
+
// is *also* a unique key — substitute it into each surviving key.
|
|
171
|
+
for (const [srcIdx, outIdx] of injectivePairs) {
|
|
172
|
+
const bareOut = map.get(srcIdx);
|
|
173
|
+
if (bareOut === undefined || bareOut === outIdx)
|
|
174
|
+
continue;
|
|
175
|
+
const variants = [];
|
|
176
|
+
for (const key of projectedKeys) {
|
|
177
|
+
if (key.includes(bareOut) && !key.includes(outIdx)) {
|
|
178
|
+
variants.push(key.map(c => (c === bareOut ? outIdx : c)));
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
projectedKeys.push(...variants);
|
|
182
|
+
}
|
|
183
|
+
// FDs/ECs project through the same column mapping. Non-trivial expressions
|
|
184
|
+
// drop out of the mapping, so any FD/EC that references them is dropped —
|
|
185
|
+
// except for injective unary projections (`id + 1`, `-id`, ...) which the
|
|
186
|
+
// augmented map carries through and which additionally emit a
|
|
187
|
+
// bi-directional FD when both the bare and derived columns are projected.
|
|
188
|
+
let fds = projectFds(sourcePhysical?.fds ?? [], map);
|
|
189
|
+
for (const key of projectedKeys) {
|
|
190
|
+
const keyFd = superkeyToFd(key, outputColCount);
|
|
191
|
+
if (keyFd)
|
|
192
|
+
fds = addFd(fds, keyFd, { keyHints: projectedKeys });
|
|
193
|
+
}
|
|
194
|
+
for (const [srcIdx, outIdx] of injectivePairs) {
|
|
195
|
+
const bareOut = map.get(srcIdx);
|
|
196
|
+
if (bareOut === undefined || bareOut === outIdx)
|
|
197
|
+
continue;
|
|
198
|
+
fds = addFd(fds, { determinants: [bareOut], dependents: [outIdx] }, { keyHints: projectedKeys });
|
|
199
|
+
fds = addFd(fds, { determinants: [outIdx], dependents: [bareOut] }, { keyHints: projectedKeys });
|
|
200
|
+
}
|
|
201
|
+
const projectedEquiv = [];
|
|
202
|
+
for (const cls of sourcePhysical?.equivClasses ?? []) {
|
|
203
|
+
const mapped = [];
|
|
204
|
+
for (const c of cls) {
|
|
205
|
+
const out = map.get(c);
|
|
206
|
+
if (out !== undefined && !mapped.includes(out))
|
|
207
|
+
mapped.push(out);
|
|
208
|
+
}
|
|
209
|
+
if (mapped.length >= 2)
|
|
210
|
+
projectedEquiv.push(mapped.sort((a, b) => a - b));
|
|
211
|
+
}
|
|
212
|
+
const projectedBindings = projectConstantBindings(sourcePhysical?.constantBindings ?? [], map);
|
|
213
|
+
const projectedDomains = projectDomainConstraints(sourcePhysical?.domainConstraints ?? [], map);
|
|
168
214
|
return {
|
|
169
215
|
estimatedRows: this.source.estimatedRows,
|
|
170
216
|
ordering: projectOrdering(sourcePhysical?.ordering, map),
|
|
171
|
-
|
|
217
|
+
monotonicOn: projectMonotonicOnByAttrId(sourcePhysical?.monotonicOn, preservedAttrIds),
|
|
218
|
+
fds: fds.length > 0 ? fds : undefined,
|
|
219
|
+
equivClasses: projectedEquiv.length > 0 ? projectedEquiv : undefined,
|
|
220
|
+
constantBindings: projectedBindings.length > 0 ? projectedBindings : undefined,
|
|
221
|
+
domainConstraints: projectedDomains.length > 0 ? projectedDomains : undefined,
|
|
172
222
|
};
|
|
173
223
|
}
|
|
174
224
|
getType() {
|