@quereus/quereus 2.7.0 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/common/errors.d.ts +21 -0
- package/dist/src/common/errors.d.ts.map +1 -1
- package/dist/src/common/errors.js +29 -0
- package/dist/src/common/errors.js.map +1 -1
- package/dist/src/core/database.d.ts.map +1 -1
- package/dist/src/core/database.js +20 -7
- package/dist/src/core/database.js.map +1 -1
- package/dist/src/core/statement.d.ts.map +1 -1
- package/dist/src/core/statement.js +15 -5
- package/dist/src/core/statement.js.map +1 -1
- package/dist/src/emit/ast-stringify.d.ts.map +1 -1
- package/dist/src/emit/ast-stringify.js +0 -4
- package/dist/src/emit/ast-stringify.js.map +1 -1
- package/dist/src/func/builtins/explain.d.ts.map +1 -1
- package/dist/src/func/builtins/explain.js +39 -36
- package/dist/src/func/builtins/explain.js.map +1 -1
- package/dist/src/func/builtins/json-helpers.d.ts +1 -1
- package/dist/src/func/builtins/json-helpers.d.ts.map +1 -1
- package/dist/src/func/builtins/json-helpers.js.map +1 -1
- package/dist/src/func/builtins/json.d.ts.map +1 -1
- package/dist/src/func/builtins/json.js +5 -7
- package/dist/src/func/builtins/json.js.map +1 -1
- package/dist/src/func/builtins/scalar.d.ts.map +1 -1
- package/dist/src/func/builtins/scalar.js +17 -2
- package/dist/src/func/builtins/scalar.js.map +1 -1
- package/dist/src/func/builtins/string.d.ts.map +1 -1
- package/dist/src/func/builtins/string.js +4 -2
- package/dist/src/func/builtins/string.js.map +1 -1
- package/dist/src/parser/ast.d.ts +4 -3
- package/dist/src/parser/ast.d.ts.map +1 -1
- package/dist/src/parser/lexer.d.ts.map +1 -1
- package/dist/src/parser/lexer.js +8 -48
- package/dist/src/parser/lexer.js.map +1 -1
- package/dist/src/parser/parser.d.ts.map +1 -1
- package/dist/src/parser/parser.js +43 -11
- package/dist/src/parser/parser.js.map +1 -1
- package/dist/src/parser/utils.d.ts +10 -1
- package/dist/src/parser/utils.d.ts.map +1 -1
- package/dist/src/parser/utils.js +23 -0
- package/dist/src/parser/utils.js.map +1 -1
- package/dist/src/planner/analysis/constraint-extractor.d.ts.map +1 -1
- package/dist/src/planner/analysis/constraint-extractor.js +0 -1
- package/dist/src/planner/analysis/constraint-extractor.js.map +1 -1
- package/dist/src/planner/building/constraint-builder.d.ts +12 -1
- package/dist/src/planner/building/constraint-builder.d.ts.map +1 -1
- package/dist/src/planner/building/constraint-builder.js +60 -1
- package/dist/src/planner/building/constraint-builder.js.map +1 -1
- package/dist/src/planner/building/create-view.d.ts.map +1 -1
- package/dist/src/planner/building/create-view.js +16 -0
- package/dist/src/planner/building/create-view.js.map +1 -1
- package/dist/src/planner/building/delete.d.ts.map +1 -1
- package/dist/src/planner/building/delete.js +13 -7
- package/dist/src/planner/building/delete.js.map +1 -1
- package/dist/src/planner/building/foreign-key-builder.d.ts.map +1 -1
- package/dist/src/planner/building/foreign-key-builder.js +27 -17
- package/dist/src/planner/building/foreign-key-builder.js.map +1 -1
- package/dist/src/planner/building/insert.d.ts.map +1 -1
- package/dist/src/planner/building/insert.js +51 -43
- package/dist/src/planner/building/insert.js.map +1 -1
- package/dist/src/planner/building/select-aggregates.d.ts +4 -1
- package/dist/src/planner/building/select-aggregates.d.ts.map +1 -1
- package/dist/src/planner/building/select-aggregates.js +122 -21
- package/dist/src/planner/building/select-aggregates.js.map +1 -1
- package/dist/src/planner/building/select-modifiers.d.ts +6 -2
- package/dist/src/planner/building/select-modifiers.d.ts.map +1 -1
- package/dist/src/planner/building/select-modifiers.js +20 -5
- package/dist/src/planner/building/select-modifiers.js.map +1 -1
- package/dist/src/planner/building/select-ordinal.d.ts +20 -0
- package/dist/src/planner/building/select-ordinal.d.ts.map +1 -0
- package/dist/src/planner/building/select-ordinal.js +62 -0
- package/dist/src/planner/building/select-ordinal.js.map +1 -0
- package/dist/src/planner/building/select.d.ts.map +1 -1
- package/dist/src/planner/building/select.js +78 -19
- package/dist/src/planner/building/select.js.map +1 -1
- package/dist/src/planner/building/update.d.ts.map +1 -1
- package/dist/src/planner/building/update.js +38 -27
- package/dist/src/planner/building/update.js.map +1 -1
- package/dist/src/planner/building/with.d.ts.map +1 -1
- package/dist/src/planner/building/with.js +25 -2
- package/dist/src/planner/building/with.js.map +1 -1
- package/dist/src/planner/framework/characteristics.d.ts +3 -1
- package/dist/src/planner/framework/characteristics.d.ts.map +1 -1
- package/dist/src/planner/framework/characteristics.js +7 -0
- package/dist/src/planner/framework/characteristics.js.map +1 -1
- package/dist/src/planner/framework/physical-utils.d.ts +22 -1
- package/dist/src/planner/framework/physical-utils.d.ts.map +1 -1
- package/dist/src/planner/framework/physical-utils.js +47 -0
- package/dist/src/planner/framework/physical-utils.js.map +1 -1
- package/dist/src/planner/nodes/alias-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/alias-node.js +2 -0
- 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 +223 -0
- package/dist/src/planner/nodes/asof-scan-node.js.map +1 -0
- package/dist/src/planner/nodes/constraint-check-node.d.ts +25 -1
- package/dist/src/planner/nodes/constraint-check-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/constraint-check-node.js +36 -6
- 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 +7 -0
- package/dist/src/planner/nodes/distinct-node.js.map +1 -1
- package/dist/src/planner/nodes/filter.d.ts.map +1 -1
- package/dist/src/planner/nodes/filter.js +8 -2
- 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.map +1 -1
- package/dist/src/planner/nodes/hash-aggregate.js +2 -0
- 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 +10 -2
- package/dist/src/planner/nodes/join-node.js.map +1 -1
- package/dist/src/planner/nodes/join-utils.d.ts +19 -1
- package/dist/src/planner/nodes/join-utils.d.ts.map +1 -1
- package/dist/src/planner/nodes/join-utils.js +46 -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 +2 -0
- 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 +4 -1
- 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 +127 -0
- package/dist/src/planner/nodes/ordinal-slice-node.js.map +1 -0
- package/dist/src/planner/nodes/plan-node-type.d.ts +2 -0
- package/dist/src/planner/nodes/plan-node-type.d.ts.map +1 -1
- package/dist/src/planner/nodes/plan-node-type.js +2 -0
- package/dist/src/planner/nodes/plan-node-type.js.map +1 -1
- package/dist/src/planner/nodes/plan-node.d.ts +130 -1
- 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 +6 -1
- package/dist/src/planner/nodes/project-node.js.map +1 -1
- package/dist/src/planner/nodes/recursive-cte-node.d.ts +5 -3
- package/dist/src/planner/nodes/recursive-cte-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/recursive-cte-node.js +24 -8
- package/dist/src/planner/nodes/recursive-cte-node.js.map +1 -1
- package/dist/src/planner/nodes/reference.d.ts +4 -1
- package/dist/src/planner/nodes/reference.d.ts.map +1 -1
- package/dist/src/planner/nodes/reference.js +16 -0
- package/dist/src/planner/nodes/reference.js.map +1 -1
- package/dist/src/planner/nodes/returning-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/returning-node.js +5 -12
- package/dist/src/planner/nodes/returning-node.js.map +1 -1
- package/dist/src/planner/nodes/scalar.d.ts +7 -1
- package/dist/src/planner/nodes/scalar.d.ts.map +1 -1
- package/dist/src/planner/nodes/scalar.js +100 -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 +9 -0
- package/dist/src/planner/nodes/set-operation-node.js.map +1 -1
- package/dist/src/planner/nodes/sort.d.ts.map +1 -1
- package/dist/src/planner/nodes/sort.js +20 -0
- package/dist/src/planner/nodes/sort.js.map +1 -1
- package/dist/src/planner/nodes/stream-aggregate.d.ts.map +1 -1
- package/dist/src/planner/nodes/stream-aggregate.js +2 -0
- package/dist/src/planner/nodes/stream-aggregate.js.map +1 -1
- package/dist/src/planner/nodes/table-access-nodes.d.ts +37 -2
- package/dist/src/planner/nodes/table-access-nodes.d.ts.map +1 -1
- package/dist/src/planner/nodes/table-access-nodes.js +87 -10
- package/dist/src/planner/nodes/table-access-nodes.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 +64 -3
- package/dist/src/planner/nodes/window-node.js.map +1 -1
- package/dist/src/planner/optimizer-tuning.d.ts +9 -0
- package/dist/src/planner/optimizer-tuning.d.ts.map +1 -1
- package/dist/src/planner/optimizer-tuning.js +3 -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 +91 -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 -36
- package/dist/src/planner/rules/access/rule-select-access-path.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-physical-selection.d.ts.map +1 -1
- package/dist/src/planner/rules/join/rule-join-physical-selection.js +3 -123
- 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/join/rule-quickpick-enumeration.d.ts.map +1 -1
- package/dist/src/planner/rules/join/rule-quickpick-enumeration.js +7 -3
- package/dist/src/planner/rules/join/rule-quickpick-enumeration.js.map +1 -1
- package/dist/src/planner/rules/predicate/rule-filter-merge.js.map +1 -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 +161 -9
- package/dist/src/planner/rules/retrieve/rule-grow-retrieve.js.map +1 -1
- package/dist/src/planner/rules/subquery/rule-subquery-decorrelation.d.ts.map +1 -1
- package/dist/src/planner/rules/subquery/rule-subquery-decorrelation.js +2 -2
- 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/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/emit/alter-table.d.ts.map +1 -1
- package/dist/src/runtime/emit/alter-table.js +286 -7
- 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/binary.d.ts.map +1 -1
- package/dist/src/runtime/emit/binary.js +12 -7
- package/dist/src/runtime/emit/binary.js.map +1 -1
- package/dist/src/runtime/emit/constraint-check.d.ts.map +1 -1
- package/dist/src/runtime/emit/constraint-check.js +145 -62
- 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 +6 -6
- 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 +133 -76
- package/dist/src/runtime/emit/dml-executor.js.map +1 -1
- 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/recursive-cte.d.ts.map +1 -1
- package/dist/src/runtime/emit/recursive-cte.js +61 -10
- package/dist/src/runtime/emit/recursive-cte.js.map +1 -1
- 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/scalar-function.d.ts.map +1 -1
- package/dist/src/runtime/emit/scalar-function.js +2 -1
- package/dist/src/runtime/emit/scalar-function.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/table-valued-function.d.ts.map +1 -1
- package/dist/src/runtime/emit/table-valued-function.js +4 -2
- package/dist/src/runtime/emit/table-valued-function.js.map +1 -1
- package/dist/src/runtime/emit/update.d.ts.map +1 -1
- package/dist/src/runtime/emit/update.js +8 -5
- 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 +732 -37
- package/dist/src/runtime/emit/window.js.map +1 -1
- package/dist/src/runtime/foreign-key-actions.js +7 -6
- 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 +4 -0
- package/dist/src/runtime/register.js.map +1 -1
- package/dist/src/schema/catalog.d.ts +12 -0
- package/dist/src/schema/catalog.d.ts.map +1 -1
- package/dist/src/schema/catalog.js +47 -6
- package/dist/src/schema/catalog.js.map +1 -1
- package/dist/src/schema/column.d.ts +7 -0
- package/dist/src/schema/column.d.ts.map +1 -1
- package/dist/src/schema/column.js.map +1 -1
- package/dist/src/schema/function.d.ts +28 -3
- 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 +42 -6
- package/dist/src/schema/manager.d.ts.map +1 -1
- package/dist/src/schema/manager.js +175 -23
- package/dist/src/schema/manager.js.map +1 -1
- package/dist/src/schema/rename-rewriter.d.ts +4 -0
- package/dist/src/schema/rename-rewriter.d.ts.map +1 -0
- package/dist/src/schema/rename-rewriter.js +506 -0
- package/dist/src/schema/rename-rewriter.js.map +1 -0
- 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 +344 -42
- package/dist/src/schema/schema-differ.js.map +1 -1
- package/dist/src/schema/table.d.ts +65 -2
- package/dist/src/schema/table.d.ts.map +1 -1
- package/dist/src/schema/table.js +144 -0
- 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/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/util/async-iterator.d.ts +2 -1
- package/dist/src/util/async-iterator.d.ts.map +1 -1
- package/dist/src/util/async-iterator.js +4 -4
- package/dist/src/util/async-iterator.js.map +1 -1
- package/dist/src/util/patterns.d.ts.map +1 -1
- package/dist/src/util/patterns.js +58 -10
- package/dist/src/util/patterns.js.map +1 -1
- package/dist/src/vtab/best-access-plan.d.ts +48 -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/filter-info.d.ts +14 -0
- package/dist/src/vtab/filter-info.d.ts.map +1 -1
- package/dist/src/vtab/memory/index.d.ts +8 -0
- package/dist/src/vtab/memory/index.d.ts.map +1 -1
- package/dist/src/vtab/memory/index.js +11 -0
- package/dist/src/vtab/memory/index.js.map +1 -1
- package/dist/src/vtab/memory/layer/base.d.ts +8 -1
- package/dist/src/vtab/memory/layer/base.d.ts.map +1 -1
- package/dist/src/vtab/memory/layer/base.js +36 -2
- package/dist/src/vtab/memory/layer/base.js.map +1 -1
- package/dist/src/vtab/memory/layer/manager.d.ts +5 -1
- package/dist/src/vtab/memory/layer/manager.d.ts.map +1 -1
- package/dist/src/vtab/memory/layer/manager.js +63 -13
- package/dist/src/vtab/memory/layer/manager.js.map +1 -1
- package/dist/src/vtab/memory/layer/transaction.d.ts.map +1 -1
- package/dist/src/vtab/memory/layer/transaction.js +21 -2
- package/dist/src/vtab/memory/layer/transaction.js.map +1 -1
- package/dist/src/vtab/memory/module.d.ts +45 -2
- package/dist/src/vtab/memory/module.d.ts.map +1 -1
- package/dist/src/vtab/memory/module.js +268 -27
- package/dist/src/vtab/memory/module.js.map +1 -1
- package/dist/src/vtab/memory/utils/predicate.d.ts +27 -0
- package/dist/src/vtab/memory/utils/predicate.d.ts.map +1 -0
- package/dist/src/vtab/memory/utils/predicate.js +182 -0
- package/dist/src/vtab/memory/utils/predicate.js.map +1 -0
- package/dist/src/vtab/module.d.ts +24 -0
- package/dist/src/vtab/module.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { PlanNodeType } from './plan-node-type.js';
|
|
2
|
+
import { PlanNode, type RelationalPlanNode, type BinaryRelationalNode, type PhysicalProperties, type Attribute } from './plan-node.js';
|
|
3
|
+
import type { RelationType } from '../../common/datatype.js';
|
|
4
|
+
import type { Scope } from '../scopes/scope.js';
|
|
5
|
+
/**
|
|
6
|
+
* Pair of attribute IDs identifying matching attributes on the left and right sides
|
|
7
|
+
* of an asof scan (either the asof match attribute or a partition equi-pair).
|
|
8
|
+
*/
|
|
9
|
+
export interface AsofAttrPair {
|
|
10
|
+
leftAttrId: number;
|
|
11
|
+
rightAttrId: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Physical plan node implementing a streaming asof scan.
|
|
15
|
+
*
|
|
16
|
+
* For each left row, emits a single right row matched against the left's match
|
|
17
|
+
* value, optionally bucketed by partition keys. Two directions are supported:
|
|
18
|
+
*
|
|
19
|
+
* - `direction = 'desc'`: latest right ≤ left.match (or strict <).
|
|
20
|
+
* - `direction = 'asc'`: earliest right ≥ left.match (or strict >).
|
|
21
|
+
*
|
|
22
|
+
* Requires the right input to advertise `MonotonicOn(matchAttr)` (ascending)
|
|
23
|
+
* and `accessCapabilities.asofRight`.
|
|
24
|
+
*
|
|
25
|
+
* Output attributes: left attributes followed by the projected right output
|
|
26
|
+
* attributes (NULL-padded when `outer` and no match exists). The optional
|
|
27
|
+
* `rightOutputAttrs` parameter lets the rule preserve attribute IDs from the
|
|
28
|
+
* original logical JoinNode — without it, all of `right`'s attributes are
|
|
29
|
+
* emitted unchanged.
|
|
30
|
+
*
|
|
31
|
+
* Two emitter strategies (selected by `rule-asof-strategy-select`):
|
|
32
|
+
*
|
|
33
|
+
* - `'hash'` (default): bucket the right by partition key (`Map<string, Row[]>`),
|
|
34
|
+
* stream the left with per-bucket cursors. Memory O(R), latency = first
|
|
35
|
+
* emit after R fully arrives.
|
|
36
|
+
* - `'merge'`: co-stream both inputs in lockstep when both are pre-ordered
|
|
37
|
+
* by `[partition cols..., matchAttr]`. Memory O(1) (one in-flight
|
|
38
|
+
* partition), emits as left rows arrive.
|
|
39
|
+
*
|
|
40
|
+
* Cost: O(left.rows + right.rows) regardless of strategy — the difference is
|
|
41
|
+
* constant factors / memory.
|
|
42
|
+
*/
|
|
43
|
+
export declare class AsofScanNode extends PlanNode implements BinaryRelationalNode {
|
|
44
|
+
/** Left (driving) input. */
|
|
45
|
+
readonly left: RelationalPlanNode;
|
|
46
|
+
/** Right input. Must advertise MonotonicOn(matchAttr.right) and accessCapabilities.asofRight. */
|
|
47
|
+
readonly right: RelationalPlanNode;
|
|
48
|
+
/** Asof match attribute pair. */
|
|
49
|
+
readonly matchAttr: AsofAttrPair;
|
|
50
|
+
/** Equi-partition keys (zero or more). Empty array = single bucket. */
|
|
51
|
+
readonly partitionAttrs: readonly AsofAttrPair[];
|
|
52
|
+
/** Strict (open) vs non-strict (closed) on the asof comparison. */
|
|
53
|
+
readonly strict: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Direction of the asof match.
|
|
56
|
+
* 'desc' → largest right.match ≤ left.match (or < when strict)
|
|
57
|
+
* 'asc' → smallest right.match ≥ left.match (or > when strict)
|
|
58
|
+
*/
|
|
59
|
+
readonly direction: 'asc' | 'desc';
|
|
60
|
+
/** LEFT JOIN semantics: emit unmatched left rows with NULL right columns. */
|
|
61
|
+
readonly outer: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Column indices into `right`'s row to project for output. If undefined,
|
|
64
|
+
* all of `right`'s columns are emitted in order.
|
|
65
|
+
*/
|
|
66
|
+
readonly rightOutputColumnIndices?: readonly number[] | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Attributes to expose for the right side of the output. When provided,
|
|
69
|
+
* these are used verbatim (preserving attribute IDs from the original
|
|
70
|
+
* logical JoinNode). Length must match `rightOutputColumnIndices` (or the
|
|
71
|
+
* full right attribute count when no projection is given).
|
|
72
|
+
*/
|
|
73
|
+
readonly rightOutputAttrs?: readonly Attribute[] | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* Emitter strategy. Default is `'hash'`; the strategy-select rule may
|
|
76
|
+
* upgrade to `'merge'` when both inputs are co-partition-ordered and the
|
|
77
|
+
* right's row count crosses the configured threshold.
|
|
78
|
+
*/
|
|
79
|
+
readonly strategy: 'hash' | 'merge';
|
|
80
|
+
readonly nodeType = PlanNodeType.AsofScan;
|
|
81
|
+
private attributesCache;
|
|
82
|
+
constructor(scope: Scope,
|
|
83
|
+
/** Left (driving) input. */
|
|
84
|
+
left: RelationalPlanNode,
|
|
85
|
+
/** Right input. Must advertise MonotonicOn(matchAttr.right) and accessCapabilities.asofRight. */
|
|
86
|
+
right: RelationalPlanNode,
|
|
87
|
+
/** Asof match attribute pair. */
|
|
88
|
+
matchAttr: AsofAttrPair,
|
|
89
|
+
/** Equi-partition keys (zero or more). Empty array = single bucket. */
|
|
90
|
+
partitionAttrs: readonly AsofAttrPair[],
|
|
91
|
+
/** Strict (open) vs non-strict (closed) on the asof comparison. */
|
|
92
|
+
strict: boolean,
|
|
93
|
+
/**
|
|
94
|
+
* Direction of the asof match.
|
|
95
|
+
* 'desc' → largest right.match ≤ left.match (or < when strict)
|
|
96
|
+
* 'asc' → smallest right.match ≥ left.match (or > when strict)
|
|
97
|
+
*/
|
|
98
|
+
direction: 'asc' | 'desc',
|
|
99
|
+
/** LEFT JOIN semantics: emit unmatched left rows with NULL right columns. */
|
|
100
|
+
outer: boolean,
|
|
101
|
+
/**
|
|
102
|
+
* Column indices into `right`'s row to project for output. If undefined,
|
|
103
|
+
* all of `right`'s columns are emitted in order.
|
|
104
|
+
*/
|
|
105
|
+
rightOutputColumnIndices?: readonly number[] | undefined,
|
|
106
|
+
/**
|
|
107
|
+
* Attributes to expose for the right side of the output. When provided,
|
|
108
|
+
* these are used verbatim (preserving attribute IDs from the original
|
|
109
|
+
* logical JoinNode). Length must match `rightOutputColumnIndices` (or the
|
|
110
|
+
* full right attribute count when no projection is given).
|
|
111
|
+
*/
|
|
112
|
+
rightOutputAttrs?: readonly Attribute[] | undefined,
|
|
113
|
+
/**
|
|
114
|
+
* Emitter strategy. Default is `'hash'`; the strategy-select rule may
|
|
115
|
+
* upgrade to `'merge'` when both inputs are co-partition-ordered and the
|
|
116
|
+
* right's row count crosses the configured threshold.
|
|
117
|
+
*/
|
|
118
|
+
strategy?: 'hash' | 'merge');
|
|
119
|
+
/** Indices into the right row to emit, in output order. */
|
|
120
|
+
getRightOutputColumnIndices(): readonly number[];
|
|
121
|
+
private buildAttributes;
|
|
122
|
+
getAttributes(): Attribute[];
|
|
123
|
+
getType(): RelationType;
|
|
124
|
+
computePhysical(childrenPhysical: PhysicalProperties[]): Partial<PhysicalProperties>;
|
|
125
|
+
get estimatedRows(): number | undefined;
|
|
126
|
+
getChildren(): readonly PlanNode[];
|
|
127
|
+
getRelations(): readonly [RelationalPlanNode, RelationalPlanNode];
|
|
128
|
+
withChildren(newChildren: readonly PlanNode[]): PlanNode;
|
|
129
|
+
/**
|
|
130
|
+
* Return this node with `strategy` set to the given value. Returns `this`
|
|
131
|
+
* when the strategy is unchanged.
|
|
132
|
+
*/
|
|
133
|
+
withStrategy(strategy: 'hash' | 'merge'): AsofScanNode;
|
|
134
|
+
toString(): string;
|
|
135
|
+
getLogicalAttributes(): Record<string, unknown>;
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=asof-scan-node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asof-scan-node.d.ts","sourceRoot":"","sources":["../../../../src/planner/nodes/asof-scan-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,KAAK,kBAAkB,EAAE,KAAK,oBAAoB,EAAE,KAAK,kBAAkB,EAAE,KAAK,SAAS,EAA0C,MAAM,gBAAgB,CAAC;AAC/K,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAMhD;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,qBAAa,YAAa,SAAQ,QAAS,YAAW,oBAAoB;IAMxE,4BAA4B;aACZ,IAAI,EAAE,kBAAkB;IACxC,iGAAiG;aACjF,KAAK,EAAE,kBAAkB;IACzC,iCAAiC;aACjB,SAAS,EAAE,YAAY;IACvC,uEAAuE;aACvD,cAAc,EAAE,SAAS,YAAY,EAAE;IACvD,mEAAmE;aACnD,MAAM,EAAE,OAAO;IAC/B;;;;OAIG;aACa,SAAS,EAAE,KAAK,GAAG,MAAM;IACzC,6EAA6E;aAC7D,KAAK,EAAE,OAAO;IAC9B;;;OAGG;aACa,wBAAwB,CAAC,EAAE,SAAS,MAAM,EAAE;IAC5D;;;;;OAKG;aACa,gBAAgB,CAAC,EAAE,SAAS,SAAS,EAAE;IACvD;;;;OAIG;aACa,QAAQ,EAAE,MAAM,GAAG,OAAO;IAxC3C,SAAkB,QAAQ,yBAAyB;IACnD,OAAO,CAAC,eAAe,CAAsB;gBAG5C,KAAK,EAAE,KAAK;IACZ,4BAA4B;IACZ,IAAI,EAAE,kBAAkB;IACxC,iGAAiG;IACjF,KAAK,EAAE,kBAAkB;IACzC,iCAAiC;IACjB,SAAS,EAAE,YAAY;IACvC,uEAAuE;IACvD,cAAc,EAAE,SAAS,YAAY,EAAE;IACvD,mEAAmE;IACnD,MAAM,EAAE,OAAO;IAC/B;;;;OAIG;IACa,SAAS,EAAE,KAAK,GAAG,MAAM;IACzC,6EAA6E;IAC7D,KAAK,EAAE,OAAO;IAC9B;;;OAGG;IACa,wBAAwB,CAAC,EAAE,SAAS,MAAM,EAAE,YAAA;IAC5D;;;;;OAKG;IACa,gBAAgB,CAAC,EAAE,SAAS,SAAS,EAAE,YAAA;IACvD;;;;OAIG;IACa,QAAQ,GAAE,MAAM,GAAG,OAAgB;IAWpD,2DAA2D;IAC3D,2BAA2B,IAAI,SAAS,MAAM,EAAE;IAKhD,OAAO,CAAC,eAAe;IAyBvB,aAAa,IAAI,SAAS,EAAE;IAI5B,OAAO,IAAI,YAAY;IAcvB,eAAe,CAAC,gBAAgB,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAmBpF,IAAI,aAAa,IAAI,MAAM,GAAG,SAAS,CAEtC;IAED,WAAW,IAAI,SAAS,QAAQ,EAAE;IAIlC,YAAY,IAAI,SAAS,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;IAIjE,YAAY,CAAC,WAAW,EAAE,SAAS,QAAQ,EAAE,GAAG,QAAQ;IAiCxD;;;OAGG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,YAAY;IAiB7C,QAAQ,IAAI,MAAM;IAalB,oBAAoB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAaxD"}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { PlanNodeType } from './plan-node-type.js';
|
|
2
|
+
import { PlanNode, isRelationalNode } from './plan-node.js';
|
|
3
|
+
import { Cached } from '../../util/cached.js';
|
|
4
|
+
import { StatusCode } from '../../common/types.js';
|
|
5
|
+
import { quereusError } from '../../common/errors.js';
|
|
6
|
+
import { buildJoinAttributes, buildJoinRelationType } from './join-utils.js';
|
|
7
|
+
/**
|
|
8
|
+
* Physical plan node implementing a streaming asof scan.
|
|
9
|
+
*
|
|
10
|
+
* For each left row, emits a single right row matched against the left's match
|
|
11
|
+
* value, optionally bucketed by partition keys. Two directions are supported:
|
|
12
|
+
*
|
|
13
|
+
* - `direction = 'desc'`: latest right ≤ left.match (or strict <).
|
|
14
|
+
* - `direction = 'asc'`: earliest right ≥ left.match (or strict >).
|
|
15
|
+
*
|
|
16
|
+
* Requires the right input to advertise `MonotonicOn(matchAttr)` (ascending)
|
|
17
|
+
* and `accessCapabilities.asofRight`.
|
|
18
|
+
*
|
|
19
|
+
* Output attributes: left attributes followed by the projected right output
|
|
20
|
+
* attributes (NULL-padded when `outer` and no match exists). The optional
|
|
21
|
+
* `rightOutputAttrs` parameter lets the rule preserve attribute IDs from the
|
|
22
|
+
* original logical JoinNode — without it, all of `right`'s attributes are
|
|
23
|
+
* emitted unchanged.
|
|
24
|
+
*
|
|
25
|
+
* Two emitter strategies (selected by `rule-asof-strategy-select`):
|
|
26
|
+
*
|
|
27
|
+
* - `'hash'` (default): bucket the right by partition key (`Map<string, Row[]>`),
|
|
28
|
+
* stream the left with per-bucket cursors. Memory O(R), latency = first
|
|
29
|
+
* emit after R fully arrives.
|
|
30
|
+
* - `'merge'`: co-stream both inputs in lockstep when both are pre-ordered
|
|
31
|
+
* by `[partition cols..., matchAttr]`. Memory O(1) (one in-flight
|
|
32
|
+
* partition), emits as left rows arrive.
|
|
33
|
+
*
|
|
34
|
+
* Cost: O(left.rows + right.rows) regardless of strategy — the difference is
|
|
35
|
+
* constant factors / memory.
|
|
36
|
+
*/
|
|
37
|
+
export class AsofScanNode extends PlanNode {
|
|
38
|
+
left;
|
|
39
|
+
right;
|
|
40
|
+
matchAttr;
|
|
41
|
+
partitionAttrs;
|
|
42
|
+
strict;
|
|
43
|
+
direction;
|
|
44
|
+
outer;
|
|
45
|
+
rightOutputColumnIndices;
|
|
46
|
+
rightOutputAttrs;
|
|
47
|
+
strategy;
|
|
48
|
+
nodeType = PlanNodeType.AsofScan;
|
|
49
|
+
attributesCache;
|
|
50
|
+
constructor(scope,
|
|
51
|
+
/** Left (driving) input. */
|
|
52
|
+
left,
|
|
53
|
+
/** Right input. Must advertise MonotonicOn(matchAttr.right) and accessCapabilities.asofRight. */
|
|
54
|
+
right,
|
|
55
|
+
/** Asof match attribute pair. */
|
|
56
|
+
matchAttr,
|
|
57
|
+
/** Equi-partition keys (zero or more). Empty array = single bucket. */
|
|
58
|
+
partitionAttrs,
|
|
59
|
+
/** Strict (open) vs non-strict (closed) on the asof comparison. */
|
|
60
|
+
strict,
|
|
61
|
+
/**
|
|
62
|
+
* Direction of the asof match.
|
|
63
|
+
* 'desc' → largest right.match ≤ left.match (or < when strict)
|
|
64
|
+
* 'asc' → smallest right.match ≥ left.match (or > when strict)
|
|
65
|
+
*/
|
|
66
|
+
direction,
|
|
67
|
+
/** LEFT JOIN semantics: emit unmatched left rows with NULL right columns. */
|
|
68
|
+
outer,
|
|
69
|
+
/**
|
|
70
|
+
* Column indices into `right`'s row to project for output. If undefined,
|
|
71
|
+
* all of `right`'s columns are emitted in order.
|
|
72
|
+
*/
|
|
73
|
+
rightOutputColumnIndices,
|
|
74
|
+
/**
|
|
75
|
+
* Attributes to expose for the right side of the output. When provided,
|
|
76
|
+
* these are used verbatim (preserving attribute IDs from the original
|
|
77
|
+
* logical JoinNode). Length must match `rightOutputColumnIndices` (or the
|
|
78
|
+
* full right attribute count when no projection is given).
|
|
79
|
+
*/
|
|
80
|
+
rightOutputAttrs,
|
|
81
|
+
/**
|
|
82
|
+
* Emitter strategy. Default is `'hash'`; the strategy-select rule may
|
|
83
|
+
* upgrade to `'merge'` when both inputs are co-partition-ordered and the
|
|
84
|
+
* right's row count crosses the configured threshold.
|
|
85
|
+
*/
|
|
86
|
+
strategy = 'hash') {
|
|
87
|
+
const leftRows = left.estimatedRows ?? 100;
|
|
88
|
+
const rightRows = right.estimatedRows ?? 100;
|
|
89
|
+
// O(L + R) per-row work plus the children's own costs.
|
|
90
|
+
const cost = left.getTotalCost() + right.getTotalCost() + leftRows + rightRows;
|
|
91
|
+
super(scope, cost);
|
|
92
|
+
this.left = left;
|
|
93
|
+
this.right = right;
|
|
94
|
+
this.matchAttr = matchAttr;
|
|
95
|
+
this.partitionAttrs = partitionAttrs;
|
|
96
|
+
this.strict = strict;
|
|
97
|
+
this.direction = direction;
|
|
98
|
+
this.outer = outer;
|
|
99
|
+
this.rightOutputColumnIndices = rightOutputColumnIndices;
|
|
100
|
+
this.rightOutputAttrs = rightOutputAttrs;
|
|
101
|
+
this.strategy = strategy;
|
|
102
|
+
this.attributesCache = new Cached(() => this.buildAttributes());
|
|
103
|
+
}
|
|
104
|
+
/** Indices into the right row to emit, in output order. */
|
|
105
|
+
getRightOutputColumnIndices() {
|
|
106
|
+
if (this.rightOutputColumnIndices)
|
|
107
|
+
return this.rightOutputColumnIndices;
|
|
108
|
+
return this.right.getAttributes().map((_, i) => i);
|
|
109
|
+
}
|
|
110
|
+
buildAttributes() {
|
|
111
|
+
const leftAttrs = this.left.getAttributes();
|
|
112
|
+
const rightAttrs = this.right.getAttributes();
|
|
113
|
+
const rightCols = this.getRightOutputColumnIndices();
|
|
114
|
+
// When `rightOutputAttrs` is supplied, use those verbatim alongside the left
|
|
115
|
+
// attributes — they already encode the JoinNode's preserved IDs and any
|
|
116
|
+
// nullability overrides for `outer`.
|
|
117
|
+
if (this.rightOutputAttrs) {
|
|
118
|
+
if (this.rightOutputAttrs.length !== rightCols.length) {
|
|
119
|
+
quereusError(`AsofScanNode: rightOutputAttrs length ${this.rightOutputAttrs.length} != rightOutputColumnIndices length ${rightCols.length}`, StatusCode.INTERNAL);
|
|
120
|
+
}
|
|
121
|
+
return [...leftAttrs, ...this.rightOutputAttrs];
|
|
122
|
+
}
|
|
123
|
+
const projectedRightAttrs = rightCols.map(idx => {
|
|
124
|
+
if (idx < 0 || idx >= rightAttrs.length) {
|
|
125
|
+
quereusError(`AsofScanNode: rightOutputColumnIndex ${idx} out of range [0,${rightAttrs.length})`, StatusCode.INTERNAL);
|
|
126
|
+
}
|
|
127
|
+
return rightAttrs[idx];
|
|
128
|
+
});
|
|
129
|
+
return buildJoinAttributes(leftAttrs, projectedRightAttrs, this.outer ? 'left' : 'inner');
|
|
130
|
+
}
|
|
131
|
+
getAttributes() {
|
|
132
|
+
return this.attributesCache.value;
|
|
133
|
+
}
|
|
134
|
+
getType() {
|
|
135
|
+
const leftType = this.left.getType();
|
|
136
|
+
const rightAttrs = this.getAttributes().slice(this.left.getAttributes().length);
|
|
137
|
+
const rightType = {
|
|
138
|
+
typeClass: 'relation',
|
|
139
|
+
isReadOnly: true,
|
|
140
|
+
isSet: false,
|
|
141
|
+
columns: rightAttrs.map(a => ({ name: a.name, type: a.type })),
|
|
142
|
+
keys: [],
|
|
143
|
+
rowConstraints: [],
|
|
144
|
+
};
|
|
145
|
+
return buildJoinRelationType(leftType, rightType, this.outer ? 'left' : 'inner', []);
|
|
146
|
+
}
|
|
147
|
+
computePhysical(childrenPhysical) {
|
|
148
|
+
const leftPhys = childrenPhysical[0];
|
|
149
|
+
// AsofScan emits one row per left row in left's order — left's ordering and
|
|
150
|
+
// monotonicOn carry through (right values are appended per row but don't
|
|
151
|
+
// reorder the output).
|
|
152
|
+
const monotonicOn = leftPhys?.monotonicOn;
|
|
153
|
+
const ordering = leftPhys?.ordering;
|
|
154
|
+
return {
|
|
155
|
+
ordering,
|
|
156
|
+
monotonicOn,
|
|
157
|
+
estimatedRows: this.left.estimatedRows,
|
|
158
|
+
// Drop unique keys: appending right values per left row doesn't preserve
|
|
159
|
+
// uniqueness on left's keys (and the right side has no key contribution).
|
|
160
|
+
uniqueKeys: undefined,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
get estimatedRows() {
|
|
164
|
+
return this.left.estimatedRows;
|
|
165
|
+
}
|
|
166
|
+
getChildren() {
|
|
167
|
+
return [this.left, this.right];
|
|
168
|
+
}
|
|
169
|
+
getRelations() {
|
|
170
|
+
return [this.left, this.right];
|
|
171
|
+
}
|
|
172
|
+
withChildren(newChildren) {
|
|
173
|
+
if (newChildren.length !== 2) {
|
|
174
|
+
quereusError(`AsofScanNode expects 2 children, got ${newChildren.length}`, StatusCode.INTERNAL);
|
|
175
|
+
}
|
|
176
|
+
const [newLeft, newRight] = newChildren;
|
|
177
|
+
if (!isRelationalNode(newLeft)) {
|
|
178
|
+
quereusError('AsofScanNode: first child must be a RelationalPlanNode', StatusCode.INTERNAL);
|
|
179
|
+
}
|
|
180
|
+
if (!isRelationalNode(newRight)) {
|
|
181
|
+
quereusError('AsofScanNode: second child must be a RelationalPlanNode', StatusCode.INTERNAL);
|
|
182
|
+
}
|
|
183
|
+
if (newLeft === this.left && newRight === this.right) {
|
|
184
|
+
return this;
|
|
185
|
+
}
|
|
186
|
+
return new AsofScanNode(this.scope, newLeft, newRight, this.matchAttr, this.partitionAttrs, this.strict, this.direction, this.outer, this.rightOutputColumnIndices, this.rightOutputAttrs, this.strategy);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Return this node with `strategy` set to the given value. Returns `this`
|
|
190
|
+
* when the strategy is unchanged.
|
|
191
|
+
*/
|
|
192
|
+
withStrategy(strategy) {
|
|
193
|
+
if (strategy === this.strategy)
|
|
194
|
+
return this;
|
|
195
|
+
return new AsofScanNode(this.scope, this.left, this.right, this.matchAttr, this.partitionAttrs, this.strict, this.direction, this.outer, this.rightOutputColumnIndices, this.rightOutputAttrs, strategy);
|
|
196
|
+
}
|
|
197
|
+
toString() {
|
|
198
|
+
// 'desc' → right ≤/< left; 'asc' → right ≥/> left.
|
|
199
|
+
const op = this.direction === 'desc'
|
|
200
|
+
? (this.strict ? '<' : '<=')
|
|
201
|
+
: (this.strict ? '>' : '>=');
|
|
202
|
+
const parts = [];
|
|
203
|
+
parts.push(`right.${this.matchAttr.rightAttrId} ${op} left.${this.matchAttr.leftAttrId}`);
|
|
204
|
+
for (const p of this.partitionAttrs) {
|
|
205
|
+
parts.push(`right.${p.rightAttrId} = left.${p.leftAttrId}`);
|
|
206
|
+
}
|
|
207
|
+
return `${this.outer ? 'LEFT ' : ''}ASOF SCAN [${this.strategy}] on [${parts.join(', ')}]`;
|
|
208
|
+
}
|
|
209
|
+
getLogicalAttributes() {
|
|
210
|
+
return {
|
|
211
|
+
outer: this.outer,
|
|
212
|
+
strict: this.strict,
|
|
213
|
+
direction: this.direction,
|
|
214
|
+
strategy: this.strategy,
|
|
215
|
+
matchAttr: { left: this.matchAttr.leftAttrId, right: this.matchAttr.rightAttrId },
|
|
216
|
+
partitionAttrs: this.partitionAttrs.map(p => ({ left: p.leftAttrId, right: p.rightAttrId })),
|
|
217
|
+
rightOutputColumnIndices: this.rightOutputColumnIndices ? [...this.rightOutputColumnIndices] : undefined,
|
|
218
|
+
leftRows: this.left.estimatedRows,
|
|
219
|
+
rightRows: this.right.estimatedRows,
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
//# sourceMappingURL=asof-scan-node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asof-scan-node.js","sourceRoot":"","sources":["../../../../src/planner/nodes/asof-scan-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAqH,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAG/K,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAW7E;;;;;;;;;;;;;;;;;;;;;;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,IAAI,CAAC,MAAM;YACnB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,SAAS,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE;YACjF,cAAc,EAAE,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;YAC5F,wBAAwB,EAAE,IAAI,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,SAAS;YACxG,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,aAAa;YACjC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,aAAa;SACnC,CAAC;IACH,CAAC;CACD"}
|
|
@@ -5,12 +5,32 @@ import type { TableReferenceNode } from './reference.js';
|
|
|
5
5
|
import type { RelationType } from '../../common/datatype.js';
|
|
6
6
|
import type { RowOpFlag } from '../../schema/table.js';
|
|
7
7
|
import type { RowConstraintSchema } from '../../schema/table.js';
|
|
8
|
+
import type { ConflictResolution } from '../../common/constants.js';
|
|
9
|
+
import type { Expression } from '../../parser/ast.js';
|
|
8
10
|
export interface ConstraintCheck {
|
|
9
11
|
constraint: RowConstraintSchema;
|
|
10
12
|
expression: ScalarPlanNode;
|
|
11
13
|
deferrable?: boolean;
|
|
12
14
|
initiallyDeferred?: boolean;
|
|
13
15
|
needsDeferred: boolean;
|
|
16
|
+
/** Constraint class for conflict-resolution dispatch at runtime. */
|
|
17
|
+
kind?: 'check' | 'fk-child' | 'fk-parent';
|
|
18
|
+
/** For 'fk-parent' UPDATE checks: parent-table column indices the FK references.
|
|
19
|
+
* When set, the runtime can skip the check when none of these indices changed. */
|
|
20
|
+
referencedColumnIndices?: ReadonlyArray<number>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Pre-built default-value evaluator for a NOT NULL column with a DEFAULT clause.
|
|
24
|
+
* Used by REPLACE-on-NOT-NULL substitution to fill the NEW slot when the user
|
|
25
|
+
* supplied NULL for a NOT NULL column.
|
|
26
|
+
*/
|
|
27
|
+
export interface NotNullDefaultPlan {
|
|
28
|
+
/** Index of the column in the table schema. */
|
|
29
|
+
columnIndex: number;
|
|
30
|
+
/** AST default expression (used as a fallback if the planned node is missing). */
|
|
31
|
+
defaultExpr: Expression;
|
|
32
|
+
/** Pre-built scalar node that evaluates the default in the current row context. */
|
|
33
|
+
defaultNode: ScalarPlanNode;
|
|
14
34
|
}
|
|
15
35
|
/**
|
|
16
36
|
* Represents constraint checking for DML operations.
|
|
@@ -27,10 +47,14 @@ export declare class ConstraintCheckNode extends PlanNode implements RelationalP
|
|
|
27
47
|
readonly mutationContextValues?: Map<string, ScalarPlanNode> | undefined;
|
|
28
48
|
readonly contextAttributes?: Attribute[] | undefined;
|
|
29
49
|
readonly contextDescriptor?: RowDescriptor | undefined;
|
|
50
|
+
readonly onConflict?: ConflictResolution | undefined;
|
|
51
|
+
readonly notNullDefaults?: ReadonlyArray<NotNullDefaultPlan> | undefined;
|
|
30
52
|
readonly nodeType = PlanNodeType.ConstraintCheck;
|
|
31
53
|
constructor(scope: Scope, source: RelationalPlanNode, table: TableReferenceNode, operation: RowOpFlag, oldRowDescriptor: RowDescriptor | undefined, newRowDescriptor: RowDescriptor | undefined, flatRowDescriptor: RowDescriptor, constraintChecks: ConstraintCheck[], mutationContextValues?: Map<string, ScalarPlanNode> | undefined, // Mutation context value expressions
|
|
32
54
|
contextAttributes?: Attribute[] | undefined, // Mutation context attributes
|
|
33
|
-
contextDescriptor?: RowDescriptor | undefined
|
|
55
|
+
contextDescriptor?: RowDescriptor | undefined, // Mutation context row descriptor
|
|
56
|
+
onConflict?: ConflictResolution | undefined, // Statement-level OR clause; resolves IGNORE/REPLACE/FAIL/ROLLBACK
|
|
57
|
+
notNullDefaults?: ReadonlyArray<NotNullDefaultPlan> | undefined);
|
|
34
58
|
getType(): RelationType;
|
|
35
59
|
getAttributes(): readonly Attribute[];
|
|
36
60
|
getRelations(): readonly [RelationalPlanNode, TableReferenceNode];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constraint-check-node.d.ts","sourceRoot":"","sources":["../../../../src/planner/nodes/constraint-check-node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,KAAK,kBAAkB,EAAE,KAAK,SAAS,EAAE,KAAK,aAAa,EAAE,KAAK,cAAc,EAAkC,MAAM,gBAAgB,CAAC;AAC5J,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"constraint-check-node.d.ts","sourceRoot":"","sources":["../../../../src/planner/nodes/constraint-check-node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,KAAK,kBAAkB,EAAE,KAAK,SAAS,EAAE,KAAK,aAAa,EAAE,KAAK,cAAc,EAAkC,MAAM,gBAAgB,CAAC;AAC5J,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0B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,CAAC,EAAE,aAAa,CAAC,kBAAkB,CAAC;IAfrE,SAAkB,QAAQ,gCAAgC;gBAGxD,KAAK,EAAE,KAAK,EACI,MAAM,EAAE,kBAAkB,EAC1B,KAAK,EAAE,kBAAkB,EACzB,SAAS,EAAE,SAAS,EACpB,gBAAgB,EAAE,aAAa,GAAG,SAAS,EAC3C,gBAAgB,EAAE,aAAa,GAAG,SAAS,EAC3C,iBAAiB,EAAE,aAAa,EAChC,gBAAgB,EAAE,eAAe,EAAE,EACnC,qBAAqB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,YAAA,EAAE,qCAAqC;IAC1F,iBAAiB,CAAC,EAAE,SAAS,EAAE,YAAA,EAAE,8BAA8B;IAC/D,iBAAiB,CAAC,EAAE,aAAa,YAAA,EAAE,kCAAkC;IACrE,UAAU,CAAC,EAAE,kBAAkB,YAAA,EAAE,mEAAmE;IACpG,eAAe,CAAC,EAAE,aAAa,CAAC,kBAAkB,CAAC,YAAA;IAKrE,OAAO,IAAI,YAAY;IAIvB,aAAa,IAAI,SAAS,SAAS,EAAE;IAKrC,YAAY,IAAI,SAAS,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;IAIjE,WAAW,IAAI,SAAS,QAAQ,EAAE;IAalC,YAAY,CAAC,WAAW,EAAE,SAAS,QAAQ,EAAE,GAAG,QAAQ;IAsExD,IAAI,aAAa,IAAI,MAAM,GAAG,SAAS,CAEtC;IAEQ,QAAQ,IAAI,MAAM;IAQlB,oBAAoB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAiBzD"}
|
|
@@ -15,10 +15,14 @@ export class ConstraintCheckNode extends PlanNode {
|
|
|
15
15
|
mutationContextValues;
|
|
16
16
|
contextAttributes;
|
|
17
17
|
contextDescriptor;
|
|
18
|
+
onConflict;
|
|
19
|
+
notNullDefaults;
|
|
18
20
|
nodeType = PlanNodeType.ConstraintCheck;
|
|
19
21
|
constructor(scope, source, table, operation, oldRowDescriptor, newRowDescriptor, flatRowDescriptor, constraintChecks, mutationContextValues, // Mutation context value expressions
|
|
20
22
|
contextAttributes, // Mutation context attributes
|
|
21
|
-
contextDescriptor
|
|
23
|
+
contextDescriptor, // Mutation context row descriptor
|
|
24
|
+
onConflict, // Statement-level OR clause; resolves IGNORE/REPLACE/FAIL/ROLLBACK
|
|
25
|
+
notNullDefaults) {
|
|
22
26
|
super(scope);
|
|
23
27
|
this.source = source;
|
|
24
28
|
this.table = table;
|
|
@@ -30,6 +34,8 @@ export class ConstraintCheckNode extends PlanNode {
|
|
|
30
34
|
this.mutationContextValues = mutationContextValues;
|
|
31
35
|
this.contextAttributes = contextAttributes;
|
|
32
36
|
this.contextDescriptor = contextDescriptor;
|
|
37
|
+
this.onConflict = onConflict;
|
|
38
|
+
this.notNullDefaults = notNullDefaults;
|
|
33
39
|
}
|
|
34
40
|
getType() {
|
|
35
41
|
return this.source.getType();
|
|
@@ -47,14 +53,22 @@ export class ConstraintCheckNode extends PlanNode {
|
|
|
47
53
|
this.constraintChecks.forEach(check => {
|
|
48
54
|
children.push(check.expression);
|
|
49
55
|
});
|
|
56
|
+
// Add NOT NULL DEFAULT evaluators so they participate in optimization too.
|
|
57
|
+
if (this.notNullDefaults) {
|
|
58
|
+
this.notNullDefaults.forEach(d => children.push(d.defaultNode));
|
|
59
|
+
}
|
|
50
60
|
return children;
|
|
51
61
|
}
|
|
52
62
|
withChildren(newChildren) {
|
|
53
|
-
const
|
|
63
|
+
const constraintCount = this.constraintChecks.length;
|
|
64
|
+
const defaultCount = this.notNullDefaults?.length ?? 0;
|
|
65
|
+
const expectedChildren = 1 + constraintCount + defaultCount;
|
|
54
66
|
if (newChildren.length !== expectedChildren) {
|
|
55
67
|
throw new Error(`ConstraintCheckNode expects ${expectedChildren} children, got ${newChildren.length}`);
|
|
56
68
|
}
|
|
57
|
-
const
|
|
69
|
+
const newSource = newChildren[0];
|
|
70
|
+
const newConstraintExprs = newChildren.slice(1, 1 + constraintCount);
|
|
71
|
+
const newDefaultExprs = newChildren.slice(1 + constraintCount);
|
|
58
72
|
// Type check the source
|
|
59
73
|
if (!isRelationalNode(newSource)) {
|
|
60
74
|
throw new Error('ConstraintCheckNode: first child must be a RelationalPlanNode');
|
|
@@ -66,9 +80,17 @@ export class ConstraintCheckNode extends PlanNode {
|
|
|
66
80
|
throw new Error(`ConstraintCheckNode: constraint child ${i + 1} must be a ScalarPlanNode`);
|
|
67
81
|
}
|
|
68
82
|
}
|
|
83
|
+
for (let i = 0; i < newDefaultExprs.length; i++) {
|
|
84
|
+
const expr = newDefaultExprs[i];
|
|
85
|
+
if (!isScalarNode(expr)) {
|
|
86
|
+
throw new Error(`ConstraintCheckNode: default child ${i + 1} must be a ScalarPlanNode`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
69
89
|
// Return same instance if nothing changed
|
|
70
|
-
|
|
71
|
-
|
|
90
|
+
const constraintsUnchanged = newConstraintExprs.every((expr, i) => expr === this.constraintChecks[i].expression);
|
|
91
|
+
const defaultsUnchanged = !this.notNullDefaults
|
|
92
|
+
|| newDefaultExprs.every((expr, i) => expr === this.notNullDefaults[i].defaultNode);
|
|
93
|
+
if (newSource === this.source && constraintsUnchanged && defaultsUnchanged) {
|
|
72
94
|
return this;
|
|
73
95
|
}
|
|
74
96
|
// Rebuild constraint checks with new expressions
|
|
@@ -76,8 +98,14 @@ export class ConstraintCheckNode extends PlanNode {
|
|
|
76
98
|
...check,
|
|
77
99
|
expression: newConstraintExprs[i]
|
|
78
100
|
}));
|
|
101
|
+
const newNotNullDefaults = this.notNullDefaults
|
|
102
|
+
? this.notNullDefaults.map((d, i) => ({
|
|
103
|
+
...d,
|
|
104
|
+
defaultNode: newDefaultExprs[i],
|
|
105
|
+
}))
|
|
106
|
+
: undefined;
|
|
79
107
|
// Create new instance
|
|
80
|
-
return new ConstraintCheckNode(this.scope, newSource, this.table, this.operation, this.oldRowDescriptor, this.newRowDescriptor, this.flatRowDescriptor, newConstraintChecks, this.mutationContextValues, this.contextAttributes, this.contextDescriptor);
|
|
108
|
+
return new ConstraintCheckNode(this.scope, newSource, this.table, this.operation, this.oldRowDescriptor, this.newRowDescriptor, this.flatRowDescriptor, newConstraintChecks, this.mutationContextValues, this.contextAttributes, this.contextDescriptor, this.onConflict, newNotNullDefaults);
|
|
81
109
|
}
|
|
82
110
|
get estimatedRows() {
|
|
83
111
|
return this.source.estimatedRows;
|
|
@@ -101,6 +129,8 @@ export class ConstraintCheckNode extends PlanNode {
|
|
|
101
129
|
constraintNames: this.constraintChecks.map(c => c.constraint.name || '_unnamed'),
|
|
102
130
|
hasOldDescriptor: !!this.oldRowDescriptor,
|
|
103
131
|
hasNewDescriptor: !!this.newRowDescriptor,
|
|
132
|
+
onConflict: this.onConflict,
|
|
133
|
+
notNullDefaults: this.notNullDefaults?.length ?? 0,
|
|
104
134
|
};
|
|
105
135
|
}
|
|
106
136
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constraint-check-node.js","sourceRoot":"","sources":["../../../../src/planner/nodes/constraint-check-node.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAoF,gBAAgB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC5J,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"constraint-check-node.js","sourceRoot":"","sources":["../../../../src/planner/nodes/constraint-check-node.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAoF,gBAAgB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC5J,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAmCnD;;;GAGG;AACH,MAAM,OAAO,mBAAoB,SAAQ,QAAQ;IAK7B;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAfA,QAAQ,GAAG,YAAY,CAAC,eAAe,CAAC;IAE1D,YACE,KAAY,EACI,MAA0B,EAC1B,KAAyB,EACzB,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oBpF,YAAY,CAAC,WAAW,EAAE,SAAS,QAAQ,EAAE,GAAG,QAAQ;CAuBzD"}
|
|
@@ -61,10 +61,17 @@ export class DistinctNode extends PlanNode {
|
|
|
61
61
|
const sourcePhysical = childrenPhysical[0];
|
|
62
62
|
const colCount = this.source.getAttributes().length;
|
|
63
63
|
const allColsKey = [Array.from({ length: colCount }, (_, i) => i)];
|
|
64
|
+
// Distinct strengthens an already-monotonic input from non-strict to strict.
|
|
65
|
+
// It does not establish ordering on its own.
|
|
66
|
+
const sourceMonotonic = sourcePhysical?.monotonicOn;
|
|
67
|
+
const monotonicOn = sourceMonotonic && sourceMonotonic.length > 0
|
|
68
|
+
? sourceMonotonic.map(m => ({ ...m, strict: true }))
|
|
69
|
+
: undefined;
|
|
64
70
|
return {
|
|
65
71
|
uniqueKeys: allColsKey,
|
|
66
72
|
estimatedRows: this.estimatedRows,
|
|
67
73
|
ordering: sourcePhysical?.ordering,
|
|
74
|
+
monotonicOn,
|
|
68
75
|
};
|
|
69
76
|
}
|
|
70
77
|
withChildren(newChildren) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"distinct-node.js","sourceRoot":"","sources":["../../../../src/planner/nodes/distinct-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAqE,gBAAgB,EAA2B,MAAM,gBAAgB,CAAC;AAGxJ,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD;;;GAGG;AACH,MAAM,OAAO,YAAa,SAAQ,QAAQ;IAKtB;IAJA,QAAQ,GAAG,YAAY,CAAC,QAAQ,CAAC;IAEnD,YACE,KAAY,EACI,MAA0B,EAC1C,qBAA8B;QAE9B,yFAAyF;QACzF,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,EAAE,CAAC;QACzC,MAAM,UAAU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,MAAM,EAAE,CAAC;YAC9B,OAAO,IAAI,CAAC;QACd,CAAC;QAED,mFAAmF;QACnF,OAAO,IAAI,YAAY,CACrB,IAAI,CAAC,KAAK,EACV,SAA+B,CAChC,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../../../src/planner/nodes/filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,KAAK,kBAAkB,EAAE,KAAK,cAAc,EAAE,KAAK,mBAAmB,EAAE,KAAK,SAAS,EAAkC,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC3L,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAIhD,OAAO,EAAE,gBAAgB,EAAE,KAAK,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../../../src/planner/nodes/filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,KAAK,kBAAkB,EAAE,KAAK,cAAc,EAAE,KAAK,mBAAmB,EAAE,KAAK,SAAS,EAAkC,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC3L,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAIhD,OAAO,EAAE,gBAAgB,EAAE,KAAK,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAIhG;;;;GAIG;AACH,qBAAa,UAAW,SAAQ,QAAS,YAAW,mBAAmB,EAAE,gBAAgB,EAAE,sBAAsB;aAK/F,MAAM,EAAE,kBAAkB;aAC1B,SAAS,EAAE,cAAc;IAL1C,SAAkB,QAAQ,uBAAuB;gBAGhD,KAAK,EAAE,KAAK,EACI,MAAM,EAAE,kBAAkB,EAC1B,SAAS,EAAE,cAAc,EACzC,qBAAqB,CAAC,EAAE,MAAM;IAM/B,OAAO,IAAI,YAAY;IAKvB,aAAa,IAAI,SAAS,SAAS,EAAE;IAKrC,WAAW,IAAI,SAAS,CAAC,kBAAkB,EAAE,cAAc,CAAC;IAI5D,YAAY,IAAI,SAAS,CAAC,kBAAkB,CAAC;IAI7C,IAAI,aAAa,IAAI,MAAM,GAAG,SAAS,CAOtC;IAED,eAAe,CAAC,gBAAgB,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAAC,kBAAkB,CAAC;IA8B3E,QAAQ,IAAI,MAAM;IAIlB,oBAAoB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAMxD,YAAY,CAAC,WAAW,EAAE,SAAS,QAAQ,EAAE,GAAG,QAAQ;IA6BxD,YAAY,IAAI,cAAc,GAAG,IAAI;IAIrC,aAAa,CAAC,YAAY,EAAE,cAAc,GAAG,IAAI,GAAG,QAAQ;IAiB5D,aAAa,IAAI,SAAS,cAAc,EAAE;CAG1C"}
|
|
@@ -4,6 +4,7 @@ import { formatExpression } from '../../util/plan-formatter.js';
|
|
|
4
4
|
import { quereusError } from '../../common/errors.js';
|
|
5
5
|
import { StatusCode } from '../../common/types.js';
|
|
6
6
|
import { createTableInfoFromNode, extractConstraints } from '../analysis/constraint-extractor.js';
|
|
7
|
+
import { normalizePredicate } from '../analysis/predicate-normalizer.js';
|
|
7
8
|
/**
|
|
8
9
|
* Represents a filter operation (WHERE clause).
|
|
9
10
|
* It takes an input relation and a predicate expression,
|
|
@@ -65,6 +66,8 @@ export class FilterNode extends PlanNode {
|
|
|
65
66
|
estimatedRows: rows,
|
|
66
67
|
ordering: sourcePhysical?.ordering,
|
|
67
68
|
uniqueKeys,
|
|
69
|
+
// Filter preserves monotonicOn — a predicate doesn't reorder rows.
|
|
70
|
+
monotonicOn: sourcePhysical?.monotonicOn,
|
|
68
71
|
};
|
|
69
72
|
}
|
|
70
73
|
toString() {
|
|
@@ -108,9 +111,12 @@ export class FilterNode extends PlanNode {
|
|
|
108
111
|
}
|
|
109
112
|
return new FilterNode(this.scope, this.source, newPredicate);
|
|
110
113
|
}
|
|
111
|
-
// PredicateSourceCapable interface implementation
|
|
114
|
+
// PredicateSourceCapable interface implementation:
|
|
115
|
+
// expose a normalized form so plan-walk callers (constraint extractor, etc.)
|
|
116
|
+
// see canonical predicates regardless of NOT-wrapping in the source AST.
|
|
117
|
+
// Mirrors JoinNode.getPredicates().
|
|
112
118
|
getPredicates() {
|
|
113
|
-
return [this.predicate];
|
|
119
|
+
return [normalizePredicate(this.predicate)];
|
|
114
120
|
}
|
|
115
121
|
}
|
|
116
122
|
//# sourceMappingURL=filter.js.map
|