@quereus/quereus 3.3.0 → 4.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 +7 -0
- package/dist/src/common/datatype.d.ts +12 -0
- package/dist/src/common/datatype.d.ts.map +1 -1
- package/dist/src/common/datatype.js.map +1 -1
- package/dist/src/common/types.d.ts +24 -0
- package/dist/src/common/types.d.ts.map +1 -1
- package/dist/src/common/types.js.map +1 -1
- package/dist/src/core/database-assertions.d.ts +37 -9
- package/dist/src/core/database-assertions.d.ts.map +1 -1
- package/dist/src/core/database-assertions.js +62 -110
- package/dist/src/core/database-assertions.js.map +1 -1
- package/dist/src/core/database-events.d.ts +163 -0
- package/dist/src/core/database-events.d.ts.map +1 -1
- package/dist/src/core/database-events.js +235 -21
- package/dist/src/core/database-events.js.map +1 -1
- package/dist/src/core/database-external-changes.d.ts +28 -0
- package/dist/src/core/database-external-changes.d.ts.map +1 -0
- package/dist/src/core/database-external-changes.js +242 -0
- package/dist/src/core/database-external-changes.js.map +1 -0
- package/dist/src/core/database-internal.d.ts +50 -1
- package/dist/src/core/database-internal.d.ts.map +1 -1
- package/dist/src/core/database-materialized-views.d.ts +1253 -0
- package/dist/src/core/database-materialized-views.d.ts.map +1 -0
- package/dist/src/core/database-materialized-views.js +3064 -0
- package/dist/src/core/database-materialized-views.js.map +1 -0
- package/dist/src/core/database-options.d.ts +4 -0
- package/dist/src/core/database-options.d.ts.map +1 -1
- package/dist/src/core/database-options.js +10 -0
- package/dist/src/core/database-options.js.map +1 -1
- package/dist/src/core/database-transaction.d.ts +19 -3
- package/dist/src/core/database-transaction.d.ts.map +1 -1
- package/dist/src/core/database-transaction.js +30 -3
- package/dist/src/core/database-transaction.js.map +1 -1
- package/dist/src/core/database-watchers.d.ts +19 -0
- package/dist/src/core/database-watchers.d.ts.map +1 -1
- package/dist/src/core/database-watchers.js +63 -3
- package/dist/src/core/database-watchers.js.map +1 -1
- package/dist/src/core/database.d.ts +203 -11
- package/dist/src/core/database.d.ts.map +1 -1
- package/dist/src/core/database.js +493 -29
- package/dist/src/core/database.js.map +1 -1
- package/dist/src/core/derived-row-validator.d.ts +137 -0
- package/dist/src/core/derived-row-validator.d.ts.map +1 -0
- package/dist/src/core/derived-row-validator.js +314 -0
- package/dist/src/core/derived-row-validator.js.map +1 -0
- package/dist/src/core/statement.d.ts.map +1 -1
- package/dist/src/core/statement.js +30 -9
- package/dist/src/core/statement.js.map +1 -1
- package/dist/src/emit/ast-stringify.d.ts +135 -1
- package/dist/src/emit/ast-stringify.d.ts.map +1 -1
- package/dist/src/emit/ast-stringify.js +793 -118
- package/dist/src/emit/ast-stringify.js.map +1 -1
- package/dist/src/func/builtins/aggregate.d.ts.map +1 -1
- package/dist/src/func/builtins/aggregate.js +11 -10
- package/dist/src/func/builtins/aggregate.js.map +1 -1
- package/dist/src/func/builtins/builtin-window-functions.d.ts.map +1 -1
- package/dist/src/func/builtins/builtin-window-functions.js +32 -0
- package/dist/src/func/builtins/builtin-window-functions.js.map +1 -1
- package/dist/src/func/builtins/explain.d.ts +3 -0
- package/dist/src/func/builtins/explain.d.ts.map +1 -1
- package/dist/src/func/builtins/explain.js +229 -0
- package/dist/src/func/builtins/explain.js.map +1 -1
- package/dist/src/func/builtins/index.d.ts.map +1 -1
- package/dist/src/func/builtins/index.js +10 -2
- package/dist/src/func/builtins/index.js.map +1 -1
- package/dist/src/func/builtins/json.d.ts.map +1 -1
- package/dist/src/func/builtins/json.js +3 -2
- package/dist/src/func/builtins/json.js.map +1 -1
- package/dist/src/func/builtins/mutation.d.ts +2 -0
- package/dist/src/func/builtins/mutation.d.ts.map +1 -0
- package/dist/src/func/builtins/mutation.js +53 -0
- package/dist/src/func/builtins/mutation.js.map +1 -0
- package/dist/src/func/builtins/schema.d.ts +2 -0
- package/dist/src/func/builtins/schema.d.ts.map +1 -1
- package/dist/src/func/builtins/schema.js +713 -26
- package/dist/src/func/builtins/schema.js.map +1 -1
- package/dist/src/func/builtins/string.js +1 -1
- package/dist/src/func/builtins/string.js.map +1 -1
- package/dist/src/func/registration.d.ts +9 -0
- package/dist/src/func/registration.d.ts.map +1 -1
- package/dist/src/func/registration.js +4 -0
- package/dist/src/func/registration.js.map +1 -1
- package/dist/src/index.d.ts +25 -6
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +27 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/parser/ast.d.ts +353 -21
- package/dist/src/parser/ast.d.ts.map +1 -1
- package/dist/src/parser/index.d.ts +14 -1
- package/dist/src/parser/index.d.ts.map +1 -1
- package/dist/src/parser/index.js +19 -0
- package/dist/src/parser/index.js.map +1 -1
- package/dist/src/parser/lexer.d.ts +9 -0
- package/dist/src/parser/lexer.d.ts.map +1 -1
- package/dist/src/parser/lexer.js +9 -0
- package/dist/src/parser/lexer.js.map +1 -1
- package/dist/src/parser/parser.d.ts +276 -7
- package/dist/src/parser/parser.d.ts.map +1 -1
- package/dist/src/parser/parser.js +1387 -469
- package/dist/src/parser/parser.js.map +1 -1
- package/dist/src/parser/visitor.d.ts.map +1 -1
- package/dist/src/parser/visitor.js +12 -8
- package/dist/src/parser/visitor.js.map +1 -1
- package/dist/src/planner/analysis/assertion-classifier.d.ts.map +1 -1
- package/dist/src/planner/analysis/assertion-classifier.js +4 -0
- package/dist/src/planner/analysis/assertion-classifier.js.map +1 -1
- package/dist/src/planner/analysis/assertion-hoist-cache.d.ts.map +1 -1
- package/dist/src/planner/analysis/assertion-hoist-cache.js +8 -4
- package/dist/src/planner/analysis/assertion-hoist-cache.js.map +1 -1
- package/dist/src/planner/analysis/authored-inverse.d.ts +22 -0
- package/dist/src/planner/analysis/authored-inverse.d.ts.map +1 -0
- package/dist/src/planner/analysis/authored-inverse.js +267 -0
- package/dist/src/planner/analysis/authored-inverse.js.map +1 -0
- package/dist/src/planner/analysis/change-scope.d.ts +34 -4
- package/dist/src/planner/analysis/change-scope.d.ts.map +1 -1
- package/dist/src/planner/analysis/change-scope.js +108 -7
- package/dist/src/planner/analysis/change-scope.js.map +1 -1
- package/dist/src/planner/analysis/check-extraction.d.ts +36 -2
- package/dist/src/planner/analysis/check-extraction.d.ts.map +1 -1
- package/dist/src/planner/analysis/check-extraction.js +174 -46
- package/dist/src/planner/analysis/check-extraction.js.map +1 -1
- package/dist/src/planner/analysis/coarsened-key.d.ts +109 -0
- package/dist/src/planner/analysis/coarsened-key.d.ts.map +1 -0
- package/dist/src/planner/analysis/coarsened-key.js +228 -0
- package/dist/src/planner/analysis/coarsened-key.js.map +1 -0
- package/dist/src/planner/analysis/comparison-collation.d.ts +216 -0
- package/dist/src/planner/analysis/comparison-collation.d.ts.map +1 -0
- package/dist/src/planner/analysis/comparison-collation.js +341 -0
- package/dist/src/planner/analysis/comparison-collation.js.map +1 -0
- package/dist/src/planner/analysis/constraint-extractor.d.ts +3 -1
- package/dist/src/planner/analysis/constraint-extractor.d.ts.map +1 -1
- package/dist/src/planner/analysis/constraint-extractor.js +192 -9
- package/dist/src/planner/analysis/constraint-extractor.js.map +1 -1
- package/dist/src/planner/analysis/coverage-prover.d.ts +321 -0
- package/dist/src/planner/analysis/coverage-prover.d.ts.map +1 -0
- package/dist/src/planner/analysis/coverage-prover.js +1038 -0
- package/dist/src/planner/analysis/coverage-prover.js.map +1 -0
- package/dist/src/planner/analysis/key-filter.d.ts +22 -0
- package/dist/src/planner/analysis/key-filter.d.ts.map +1 -0
- package/dist/src/planner/analysis/key-filter.js +105 -0
- package/dist/src/planner/analysis/key-filter.js.map +1 -0
- package/dist/src/planner/analysis/partial-unique-extraction.d.ts +36 -1
- package/dist/src/planner/analysis/partial-unique-extraction.d.ts.map +1 -1
- package/dist/src/planner/analysis/partial-unique-extraction.js +148 -22
- package/dist/src/planner/analysis/partial-unique-extraction.js.map +1 -1
- package/dist/src/planner/analysis/predicate-normalizer.d.ts.map +1 -1
- package/dist/src/planner/analysis/predicate-normalizer.js +30 -1
- package/dist/src/planner/analysis/predicate-normalizer.js.map +1 -1
- package/dist/src/planner/analysis/predicate-shape.d.ts +36 -1
- package/dist/src/planner/analysis/predicate-shape.d.ts.map +1 -1
- package/dist/src/planner/analysis/predicate-shape.js +51 -13
- package/dist/src/planner/analysis/predicate-shape.js.map +1 -1
- package/dist/src/planner/analysis/query-rewrite-matcher.d.ts +314 -0
- package/dist/src/planner/analysis/query-rewrite-matcher.d.ts.map +1 -0
- package/dist/src/planner/analysis/query-rewrite-matcher.js +1081 -0
- package/dist/src/planner/analysis/query-rewrite-matcher.js.map +1 -0
- package/dist/src/planner/analysis/scalar-invertibility.d.ts +92 -0
- package/dist/src/planner/analysis/scalar-invertibility.d.ts.map +1 -0
- package/dist/src/planner/analysis/scalar-invertibility.js +129 -0
- package/dist/src/planner/analysis/scalar-invertibility.js.map +1 -0
- package/dist/src/planner/analysis/update-lineage.d.ts +196 -0
- package/dist/src/planner/analysis/update-lineage.d.ts.map +1 -0
- package/dist/src/planner/analysis/update-lineage.js +322 -0
- package/dist/src/planner/analysis/update-lineage.js.map +1 -0
- package/dist/src/planner/analysis/view-complement.d.ts +42 -0
- package/dist/src/planner/analysis/view-complement.d.ts.map +1 -0
- package/dist/src/planner/analysis/view-complement.js +54 -0
- package/dist/src/planner/analysis/view-complement.js.map +1 -0
- package/dist/src/planner/building/alter-table.d.ts +1 -1
- package/dist/src/planner/building/alter-table.d.ts.map +1 -1
- package/dist/src/planner/building/alter-table.js +211 -2
- package/dist/src/planner/building/alter-table.js.map +1 -1
- package/dist/src/planner/building/block.d.ts.map +1 -1
- package/dist/src/planner/building/block.js +18 -1
- package/dist/src/planner/building/block.js.map +1 -1
- package/dist/src/planner/building/constraint-builder.d.ts +33 -5
- package/dist/src/planner/building/constraint-builder.d.ts.map +1 -1
- package/dist/src/planner/building/constraint-builder.js +63 -28
- package/dist/src/planner/building/constraint-builder.js.map +1 -1
- package/dist/src/planner/building/create-view.d.ts +9 -0
- package/dist/src/planner/building/create-view.d.ts.map +1 -1
- package/dist/src/planner/building/create-view.js +41 -12
- package/dist/src/planner/building/create-view.js.map +1 -1
- package/dist/src/planner/building/ddl.d.ts.map +1 -1
- package/dist/src/planner/building/ddl.js +94 -0
- package/dist/src/planner/building/ddl.js.map +1 -1
- package/dist/src/planner/building/declare-schema.d.ts +1 -0
- package/dist/src/planner/building/declare-schema.d.ts.map +1 -1
- package/dist/src/planner/building/declare-schema.js +4 -1
- package/dist/src/planner/building/declare-schema.js.map +1 -1
- package/dist/src/planner/building/default-scope.d.ts +26 -0
- package/dist/src/planner/building/default-scope.d.ts.map +1 -0
- package/dist/src/planner/building/default-scope.js +41 -0
- package/dist/src/planner/building/default-scope.js.map +1 -0
- package/dist/src/planner/building/delete.d.ts +19 -1
- package/dist/src/planner/building/delete.d.ts.map +1 -1
- package/dist/src/planner/building/delete.js +109 -30
- package/dist/src/planner/building/delete.js.map +1 -1
- package/dist/src/planner/building/dml-target.d.ts +118 -0
- package/dist/src/planner/building/dml-target.d.ts.map +1 -0
- package/dist/src/planner/building/dml-target.js +282 -0
- package/dist/src/planner/building/dml-target.js.map +1 -0
- package/dist/src/planner/building/drop-index.d.ts.map +1 -1
- package/dist/src/planner/building/drop-index.js +4 -1
- package/dist/src/planner/building/drop-index.js.map +1 -1
- package/dist/src/planner/building/drop-view.d.ts.map +1 -1
- package/dist/src/planner/building/drop-view.js +4 -2
- package/dist/src/planner/building/drop-view.js.map +1 -1
- package/dist/src/planner/building/expression.d.ts.map +1 -1
- package/dist/src/planner/building/expression.js +60 -21
- package/dist/src/planner/building/expression.js.map +1 -1
- package/dist/src/planner/building/foreign-key-builder.d.ts +30 -0
- package/dist/src/planner/building/foreign-key-builder.d.ts.map +1 -1
- package/dist/src/planner/building/foreign-key-builder.js +160 -129
- package/dist/src/planner/building/foreign-key-builder.js.map +1 -1
- package/dist/src/planner/building/insert.d.ts +45 -2
- package/dist/src/planner/building/insert.d.ts.map +1 -1
- package/dist/src/planner/building/insert.js +257 -88
- package/dist/src/planner/building/insert.js.map +1 -1
- package/dist/src/planner/building/lens-auxiliary-access.d.ts +22 -0
- package/dist/src/planner/building/lens-auxiliary-access.d.ts.map +1 -0
- package/dist/src/planner/building/lens-auxiliary-access.js +132 -0
- package/dist/src/planner/building/lens-auxiliary-access.js.map +1 -0
- package/dist/src/planner/building/materialized-view.d.ts +16 -0
- package/dist/src/planner/building/materialized-view.d.ts.map +1 -0
- package/dist/src/planner/building/materialized-view.js +57 -0
- package/dist/src/planner/building/materialized-view.js.map +1 -0
- package/dist/src/planner/building/returning-star.d.ts +32 -0
- package/dist/src/planner/building/returning-star.d.ts.map +1 -0
- package/dist/src/planner/building/returning-star.js +45 -0
- package/dist/src/planner/building/returning-star.js.map +1 -0
- package/dist/src/planner/building/select-aggregates.d.ts.map +1 -1
- package/dist/src/planner/building/select-aggregates.js +47 -0
- package/dist/src/planner/building/select-aggregates.js.map +1 -1
- package/dist/src/planner/building/select-compound.d.ts.map +1 -1
- package/dist/src/planner/building/select-compound.js +84 -11
- package/dist/src/planner/building/select-compound.js.map +1 -1
- package/dist/src/planner/building/select-context.d.ts +10 -2
- package/dist/src/planner/building/select-context.d.ts.map +1 -1
- package/dist/src/planner/building/select-context.js +7 -1
- package/dist/src/planner/building/select-context.js.map +1 -1
- package/dist/src/planner/building/select-modifiers.js +6 -0
- package/dist/src/planner/building/select-modifiers.js.map +1 -1
- package/dist/src/planner/building/select-ordinal.d.ts +18 -0
- package/dist/src/planner/building/select-ordinal.d.ts.map +1 -1
- package/dist/src/planner/building/select-ordinal.js +30 -0
- package/dist/src/planner/building/select-ordinal.js.map +1 -1
- package/dist/src/planner/building/select-projections.d.ts +8 -2
- package/dist/src/planner/building/select-projections.d.ts.map +1 -1
- package/dist/src/planner/building/select-projections.js +26 -4
- package/dist/src/planner/building/select-projections.js.map +1 -1
- package/dist/src/planner/building/select-window.d.ts.map +1 -1
- package/dist/src/planner/building/select-window.js +8 -5
- package/dist/src/planner/building/select-window.js.map +1 -1
- package/dist/src/planner/building/select.d.ts.map +1 -1
- package/dist/src/planner/building/select.js +164 -59
- package/dist/src/planner/building/select.js.map +1 -1
- package/dist/src/planner/building/set-object-tags.d.ts +7 -0
- package/dist/src/planner/building/set-object-tags.d.ts.map +1 -0
- package/dist/src/planner/building/set-object-tags.js +38 -0
- package/dist/src/planner/building/set-object-tags.js.map +1 -0
- package/dist/src/planner/building/tag-diagnostics.d.ts +27 -0
- package/dist/src/planner/building/tag-diagnostics.d.ts.map +1 -0
- package/dist/src/planner/building/tag-diagnostics.js +37 -0
- package/dist/src/planner/building/tag-diagnostics.js.map +1 -0
- package/dist/src/planner/building/update.d.ts +18 -1
- package/dist/src/planner/building/update.d.ts.map +1 -1
- package/dist/src/planner/building/update.js +134 -58
- package/dist/src/planner/building/update.js.map +1 -1
- package/dist/src/planner/building/view-mutation-builder.d.ts +15 -0
- package/dist/src/planner/building/view-mutation-builder.d.ts.map +1 -0
- package/dist/src/planner/building/view-mutation-builder.js +1158 -0
- package/dist/src/planner/building/view-mutation-builder.js.map +1 -0
- package/dist/src/planner/building/with.d.ts +11 -0
- package/dist/src/planner/building/with.d.ts.map +1 -1
- package/dist/src/planner/building/with.js +48 -10
- package/dist/src/planner/building/with.js.map +1 -1
- package/dist/src/planner/cost/index.d.ts +83 -0
- package/dist/src/planner/cost/index.d.ts.map +1 -1
- package/dist/src/planner/cost/index.js +114 -0
- package/dist/src/planner/cost/index.js.map +1 -1
- package/dist/src/planner/framework/characteristics.d.ts +38 -4
- package/dist/src/planner/framework/characteristics.d.ts.map +1 -1
- package/dist/src/planner/framework/characteristics.js +50 -6
- 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 +2 -1
- package/dist/src/planner/framework/pass.js.map +1 -1
- package/dist/src/planner/framework/registry.d.ts +39 -1
- package/dist/src/planner/framework/registry.d.ts.map +1 -1
- package/dist/src/planner/framework/registry.js +18 -2
- package/dist/src/planner/framework/registry.js.map +1 -1
- package/dist/src/planner/mutation/backward-body.d.ts +131 -0
- package/dist/src/planner/mutation/backward-body.d.ts.map +1 -0
- package/dist/src/planner/mutation/backward-body.js +135 -0
- package/dist/src/planner/mutation/backward-body.js.map +1 -0
- package/dist/src/planner/mutation/cte-flatten.d.ts +17 -0
- package/dist/src/planner/mutation/cte-flatten.d.ts.map +1 -0
- package/dist/src/planner/mutation/cte-flatten.js +364 -0
- package/dist/src/planner/mutation/cte-flatten.js.map +1 -0
- package/dist/src/planner/mutation/decomposition.d.ts +273 -0
- package/dist/src/planner/mutation/decomposition.d.ts.map +1 -0
- package/dist/src/planner/mutation/decomposition.js +1719 -0
- package/dist/src/planner/mutation/decomposition.js.map +1 -0
- package/dist/src/planner/mutation/lens-enforcement.d.ts +165 -0
- package/dist/src/planner/mutation/lens-enforcement.d.ts.map +1 -0
- package/dist/src/planner/mutation/lens-enforcement.js +745 -0
- package/dist/src/planner/mutation/lens-enforcement.js.map +1 -0
- package/dist/src/planner/mutation/multi-source.d.ts +568 -0
- package/dist/src/planner/mutation/multi-source.d.ts.map +1 -0
- package/dist/src/planner/mutation/multi-source.js +2915 -0
- package/dist/src/planner/mutation/multi-source.js.map +1 -0
- package/dist/src/planner/mutation/mutation-diagnostic.d.ts +37 -0
- package/dist/src/planner/mutation/mutation-diagnostic.d.ts.map +1 -0
- package/dist/src/planner/mutation/mutation-diagnostic.js +24 -0
- package/dist/src/planner/mutation/mutation-diagnostic.js.map +1 -0
- package/dist/src/planner/mutation/mutation-tags.d.ts +33 -0
- package/dist/src/planner/mutation/mutation-tags.d.ts.map +1 -0
- package/dist/src/planner/mutation/mutation-tags.js +31 -0
- package/dist/src/planner/mutation/mutation-tags.js.map +1 -0
- package/dist/src/planner/mutation/propagate.d.ts +97 -0
- package/dist/src/planner/mutation/propagate.d.ts.map +1 -0
- package/dist/src/planner/mutation/propagate.js +220 -0
- package/dist/src/planner/mutation/propagate.js.map +1 -0
- package/dist/src/planner/mutation/scope-transform.d.ts +181 -0
- package/dist/src/planner/mutation/scope-transform.d.ts.map +1 -0
- package/dist/src/planner/mutation/scope-transform.js +574 -0
- package/dist/src/planner/mutation/scope-transform.js.map +1 -0
- package/dist/src/planner/mutation/set-op.d.ts +242 -0
- package/dist/src/planner/mutation/set-op.d.ts.map +1 -0
- package/dist/src/planner/mutation/set-op.js +1687 -0
- package/dist/src/planner/mutation/set-op.js.map +1 -0
- package/dist/src/planner/mutation/single-source.d.ts +261 -0
- package/dist/src/planner/mutation/single-source.d.ts.map +1 -0
- package/dist/src/planner/mutation/single-source.js +1096 -0
- package/dist/src/planner/mutation/single-source.js.map +1 -0
- package/dist/src/planner/nodes/aggregate-node.js +3 -3
- 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 +5 -1
- package/dist/src/planner/nodes/alias-node.js.map +1 -1
- package/dist/src/planner/nodes/alter-table-node.d.ts +124 -1
- package/dist/src/planner/nodes/alter-table-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/alter-table-node.js +27 -0
- package/dist/src/planner/nodes/alter-table-node.js.map +1 -1
- package/dist/src/planner/nodes/analyze-node.d.ts +2 -1
- package/dist/src/planner/nodes/analyze-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/analyze-node.js +18 -1
- package/dist/src/planner/nodes/analyze-node.js.map +1 -1
- package/dist/src/planner/nodes/asserted-keys-node.d.ts +43 -0
- package/dist/src/planner/nodes/asserted-keys-node.d.ts.map +1 -0
- package/dist/src/planner/nodes/asserted-keys-node.js +99 -0
- package/dist/src/planner/nodes/asserted-keys-node.js.map +1 -0
- package/dist/src/planner/nodes/async-gather-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/async-gather-node.js +33 -8
- package/dist/src/planner/nodes/async-gather-node.js.map +1 -1
- package/dist/src/planner/nodes/bloom-join-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/bloom-join-node.js +2 -1
- package/dist/src/planner/nodes/bloom-join-node.js.map +1 -1
- package/dist/src/planner/nodes/create-view-node.d.ts +7 -2
- package/dist/src/planner/nodes/create-view-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/create-view-node.js +4 -1
- package/dist/src/planner/nodes/create-view-node.js.map +1 -1
- package/dist/src/planner/nodes/declarative-schema.d.ts +13 -1
- package/dist/src/planner/nodes/declarative-schema.d.ts.map +1 -1
- package/dist/src/planner/nodes/declarative-schema.js +32 -0
- package/dist/src/planner/nodes/declarative-schema.js.map +1 -1
- package/dist/src/planner/nodes/distinct-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/distinct-node.js +2 -0
- package/dist/src/planner/nodes/distinct-node.js.map +1 -1
- package/dist/src/planner/nodes/dml-executor-node.d.ts +29 -1
- package/dist/src/planner/nodes/dml-executor-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/dml-executor-node.js +27 -3
- package/dist/src/planner/nodes/dml-executor-node.js.map +1 -1
- package/dist/src/planner/nodes/eager-prefetch-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/eager-prefetch-node.js +2 -0
- package/dist/src/planner/nodes/eager-prefetch-node.js.map +1 -1
- package/dist/src/planner/nodes/envelope-scan-node.d.ts +42 -0
- package/dist/src/planner/nodes/envelope-scan-node.d.ts.map +1 -0
- package/dist/src/planner/nodes/envelope-scan-node.js +62 -0
- package/dist/src/planner/nodes/envelope-scan-node.js.map +1 -0
- package/dist/src/planner/nodes/fanout-lookup-join-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/fanout-lookup-join-node.js +11 -1
- package/dist/src/planner/nodes/fanout-lookup-join-node.js.map +1 -1
- package/dist/src/planner/nodes/filter.d.ts.map +1 -1
- package/dist/src/planner/nodes/filter.js +63 -13
- package/dist/src/planner/nodes/filter.js.map +1 -1
- package/dist/src/planner/nodes/join-node.d.ts +41 -1
- package/dist/src/planner/nodes/join-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/join-node.js +78 -8
- package/dist/src/planner/nodes/join-node.js.map +1 -1
- package/dist/src/planner/nodes/join-utils.d.ts +33 -6
- package/dist/src/planner/nodes/join-utils.d.ts.map +1 -1
- package/dist/src/planner/nodes/join-utils.js +124 -9
- package/dist/src/planner/nodes/join-utils.js.map +1 -1
- package/dist/src/planner/nodes/lens-auxiliary-access-node.d.ts +104 -0
- package/dist/src/planner/nodes/lens-auxiliary-access-node.d.ts.map +1 -0
- package/dist/src/planner/nodes/lens-auxiliary-access-node.js +91 -0
- package/dist/src/planner/nodes/lens-auxiliary-access-node.js.map +1 -0
- package/dist/src/planner/nodes/limit-offset.d.ts.map +1 -1
- package/dist/src/planner/nodes/limit-offset.js +4 -5
- package/dist/src/planner/nodes/limit-offset.js.map +1 -1
- package/dist/src/planner/nodes/materialized-view-nodes.d.ts +69 -0
- package/dist/src/planner/nodes/materialized-view-nodes.d.ts.map +1 -0
- package/dist/src/planner/nodes/materialized-view-nodes.js +111 -0
- package/dist/src/planner/nodes/materialized-view-nodes.js.map +1 -0
- package/dist/src/planner/nodes/merge-join-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/merge-join-node.js +2 -1
- package/dist/src/planner/nodes/merge-join-node.js.map +1 -1
- package/dist/src/planner/nodes/ordinal-slice-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/ordinal-slice-node.js +2 -0
- package/dist/src/planner/nodes/ordinal-slice-node.js.map +1 -1
- package/dist/src/planner/nodes/plan-node-type.d.ts +9 -0
- package/dist/src/planner/nodes/plan-node-type.d.ts.map +1 -1
- package/dist/src/planner/nodes/plan-node-type.js +9 -0
- package/dist/src/planner/nodes/plan-node-type.js.map +1 -1
- package/dist/src/planner/nodes/plan-node.d.ts +265 -5
- package/dist/src/planner/nodes/plan-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/plan-node.js.map +1 -1
- package/dist/src/planner/nodes/pragma.d.ts +2 -1
- package/dist/src/planner/nodes/pragma.d.ts.map +1 -1
- package/dist/src/planner/nodes/pragma.js +12 -0
- package/dist/src/planner/nodes/pragma.js.map +1 -1
- package/dist/src/planner/nodes/project-node.d.ts +14 -1
- package/dist/src/planner/nodes/project-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/project-node.js +85 -11
- package/dist/src/planner/nodes/project-node.js.map +1 -1
- package/dist/src/planner/nodes/reference.d.ts.map +1 -1
- package/dist/src/planner/nodes/reference.js +62 -27
- package/dist/src/planner/nodes/reference.js.map +1 -1
- package/dist/src/planner/nodes/retrieve-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/retrieve-node.js +7 -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 +10 -3
- package/dist/src/planner/nodes/returning-node.js.map +1 -1
- package/dist/src/planner/nodes/scalar.d.ts +20 -0
- package/dist/src/planner/nodes/scalar.d.ts.map +1 -1
- package/dist/src/planner/nodes/scalar.js +71 -14
- package/dist/src/planner/nodes/scalar.js.map +1 -1
- package/dist/src/planner/nodes/set-object-tags-node.d.ts +39 -0
- package/dist/src/planner/nodes/set-object-tags-node.d.ts.map +1 -0
- package/dist/src/planner/nodes/set-object-tags-node.js +41 -0
- package/dist/src/planner/nodes/set-object-tags-node.js.map +1 -0
- package/dist/src/planner/nodes/set-operation-node.d.ts +123 -1
- package/dist/src/planner/nodes/set-operation-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/set-operation-node.js +291 -18
- 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 -0
- 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 +7 -6
- package/dist/src/planner/nodes/sort.js.map +1 -1
- package/dist/src/planner/nodes/subquery.d.ts +2 -0
- package/dist/src/planner/nodes/subquery.d.ts.map +1 -1
- package/dist/src/planner/nodes/subquery.js +18 -2
- package/dist/src/planner/nodes/subquery.js.map +1 -1
- package/dist/src/planner/nodes/table-access-nodes.d.ts.map +1 -1
- package/dist/src/planner/nodes/table-access-nodes.js +23 -3
- package/dist/src/planner/nodes/table-access-nodes.js.map +1 -1
- package/dist/src/planner/nodes/table-function-call.js +6 -0
- package/dist/src/planner/nodes/table-function-call.js.map +1 -1
- package/dist/src/planner/nodes/values-node.d.ts +1 -0
- package/dist/src/planner/nodes/values-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/values-node.js +16 -6
- package/dist/src/planner/nodes/values-node.js.map +1 -1
- package/dist/src/planner/nodes/view-mutation-node.d.ts +259 -0
- package/dist/src/planner/nodes/view-mutation-node.d.ts.map +1 -0
- package/dist/src/planner/nodes/view-mutation-node.js +273 -0
- package/dist/src/planner/nodes/view-mutation-node.js.map +1 -0
- package/dist/src/planner/nodes/window-function.d.ts +17 -1
- package/dist/src/planner/nodes/window-function.d.ts.map +1 -1
- package/dist/src/planner/nodes/window-function.js +15 -1
- package/dist/src/planner/nodes/window-function.js.map +1 -1
- package/dist/src/planner/nodes/window-node.js +2 -2
- package/dist/src/planner/nodes/window-node.js.map +1 -1
- package/dist/src/planner/optimizer.d.ts.map +1 -1
- package/dist/src/planner/optimizer.js +372 -39
- package/dist/src/planner/optimizer.js.map +1 -1
- package/dist/src/planner/planning-context.d.ts +1 -1
- package/dist/src/planner/planning-context.d.ts.map +1 -1
- package/dist/src/planner/rules/access/lens-access-form-matcher.d.ts +70 -0
- package/dist/src/planner/rules/access/lens-access-form-matcher.d.ts.map +1 -0
- package/dist/src/planner/rules/access/lens-access-form-matcher.js +156 -0
- package/dist/src/planner/rules/access/lens-access-form-matcher.js.map +1 -0
- package/dist/src/planner/rules/access/rule-lens-auxiliary-access.d.ts +31 -0
- package/dist/src/planner/rules/access/rule-lens-auxiliary-access.d.ts.map +1 -0
- package/dist/src/planner/rules/access/rule-lens-auxiliary-access.js +176 -0
- package/dist/src/planner/rules/access/rule-lens-auxiliary-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 +435 -37
- 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.map +1 -1
- package/dist/src/planner/rules/aggregate/rule-groupby-fd-simplification.js +9 -0
- package/dist/src/planner/rules/aggregate/rule-groupby-fd-simplification.js.map +1 -1
- package/dist/src/planner/rules/cache/rule-materialized-view-rewrite.d.ts +39 -0
- package/dist/src/planner/rules/cache/rule-materialized-view-rewrite.d.ts.map +1 -0
- package/dist/src/planner/rules/cache/rule-materialized-view-rewrite.js +616 -0
- package/dist/src/planner/rules/cache/rule-materialized-view-rewrite.js.map +1 -0
- package/dist/src/planner/rules/cache/rule-scalar-cse.d.ts.map +1 -1
- package/dist/src/planner/rules/cache/rule-scalar-cse.js +8 -1
- package/dist/src/planner/rules/cache/rule-scalar-cse.js.map +1 -1
- package/dist/src/planner/rules/join/equi-pair-extractor.d.ts +36 -0
- package/dist/src/planner/rules/join/equi-pair-extractor.d.ts.map +1 -1
- package/dist/src/planner/rules/join/equi-pair-extractor.js +38 -1
- package/dist/src/planner/rules/join/equi-pair-extractor.js.map +1 -1
- package/dist/src/planner/rules/join/rule-fanout-batched-outer.d.ts.map +1 -1
- package/dist/src/planner/rules/join/rule-fanout-batched-outer.js +10 -0
- package/dist/src/planner/rules/join/rule-fanout-batched-outer.js.map +1 -1
- package/dist/src/planner/rules/join/rule-fanout-lookup-join.d.ts.map +1 -1
- package/dist/src/planner/rules/join/rule-fanout-lookup-join.js +19 -1
- package/dist/src/planner/rules/join/rule-fanout-lookup-join.js.map +1 -1
- package/dist/src/planner/rules/join/rule-inner-join-existence-recovery.d.ts +130 -0
- package/dist/src/planner/rules/join/rule-inner-join-existence-recovery.d.ts.map +1 -0
- package/dist/src/planner/rules/join/rule-inner-join-existence-recovery.js +206 -0
- package/dist/src/planner/rules/join/rule-inner-join-existence-recovery.js.map +1 -0
- package/dist/src/planner/rules/join/rule-join-elimination.d.ts +67 -14
- package/dist/src/planner/rules/join/rule-join-elimination.d.ts.map +1 -1
- package/dist/src/planner/rules/join/rule-join-elimination.js +81 -25
- package/dist/src/planner/rules/join/rule-join-elimination.js.map +1 -1
- package/dist/src/planner/rules/join/rule-join-existence-pruning.d.ts +84 -0
- package/dist/src/planner/rules/join/rule-join-existence-pruning.d.ts.map +1 -0
- package/dist/src/planner/rules/join/rule-join-existence-pruning.js +138 -0
- package/dist/src/planner/rules/join/rule-join-existence-pruning.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 +9 -1
- 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 +12 -1
- 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.map +1 -1
- package/dist/src/planner/rules/join/rule-lateral-top1-asof.js +4 -0
- package/dist/src/planner/rules/join/rule-lateral-top1-asof.js.map +1 -1
- package/dist/src/planner/rules/join/rule-monotonic-merge-join.d.ts.map +1 -1
- package/dist/src/planner/rules/join/rule-monotonic-merge-join.js +4 -0
- package/dist/src/planner/rules/join/rule-monotonic-merge-join.js.map +1 -1
- package/dist/src/planner/rules/join/rule-quickpick-enumeration.d.ts.map +1 -1
- package/dist/src/planner/rules/join/rule-quickpick-enumeration.js +10 -0
- package/dist/src/planner/rules/join/rule-quickpick-enumeration.js.map +1 -1
- package/dist/src/planner/rules/join/rule-semijoin-existence-recovery.d.ts +286 -0
- package/dist/src/planner/rules/join/rule-semijoin-existence-recovery.d.ts.map +1 -0
- package/dist/src/planner/rules/join/rule-semijoin-existence-recovery.js +548 -0
- package/dist/src/planner/rules/join/rule-semijoin-existence-recovery.js.map +1 -0
- package/dist/src/planner/rules/parallel/rule-async-gather-union-all.d.ts.map +1 -1
- package/dist/src/planner/rules/parallel/rule-async-gather-union-all.js +9 -1
- package/dist/src/planner/rules/parallel/rule-async-gather-union-all.js.map +1 -1
- package/dist/src/planner/rules/parallel/rule-async-gather-zip-by-key.d.ts.map +1 -1
- package/dist/src/planner/rules/parallel/rule-async-gather-zip-by-key.js +7 -0
- package/dist/src/planner/rules/parallel/rule-async-gather-zip-by-key.js.map +1 -1
- package/dist/src/planner/rules/parallel/rule-eager-prefetch-probe.d.ts.map +1 -1
- package/dist/src/planner/rules/parallel/rule-eager-prefetch-probe.js +10 -1
- package/dist/src/planner/rules/parallel/rule-eager-prefetch-probe.js.map +1 -1
- package/dist/src/planner/rules/predicate/rule-aggregate-predicate-pushdown.d.ts.map +1 -1
- package/dist/src/planner/rules/predicate/rule-aggregate-predicate-pushdown.js +9 -0
- package/dist/src/planner/rules/predicate/rule-aggregate-predicate-pushdown.js.map +1 -1
- package/dist/src/planner/rules/predicate/rule-empty-relation-folding.d.ts.map +1 -1
- package/dist/src/planner/rules/predicate/rule-empty-relation-folding.js +18 -0
- package/dist/src/planner/rules/predicate/rule-empty-relation-folding.js.map +1 -1
- package/dist/src/planner/rules/predicate/rule-filter-contradiction.d.ts.map +1 -1
- package/dist/src/planner/rules/predicate/rule-filter-contradiction.js +7 -0
- package/dist/src/planner/rules/predicate/rule-filter-contradiction.js.map +1 -1
- package/dist/src/planner/rules/predicate/rule-predicate-inference-equivalence.d.ts.map +1 -1
- package/dist/src/planner/rules/predicate/rule-predicate-inference-equivalence.js +9 -0
- package/dist/src/planner/rules/predicate/rule-predicate-inference-equivalence.js.map +1 -1
- package/dist/src/planner/rules/predicate/rule-predicate-pushdown.js +13 -3
- package/dist/src/planner/rules/predicate/rule-predicate-pushdown.js.map +1 -1
- package/dist/src/planner/rules/retrieve/rule-projection-pruning.d.ts.map +1 -1
- package/dist/src/planner/rules/retrieve/rule-projection-pruning.js +14 -0
- package/dist/src/planner/rules/retrieve/rule-projection-pruning.js.map +1 -1
- package/dist/src/planner/rules/sort/rule-orderby-fd-pruning.d.ts +1 -1
- package/dist/src/planner/rules/sort/rule-orderby-fd-pruning.js +4 -4
- package/dist/src/planner/rules/sort/rule-orderby-fd-pruning.js.map +1 -1
- package/dist/src/planner/rules/subquery/rule-anti-join-fk-empty.d.ts.map +1 -1
- package/dist/src/planner/rules/subquery/rule-anti-join-fk-empty.js +8 -0
- package/dist/src/planner/rules/subquery/rule-anti-join-fk-empty.js.map +1 -1
- package/dist/src/planner/rules/subquery/rule-semi-join-fk-trivial.d.ts.map +1 -1
- package/dist/src/planner/rules/subquery/rule-semi-join-fk-trivial.js +7 -0
- package/dist/src/planner/rules/subquery/rule-semi-join-fk-trivial.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 +12 -0
- package/dist/src/planner/rules/subquery/rule-subquery-decorrelation.js.map +1 -1
- package/dist/src/planner/type-utils.d.ts +14 -0
- package/dist/src/planner/type-utils.d.ts.map +1 -1
- package/dist/src/planner/type-utils.js +66 -21
- package/dist/src/planner/type-utils.js.map +1 -1
- package/dist/src/planner/util/fd-utils.d.ts +177 -43
- package/dist/src/planner/util/fd-utils.d.ts.map +1 -1
- package/dist/src/planner/util/fd-utils.js +396 -101
- package/dist/src/planner/util/fd-utils.js.map +1 -1
- package/dist/src/planner/util/ind-utils.d.ts +27 -1
- package/dist/src/planner/util/ind-utils.d.ts.map +1 -1
- package/dist/src/planner/util/ind-utils.js +80 -6
- package/dist/src/planner/util/ind-utils.js.map +1 -1
- package/dist/src/planner/util/key-utils.d.ts.map +1 -1
- package/dist/src/planner/util/key-utils.js +81 -12
- package/dist/src/planner/util/key-utils.js.map +1 -1
- package/dist/src/planner/util/set-op-wrapper.d.ts +37 -0
- package/dist/src/planner/util/set-op-wrapper.d.ts.map +1 -0
- package/dist/src/planner/util/set-op-wrapper.js +82 -0
- package/dist/src/planner/util/set-op-wrapper.js.map +1 -0
- package/dist/src/planner/validation/plan-validator.d.ts.map +1 -1
- package/dist/src/planner/validation/plan-validator.js +1 -0
- package/dist/src/planner/validation/plan-validator.js.map +1 -1
- package/dist/src/runtime/context-helpers.d.ts +13 -1
- package/dist/src/runtime/context-helpers.d.ts.map +1 -1
- package/dist/src/runtime/context-helpers.js +7 -1
- package/dist/src/runtime/context-helpers.js.map +1 -1
- package/dist/src/runtime/delta-executor.d.ts +30 -1
- package/dist/src/runtime/delta-executor.d.ts.map +1 -1
- package/dist/src/runtime/delta-executor.js +29 -4
- package/dist/src/runtime/delta-executor.js.map +1 -1
- package/dist/src/runtime/emit/add-constraint.d.ts.map +1 -1
- package/dist/src/runtime/emit/add-constraint.js +38 -5
- package/dist/src/runtime/emit/add-constraint.js.map +1 -1
- package/dist/src/runtime/emit/aggregate.d.ts.map +1 -1
- package/dist/src/runtime/emit/aggregate.js +10 -8
- package/dist/src/runtime/emit/aggregate.js.map +1 -1
- package/dist/src/runtime/emit/alter-table.d.ts +1 -1
- package/dist/src/runtime/emit/alter-table.d.ts.map +1 -1
- package/dist/src/runtime/emit/alter-table.js +664 -108
- package/dist/src/runtime/emit/alter-table.js.map +1 -1
- package/dist/src/runtime/emit/analyze.d.ts.map +1 -1
- package/dist/src/runtime/emit/analyze.js +2 -1
- package/dist/src/runtime/emit/analyze.js.map +1 -1
- package/dist/src/runtime/emit/asof-scan.d.ts.map +1 -1
- package/dist/src/runtime/emit/asof-scan.js +18 -5
- package/dist/src/runtime/emit/asof-scan.js.map +1 -1
- package/dist/src/runtime/emit/asserted-keys.d.ts +13 -0
- package/dist/src/runtime/emit/asserted-keys.d.ts.map +1 -0
- package/dist/src/runtime/emit/asserted-keys.js +13 -0
- package/dist/src/runtime/emit/asserted-keys.js.map +1 -0
- package/dist/src/runtime/emit/between.d.ts.map +1 -1
- package/dist/src/runtime/emit/between.js +24 -19
- package/dist/src/runtime/emit/between.js.map +1 -1
- package/dist/src/runtime/emit/binary.d.ts.map +1 -1
- package/dist/src/runtime/emit/binary.js +5 -9
- package/dist/src/runtime/emit/binary.js.map +1 -1
- package/dist/src/runtime/emit/block.d.ts.map +1 -1
- package/dist/src/runtime/emit/block.js +11 -2
- package/dist/src/runtime/emit/block.js.map +1 -1
- package/dist/src/runtime/emit/bloom-join.d.ts.map +1 -1
- package/dist/src/runtime/emit/bloom-join.js +8 -2
- package/dist/src/runtime/emit/bloom-join.js.map +1 -1
- package/dist/src/runtime/emit/constraint-check.js +15 -0
- package/dist/src/runtime/emit/constraint-check.js.map +1 -1
- package/dist/src/runtime/emit/create-table.d.ts.map +1 -1
- package/dist/src/runtime/emit/create-table.js +8 -0
- package/dist/src/runtime/emit/create-table.js.map +1 -1
- package/dist/src/runtime/emit/create-view.d.ts.map +1 -1
- package/dist/src/runtime/emit/create-view.js +16 -1
- package/dist/src/runtime/emit/create-view.js.map +1 -1
- package/dist/src/runtime/emit/dml-executor.d.ts +27 -0
- package/dist/src/runtime/emit/dml-executor.d.ts.map +1 -1
- package/dist/src/runtime/emit/dml-executor.js +413 -193
- package/dist/src/runtime/emit/dml-executor.js.map +1 -1
- package/dist/src/runtime/emit/drop-table.d.ts.map +1 -1
- package/dist/src/runtime/emit/drop-table.js +10 -0
- package/dist/src/runtime/emit/drop-table.js.map +1 -1
- package/dist/src/runtime/emit/drop-view.d.ts.map +1 -1
- package/dist/src/runtime/emit/drop-view.js +17 -0
- package/dist/src/runtime/emit/drop-view.js.map +1 -1
- package/dist/src/runtime/emit/envelope-scan.d.ts +13 -0
- package/dist/src/runtime/emit/envelope-scan.d.ts.map +1 -0
- package/dist/src/runtime/emit/envelope-scan.js +22 -0
- package/dist/src/runtime/emit/envelope-scan.js.map +1 -0
- package/dist/src/runtime/emit/join.d.ts +10 -2
- package/dist/src/runtime/emit/join.d.ts.map +1 -1
- package/dist/src/runtime/emit/join.js +128 -38
- package/dist/src/runtime/emit/join.js.map +1 -1
- package/dist/src/runtime/emit/lens-auxiliary-access.d.ts +16 -0
- package/dist/src/runtime/emit/lens-auxiliary-access.d.ts.map +1 -0
- package/dist/src/runtime/emit/lens-auxiliary-access.js +16 -0
- package/dist/src/runtime/emit/lens-auxiliary-access.js.map +1 -0
- package/dist/src/runtime/emit/materialized-view-helpers.d.ts +640 -0
- package/dist/src/runtime/emit/materialized-view-helpers.d.ts.map +1 -0
- package/dist/src/runtime/emit/materialized-view-helpers.js +2576 -0
- package/dist/src/runtime/emit/materialized-view-helpers.js.map +1 -0
- package/dist/src/runtime/emit/materialized-view.d.ts +31 -0
- package/dist/src/runtime/emit/materialized-view.d.ts.map +1 -0
- package/dist/src/runtime/emit/materialized-view.js +187 -0
- package/dist/src/runtime/emit/materialized-view.js.map +1 -0
- package/dist/src/runtime/emit/merge-join.d.ts.map +1 -1
- package/dist/src/runtime/emit/merge-join.js +15 -3
- package/dist/src/runtime/emit/merge-join.js.map +1 -1
- package/dist/src/runtime/emit/project.d.ts.map +1 -1
- package/dist/src/runtime/emit/project.js +10 -5
- package/dist/src/runtime/emit/project.js.map +1 -1
- package/dist/src/runtime/emit/schema-declarative.d.ts +1 -0
- package/dist/src/runtime/emit/schema-declarative.d.ts.map +1 -1
- package/dist/src/runtime/emit/schema-declarative.js +101 -5
- package/dist/src/runtime/emit/schema-declarative.js.map +1 -1
- package/dist/src/runtime/emit/set-object-tags.d.ts +16 -0
- package/dist/src/runtime/emit/set-object-tags.d.ts.map +1 -0
- package/dist/src/runtime/emit/set-object-tags.js +57 -0
- package/dist/src/runtime/emit/set-object-tags.js.map +1 -0
- package/dist/src/runtime/emit/set-operation.d.ts.map +1 -1
- package/dist/src/runtime/emit/set-operation.js +140 -24
- package/dist/src/runtime/emit/set-operation.js.map +1 -1
- package/dist/src/runtime/emit/subquery.d.ts.map +1 -1
- package/dist/src/runtime/emit/subquery.js +110 -5
- package/dist/src/runtime/emit/subquery.js.map +1 -1
- package/dist/src/runtime/emit/unary.d.ts.map +1 -1
- package/dist/src/runtime/emit/unary.js +34 -6
- package/dist/src/runtime/emit/unary.js.map +1 -1
- package/dist/src/runtime/emit/view-mutation.d.ts +70 -0
- package/dist/src/runtime/emit/view-mutation.d.ts.map +1 -0
- package/dist/src/runtime/emit/view-mutation.js +299 -0
- package/dist/src/runtime/emit/view-mutation.js.map +1 -0
- package/dist/src/runtime/emit/window.js +29 -5
- package/dist/src/runtime/emit/window.js.map +1 -1
- package/dist/src/runtime/foreign-key-actions.d.ts +66 -3
- package/dist/src/runtime/foreign-key-actions.d.ts.map +1 -1
- package/dist/src/runtime/foreign-key-actions.js +580 -172
- package/dist/src/runtime/foreign-key-actions.js.map +1 -1
- package/dist/src/runtime/parallel-driver.d.ts +4 -1
- package/dist/src/runtime/parallel-driver.d.ts.map +1 -1
- package/dist/src/runtime/parallel-driver.js +5 -1
- package/dist/src/runtime/parallel-driver.js.map +1 -1
- package/dist/src/runtime/register.d.ts.map +1 -1
- package/dist/src/runtime/register.js +17 -1
- package/dist/src/runtime/register.js.map +1 -1
- package/dist/src/runtime/types.d.ts +10 -0
- package/dist/src/runtime/types.d.ts.map +1 -1
- package/dist/src/runtime/types.js.map +1 -1
- package/dist/src/schema/basis-backfill.d.ts +63 -0
- package/dist/src/schema/basis-backfill.d.ts.map +1 -0
- package/dist/src/schema/basis-backfill.js +161 -0
- package/dist/src/schema/basis-backfill.js.map +1 -0
- package/dist/src/schema/catalog.d.ts +115 -1
- package/dist/src/schema/catalog.d.ts.map +1 -1
- package/dist/src/schema/catalog.js +249 -22
- package/dist/src/schema/catalog.js.map +1 -1
- package/dist/src/schema/change-events.d.ts +42 -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/column.d.ts +16 -0
- package/dist/src/schema/column.d.ts.map +1 -1
- package/dist/src/schema/column.js.map +1 -1
- package/dist/src/schema/constraint-builder.d.ts +182 -0
- package/dist/src/schema/constraint-builder.d.ts.map +1 -0
- package/dist/src/schema/constraint-builder.js +424 -0
- package/dist/src/schema/constraint-builder.js.map +1 -0
- package/dist/src/schema/ddl-generator.d.ts +86 -1
- package/dist/src/schema/ddl-generator.d.ts.map +1 -1
- package/dist/src/schema/ddl-generator.js +316 -20
- package/dist/src/schema/ddl-generator.js.map +1 -1
- package/dist/src/schema/declared-schema-manager.d.ts +51 -0
- package/dist/src/schema/declared-schema-manager.d.ts.map +1 -1
- package/dist/src/schema/declared-schema-manager.js +61 -0
- package/dist/src/schema/declared-schema-manager.js.map +1 -1
- package/dist/src/schema/derivation.d.ts +106 -0
- package/dist/src/schema/derivation.d.ts.map +1 -0
- package/dist/src/schema/derivation.js +25 -0
- package/dist/src/schema/derivation.js.map +1 -0
- package/dist/src/schema/function.d.ts +13 -0
- package/dist/src/schema/function.d.ts.map +1 -1
- package/dist/src/schema/function.js.map +1 -1
- package/dist/src/schema/lens-ack.d.ts +90 -0
- package/dist/src/schema/lens-ack.d.ts.map +1 -0
- package/dist/src/schema/lens-ack.js +361 -0
- package/dist/src/schema/lens-ack.js.map +1 -0
- package/dist/src/schema/lens-compiler.d.ts +62 -0
- package/dist/src/schema/lens-compiler.d.ts.map +1 -0
- package/dist/src/schema/lens-compiler.js +1594 -0
- package/dist/src/schema/lens-compiler.js.map +1 -0
- package/dist/src/schema/lens-fk-discovery.d.ts +175 -0
- package/dist/src/schema/lens-fk-discovery.d.ts.map +1 -0
- package/dist/src/schema/lens-fk-discovery.js +336 -0
- package/dist/src/schema/lens-fk-discovery.js.map +1 -0
- package/dist/src/schema/lens-prover.d.ts +336 -0
- package/dist/src/schema/lens-prover.d.ts.map +1 -0
- package/dist/src/schema/lens-prover.js +1988 -0
- package/dist/src/schema/lens-prover.js.map +1 -0
- package/dist/src/schema/lens.d.ts +254 -0
- package/dist/src/schema/lens.d.ts.map +1 -0
- package/dist/src/schema/lens.js +21 -0
- package/dist/src/schema/lens.js.map +1 -0
- package/dist/src/schema/manager.d.ts +676 -18
- package/dist/src/schema/manager.d.ts.map +1 -1
- package/dist/src/schema/manager.js +1573 -238
- package/dist/src/schema/manager.js.map +1 -1
- package/dist/src/schema/mapping-advertisement-tags.d.ts +39 -0
- package/dist/src/schema/mapping-advertisement-tags.d.ts.map +1 -0
- package/dist/src/schema/mapping-advertisement-tags.js +216 -0
- package/dist/src/schema/mapping-advertisement-tags.js.map +1 -0
- package/dist/src/schema/rename-rewriter.d.ts +45 -4
- package/dist/src/schema/rename-rewriter.d.ts.map +1 -1
- package/dist/src/schema/rename-rewriter.js +412 -19
- package/dist/src/schema/rename-rewriter.js.map +1 -1
- package/dist/src/schema/reserved-tags-policy.d.ts +32 -0
- package/dist/src/schema/reserved-tags-policy.d.ts.map +1 -0
- package/dist/src/schema/reserved-tags-policy.js +34 -0
- package/dist/src/schema/reserved-tags-policy.js.map +1 -0
- package/dist/src/schema/reserved-tags.d.ts +170 -0
- package/dist/src/schema/reserved-tags.d.ts.map +1 -0
- package/dist/src/schema/reserved-tags.js +507 -0
- package/dist/src/schema/reserved-tags.js.map +1 -0
- package/dist/src/schema/schema-differ.d.ts +158 -2
- package/dist/src/schema/schema-differ.d.ts.map +1 -1
- package/dist/src/schema/schema-differ.js +1460 -78
- package/dist/src/schema/schema-differ.js.map +1 -1
- package/dist/src/schema/schema-hasher.d.ts +8 -3
- package/dist/src/schema/schema-hasher.d.ts.map +1 -1
- package/dist/src/schema/schema-hasher.js +22 -2
- package/dist/src/schema/schema-hasher.js.map +1 -1
- package/dist/src/schema/schema.d.ts +25 -1
- package/dist/src/schema/schema.d.ts.map +1 -1
- package/dist/src/schema/schema.js +36 -2
- package/dist/src/schema/schema.js.map +1 -1
- package/dist/src/schema/table.d.ts +259 -10
- package/dist/src/schema/table.d.ts.map +1 -1
- package/dist/src/schema/table.js +309 -26
- package/dist/src/schema/table.js.map +1 -1
- package/dist/src/schema/unique-enforcement.d.ts +78 -0
- package/dist/src/schema/unique-enforcement.d.ts.map +1 -0
- package/dist/src/schema/unique-enforcement.js +93 -0
- package/dist/src/schema/unique-enforcement.js.map +1 -0
- package/dist/src/schema/view.d.ts +83 -2
- package/dist/src/schema/view.d.ts.map +1 -1
- package/dist/src/schema/view.js +67 -1
- package/dist/src/schema/view.js.map +1 -1
- package/dist/src/schema/window-function.d.ts +9 -1
- package/dist/src/schema/window-function.d.ts.map +1 -1
- package/dist/src/schema/window-function.js.map +1 -1
- package/dist/src/util/comparison.d.ts +24 -0
- package/dist/src/util/comparison.d.ts.map +1 -1
- package/dist/src/util/comparison.js +34 -0
- package/dist/src/util/comparison.js.map +1 -1
- package/dist/src/util/mutation-statement.d.ts.map +1 -1
- package/dist/src/util/mutation-statement.js +4 -1
- package/dist/src/util/mutation-statement.js.map +1 -1
- package/dist/src/util/serialization.d.ts +9 -0
- package/dist/src/util/serialization.d.ts.map +1 -1
- package/dist/src/util/serialization.js +26 -0
- package/dist/src/util/serialization.js.map +1 -1
- package/dist/src/vtab/backing-host.d.ts +286 -0
- package/dist/src/vtab/backing-host.d.ts.map +1 -0
- package/dist/src/vtab/backing-host.js +118 -0
- package/dist/src/vtab/backing-host.js.map +1 -0
- package/dist/src/vtab/best-access-plan.d.ts +21 -0
- package/dist/src/vtab/best-access-plan.d.ts.map +1 -1
- package/dist/src/vtab/best-access-plan.js.map +1 -1
- package/dist/src/vtab/capabilities.d.ts +5 -5
- package/dist/src/vtab/capabilities.d.ts.map +1 -1
- package/dist/src/vtab/mapping-advertisement.d.ts +163 -0
- package/dist/src/vtab/mapping-advertisement.d.ts.map +1 -0
- package/dist/src/vtab/mapping-advertisement.js +2 -0
- package/dist/src/vtab/mapping-advertisement.js.map +1 -0
- package/dist/src/vtab/memory/index.d.ts +64 -4
- package/dist/src/vtab/memory/index.d.ts.map +1 -1
- package/dist/src/vtab/memory/index.js +119 -12
- package/dist/src/vtab/memory/index.js.map +1 -1
- package/dist/src/vtab/memory/layer/base.d.ts +38 -1
- package/dist/src/vtab/memory/layer/base.d.ts.map +1 -1
- package/dist/src/vtab/memory/layer/base.js +112 -24
- package/dist/src/vtab/memory/layer/base.js.map +1 -1
- package/dist/src/vtab/memory/layer/manager.d.ts +291 -4
- package/dist/src/vtab/memory/layer/manager.d.ts.map +1 -1
- package/dist/src/vtab/memory/layer/manager.js +1050 -91
- package/dist/src/vtab/memory/layer/manager.js.map +1 -1
- package/dist/src/vtab/memory/layer/plan-filter.d.ts.map +1 -1
- package/dist/src/vtab/memory/layer/plan-filter.js +35 -6
- package/dist/src/vtab/memory/layer/plan-filter.js.map +1 -1
- package/dist/src/vtab/memory/layer/scan-layer.d.ts.map +1 -1
- package/dist/src/vtab/memory/layer/scan-layer.js +66 -14
- package/dist/src/vtab/memory/layer/scan-layer.js.map +1 -1
- package/dist/src/vtab/memory/layer/scan-plan.d.ts +14 -0
- package/dist/src/vtab/memory/layer/scan-plan.d.ts.map +1 -1
- package/dist/src/vtab/memory/layer/scan-plan.js +27 -4
- package/dist/src/vtab/memory/layer/scan-plan.js.map +1 -1
- package/dist/src/vtab/memory/layer/transaction.d.ts.map +1 -1
- package/dist/src/vtab/memory/layer/transaction.js +5 -1
- package/dist/src/vtab/memory/layer/transaction.js.map +1 -1
- package/dist/src/vtab/memory/module.d.ts +17 -0
- package/dist/src/vtab/memory/module.d.ts.map +1 -1
- package/dist/src/vtab/memory/module.js +82 -3
- package/dist/src/vtab/memory/module.js.map +1 -1
- package/dist/src/vtab/memory/table.d.ts.map +1 -1
- package/dist/src/vtab/memory/table.js +15 -5
- package/dist/src/vtab/memory/table.js.map +1 -1
- package/dist/src/vtab/memory/types.d.ts +20 -2
- package/dist/src/vtab/memory/types.d.ts.map +1 -1
- package/dist/src/vtab/memory/utils/predicate.d.ts.map +1 -1
- package/dist/src/vtab/memory/utils/predicate.js +46 -24
- package/dist/src/vtab/memory/utils/predicate.js.map +1 -1
- package/dist/src/vtab/memory/utils/primary-key-encode.d.ts +31 -0
- package/dist/src/vtab/memory/utils/primary-key-encode.d.ts.map +1 -0
- package/dist/src/vtab/memory/utils/primary-key-encode.js +101 -0
- package/dist/src/vtab/memory/utils/primary-key-encode.js.map +1 -0
- package/dist/src/vtab/memory/utils/primary-key.d.ts +8 -0
- package/dist/src/vtab/memory/utils/primary-key.d.ts.map +1 -1
- package/dist/src/vtab/memory/utils/primary-key.js +12 -5
- package/dist/src/vtab/memory/utils/primary-key.js.map +1 -1
- package/dist/src/vtab/module.d.ts +203 -4
- package/dist/src/vtab/module.d.ts.map +1 -1
- package/dist/src/vtab/table.d.ts +9 -0
- package/dist/src/vtab/table.d.ts.map +1 -1
- package/dist/src/vtab/table.js.map +1 -1
- package/package.json +6 -5
|
@@ -10,8 +10,10 @@ import { createOptContext } from './framework/context.js';
|
|
|
10
10
|
import { PassManager, PassId } from './framework/pass.js';
|
|
11
11
|
// Phase 2 rules
|
|
12
12
|
import { ruleMaterializationAdvisory } from './rules/cache/rule-materialization-advisory.js';
|
|
13
|
+
import { ruleMaterializedViewRewrite } from './rules/cache/rule-materialized-view-rewrite.js';
|
|
13
14
|
// Phase 1.5 rules
|
|
14
15
|
import { ruleSelectAccessPath } from './rules/access/rule-select-access-path.js';
|
|
16
|
+
import { ruleLensAuxiliaryAccess } from './rules/access/rule-lens-auxiliary-access.js';
|
|
15
17
|
import { ruleMonotonicLimitPushdown } from './rules/access/rule-monotonic-limit-pushdown.js';
|
|
16
18
|
import { ruleMonotonicRangeAccess } from './rules/access/rule-monotonic-range-access.js';
|
|
17
19
|
import { ruleAsofStrategySelect } from './rules/access/rule-asof-strategy-select.js';
|
|
@@ -24,6 +26,9 @@ import { ruleSargableRangeRewrite } from './rules/predicate/rule-sargable-range-
|
|
|
24
26
|
import { ruleJoinKeyInference } from './rules/join/rule-join-key-inference.js';
|
|
25
27
|
import { ruleJoinGreedyCommute } from './rules/join/rule-join-greedy-commute.js';
|
|
26
28
|
import { ruleJoinElimination, ruleJoinEliminationUnderAggregate } from './rules/join/rule-join-elimination.js';
|
|
29
|
+
import { ruleJoinExistencePruning, ruleJoinExistencePruningUnderAggregate } from './rules/join/rule-join-existence-pruning.js';
|
|
30
|
+
import { ruleSemijoinExistenceRecovery, ruleSemijoinExistenceRecoveryUnderAggregate } from './rules/join/rule-semijoin-existence-recovery.js';
|
|
31
|
+
import { ruleInnerJoinExistenceRecovery } from './rules/join/rule-inner-join-existence-recovery.js';
|
|
27
32
|
import { ruleFanOutLookupJoin } from './rules/join/rule-fanout-lookup-join.js';
|
|
28
33
|
import { ruleFanOutBatchedOuter } from './rules/join/rule-fanout-batched-outer.js';
|
|
29
34
|
import { ruleAsyncGatherUnionAll } from './rules/parallel/rule-async-gather-union-all.js';
|
|
@@ -80,6 +85,44 @@ export class Optimizer {
|
|
|
80
85
|
* Register rules with their appropriate passes
|
|
81
86
|
*/
|
|
82
87
|
registerRulesToPasses() {
|
|
88
|
+
// Materialized-view query rewrite (read side). Registered FIRST in the
|
|
89
|
+
// Structural pass so it fires on the pristine `Project(Filter?(Retrieve(
|
|
90
|
+
// TableReference)))` — before grow-retrieve / predicate-pushdown reposition
|
|
91
|
+
// the Filter and before the Physical pass absorbs a predicate into a range
|
|
92
|
+
// scan — where the matcher can read the fragment's WHERE off the live plan.
|
|
93
|
+
// Pass rules fire in REGISTRATION order (not by `priority`), so placement here
|
|
94
|
+
// is what guarantees first-fire. Logical→logical: the substituted maintained-table
|
|
95
|
+
// TableReference then flows through normal physical access selection, so
|
|
96
|
+
// `query_plan()` shows an ordinary scan of the MV's own table for free.
|
|
97
|
+
this.passManager.addRuleToPass(PassId.Structural, {
|
|
98
|
+
id: 'materialized-view-rewrite',
|
|
99
|
+
nodeType: PlanNodeType.Project,
|
|
100
|
+
phase: 'rewrite',
|
|
101
|
+
fn: ruleMaterializedViewRewrite,
|
|
102
|
+
priority: 6,
|
|
103
|
+
// Replaces a read-only scan-project-filter fragment with a provably
|
|
104
|
+
// row-equivalent backing scan; the dropped base-scan subtree is pure (the
|
|
105
|
+
// matcher admits only recognized predicates, no subqueries) and the
|
|
106
|
+
// replacement re-emits the fragment's identical output attribute ids.
|
|
107
|
+
sideEffectMode: 'safe',
|
|
108
|
+
});
|
|
109
|
+
// Aggregate arm of the same rewrite (`mv-query-rewrite-aggregate-rollup`):
|
|
110
|
+
// recognizes a logical `Aggregate(Filter?(scan))` answered from a grouped MV
|
|
111
|
+
// (exact-key direct scan or superset-key rollup re-aggregation). Registered as
|
|
112
|
+
// a SECOND handle because pass rules fire only on their `nodeType` and are
|
|
113
|
+
// deduped by id — so the aggregate arm needs the `Aggregate` node type and a
|
|
114
|
+
// distinct id. It honors the canonical `materialized-view-rewrite` disable
|
|
115
|
+
// switch internally (see the rule), so existing rule-disable controls turn off
|
|
116
|
+
// both arms. Registered immediately after the Project arm so it likewise fires
|
|
117
|
+
// on the pristine fragment, before grow-retrieve / predicate-pushdown.
|
|
118
|
+
this.passManager.addRuleToPass(PassId.Structural, {
|
|
119
|
+
id: 'materialized-view-rewrite-aggregate',
|
|
120
|
+
nodeType: PlanNodeType.Aggregate,
|
|
121
|
+
phase: 'rewrite',
|
|
122
|
+
fn: ruleMaterializedViewRewrite,
|
|
123
|
+
priority: 6,
|
|
124
|
+
sideEffectMode: 'safe',
|
|
125
|
+
});
|
|
83
126
|
// Structural pass rules (top-down) - for operations that need parent context
|
|
84
127
|
// Register grow-retrieve for ALL relational node types
|
|
85
128
|
// The rule itself will determine if growth is possible
|
|
@@ -100,7 +143,10 @@ export class Optimizer {
|
|
|
100
143
|
nodeType,
|
|
101
144
|
phase: 'rewrite',
|
|
102
145
|
fn: ruleGrowRetrieve,
|
|
103
|
-
priority: 10
|
|
146
|
+
priority: 10,
|
|
147
|
+
// Slides operators down into a Retrieve boundary, whose pipeline is
|
|
148
|
+
// always a read by construction (RetrieveNode is the vtab read entry).
|
|
149
|
+
sideEffectMode: 'safe',
|
|
104
150
|
});
|
|
105
151
|
}
|
|
106
152
|
// Join key inference (structural/characteristic)
|
|
@@ -109,7 +155,9 @@ export class Optimizer {
|
|
|
109
155
|
nodeType: PlanNodeType.Join,
|
|
110
156
|
phase: 'rewrite',
|
|
111
157
|
fn: ruleJoinKeyInference,
|
|
112
|
-
priority: 15
|
|
158
|
+
priority: 15,
|
|
159
|
+
// Diagnostic-only: never returns a transformed node.
|
|
160
|
+
sideEffectMode: 'safe',
|
|
113
161
|
});
|
|
114
162
|
// Greedy join commute: place smaller input on the left to improve nested-loop-like costs
|
|
115
163
|
this.passManager.addRuleToPass(PassId.Structural, {
|
|
@@ -117,7 +165,10 @@ export class Optimizer {
|
|
|
117
165
|
nodeType: PlanNodeType.Join,
|
|
118
166
|
phase: 'rewrite',
|
|
119
167
|
fn: ruleJoinGreedyCommute,
|
|
120
|
-
priority: 16
|
|
168
|
+
priority: 16,
|
|
169
|
+
// Swaps left/right of an inner join — would reorder side-effect
|
|
170
|
+
// execution. The rule refuses when either side carries a write.
|
|
171
|
+
sideEffectMode: 'aware',
|
|
121
172
|
});
|
|
122
173
|
// DISTINCT elimination: remove redundant DISTINCT when source already has unique keys
|
|
123
174
|
this.passManager.addRuleToPass(PassId.Structural, {
|
|
@@ -125,7 +176,10 @@ export class Optimizer {
|
|
|
125
176
|
nodeType: PlanNodeType.Distinct,
|
|
126
177
|
phase: 'rewrite',
|
|
127
178
|
fn: ruleDistinctElimination,
|
|
128
|
-
priority: 18
|
|
179
|
+
priority: 18,
|
|
180
|
+
// Unwraps DISTINCT around its source; source survives verbatim and any
|
|
181
|
+
// writes inside it still execute the same number of times.
|
|
182
|
+
sideEffectMode: 'safe',
|
|
129
183
|
});
|
|
130
184
|
// Projection pruning: remove unused inner projections in Project-on-Project
|
|
131
185
|
this.passManager.addRuleToPass(PassId.Structural, {
|
|
@@ -133,7 +187,31 @@ export class Optimizer {
|
|
|
133
187
|
nodeType: PlanNodeType.Project,
|
|
134
188
|
phase: 'rewrite',
|
|
135
189
|
fn: ruleProjectionPruning,
|
|
136
|
-
priority: 19
|
|
190
|
+
priority: 19,
|
|
191
|
+
// Drops unreferenced inner projections — refuses to drop any whose
|
|
192
|
+
// scalar expression carries a side effect.
|
|
193
|
+
sideEffectMode: 'aware',
|
|
194
|
+
});
|
|
195
|
+
// Lens auxiliary-access routing: route an outer-query predicate over an
|
|
196
|
+
// inlined lens view through an advertised auxiliary structure (nd-tree /
|
|
197
|
+
// vector / full-text) — an auxiliary seek ⋈ logical-key semi-join — instead
|
|
198
|
+
// of a residual filter over the full decomposition scan. Registered BEFORE
|
|
199
|
+
// predicate-pushdown (priority 20) so the matched predicate is still directly
|
|
200
|
+
// above the LensAuxiliaryAccess marker when this fires; within the top-down
|
|
201
|
+
// Structural pass, rules run in registration order, so placing this block
|
|
202
|
+
// ahead of pushdown is what guarantees first-fire on the Filter. No-ops on
|
|
203
|
+
// any Filter whose subtree has no marker (every non-lens / non-routable-lens
|
|
204
|
+
// view), so ordinary queries are untouched.
|
|
205
|
+
this.passManager.addRuleToPass(PassId.Structural, {
|
|
206
|
+
id: 'lens-auxiliary-access',
|
|
207
|
+
nodeType: PlanNodeType.Filter,
|
|
208
|
+
phase: 'rewrite',
|
|
209
|
+
fn: ruleLensAuxiliaryAccess,
|
|
210
|
+
priority: 17,
|
|
211
|
+
// Replaces a Filter over the lens marker with a semi-join against an
|
|
212
|
+
// auxiliary scan; the logical body (left) survives verbatim and the
|
|
213
|
+
// auxiliary scan it adds is a fresh read-only table reference.
|
|
214
|
+
sideEffectMode: 'safe',
|
|
137
215
|
});
|
|
138
216
|
// Sargable range rewrite: turn `f(col) = c` (for monotone-lossy `f` with
|
|
139
217
|
// a bucketBounds-aware logical type) into `col >= L AND col < U` so the
|
|
@@ -146,7 +224,9 @@ export class Optimizer {
|
|
|
146
224
|
nodeType: PlanNodeType.Filter,
|
|
147
225
|
phase: 'rewrite',
|
|
148
226
|
fn: ruleSargableRangeRewrite,
|
|
149
|
-
priority: 18
|
|
227
|
+
priority: 18,
|
|
228
|
+
// Rewrites a single scalar conjunct shape in place; no subtree moved.
|
|
229
|
+
sideEffectMode: 'safe',
|
|
150
230
|
});
|
|
151
231
|
// Aggregate-aware predicate pushdown: splits a Filter above an aggregate so
|
|
152
232
|
// conjuncts on GROUP-BY-determined columns land below the aggregate. Runs
|
|
@@ -157,14 +237,21 @@ export class Optimizer {
|
|
|
157
237
|
nodeType: PlanNodeType.Filter,
|
|
158
238
|
phase: 'rewrite',
|
|
159
239
|
fn: ruleAggregatePredicatePushdown,
|
|
160
|
-
priority: 19
|
|
240
|
+
priority: 19,
|
|
241
|
+
// Moves Filter conjuncts below an Aggregate, changing which rows reach
|
|
242
|
+
// the source subtree. Refuses when source has side effects.
|
|
243
|
+
sideEffectMode: 'aware',
|
|
161
244
|
});
|
|
162
245
|
this.passManager.addRuleToPass(PassId.Structural, {
|
|
163
246
|
id: 'predicate-pushdown',
|
|
164
247
|
nodeType: PlanNodeType.Filter,
|
|
165
248
|
phase: 'rewrite',
|
|
166
249
|
fn: rulePredicatePushdown,
|
|
167
|
-
priority: 20
|
|
250
|
+
priority: 20,
|
|
251
|
+
// Slides Filter past Sort/Distinct/Project/Alias/Retrieve, changing
|
|
252
|
+
// which rows reach the layer below — refuses when the immediate child
|
|
253
|
+
// subtree carries a write.
|
|
254
|
+
sideEffectMode: 'aware',
|
|
168
255
|
});
|
|
169
256
|
// Filter merge: combine adjacent Filter nodes into one AND-combined Filter
|
|
170
257
|
this.passManager.addRuleToPass(PassId.Structural, {
|
|
@@ -172,7 +259,12 @@ export class Optimizer {
|
|
|
172
259
|
nodeType: PlanNodeType.Filter,
|
|
173
260
|
phase: 'rewrite',
|
|
174
261
|
fn: ruleFilterMerge,
|
|
175
|
-
priority: 21
|
|
262
|
+
priority: 21,
|
|
263
|
+
// Merges two adjacent Filters into AND; the source subtree is untouched
|
|
264
|
+
// and only the order of predicate-clause evaluation changes (predicates
|
|
265
|
+
// are pure today; the audit gate that DML-in-expression-position needs
|
|
266
|
+
// is on rules that move or drop SUBTREES, not predicate ASTs).
|
|
267
|
+
sideEffectMode: 'safe',
|
|
176
268
|
});
|
|
177
269
|
// Scalar CSE: deduplicate common scalar expressions across Project + Filter + Sort chains
|
|
178
270
|
this.passManager.addRuleToPass(PassId.Structural, {
|
|
@@ -180,7 +272,11 @@ export class Optimizer {
|
|
|
180
272
|
nodeType: PlanNodeType.Project,
|
|
181
273
|
phase: 'rewrite',
|
|
182
274
|
fn: ruleScalarCSE,
|
|
183
|
-
priority: 22
|
|
275
|
+
priority: 22,
|
|
276
|
+
// Deduplicates scalar expressions — would silently collapse N copies of
|
|
277
|
+
// a side-effect-bearing scalar into 1. The rule's collector skips any
|
|
278
|
+
// non-deterministic or side-effect-bearing expression.
|
|
279
|
+
sideEffectMode: 'aware',
|
|
184
280
|
});
|
|
185
281
|
// EC-driven predicate inference: materialize inferred equality predicates
|
|
186
282
|
// from the cross of predicate-derived constant bindings and the source's
|
|
@@ -195,7 +291,12 @@ export class Optimizer {
|
|
|
195
291
|
nodeType: PlanNodeType.Filter,
|
|
196
292
|
phase: 'rewrite',
|
|
197
293
|
fn: rulePredicateInferenceEquivalence,
|
|
198
|
-
priority: 22
|
|
294
|
+
priority: 22,
|
|
295
|
+
// Materializes inferred equality conjuncts and optionally injects
|
|
296
|
+
// branch filters above an inner/cross join's children — would change
|
|
297
|
+
// which rows reach a side-effect-bearing branch. Refuses branch
|
|
298
|
+
// injection when the target branch has side effects.
|
|
299
|
+
sideEffectMode: 'aware',
|
|
199
300
|
});
|
|
200
301
|
// GROUP BY FD simplification: drop GROUP BY columns determined by other
|
|
201
302
|
// GROUP BY columns under the aggregate's output FDs + ECs. Picker MIN()
|
|
@@ -209,7 +310,127 @@ export class Optimizer {
|
|
|
209
310
|
nodeType: PlanNodeType.Aggregate,
|
|
210
311
|
phase: 'rewrite',
|
|
211
312
|
fn: ruleGroupByFdSimplification,
|
|
212
|
-
priority: 23
|
|
313
|
+
priority: 23,
|
|
314
|
+
// Drops bare-column GROUP BY entries (re-emitting them as picker
|
|
315
|
+
// aggregates). The dropped expressions are pure ColumnReferenceNodes
|
|
316
|
+
// by construction, so no side-effect-bearing scalar can be lost.
|
|
317
|
+
sideEffectMode: 'safe',
|
|
318
|
+
});
|
|
319
|
+
// Join existence-flag pruning (demand-gated): drop an `exists … as` match
|
|
320
|
+
// flag from a JoinNode when no ancestor demands its output attribute id, so
|
|
321
|
+
// `hasExistenceColumns` flips false on the last drop and the five
|
|
322
|
+
// flag-guarded join rules re-enable. Registered AFTER projection-pruning
|
|
323
|
+
// (19) / predicate-pushdown (20) / scalar-cse (22) so the demand set is
|
|
324
|
+
// settled, and BEFORE fanout-lookup-join (23) and join-elimination (24) so
|
|
325
|
+
// the freshly-pruned Project threads through them in the same applyRules
|
|
326
|
+
// loop. The PostOptimization join rules (join-physical-selection,
|
|
327
|
+
// monotonic-merge-join) and the Structural Join-typed lateral-top1-asof
|
|
328
|
+
// (visited top-down after this ancestor Project) see the flag-free join
|
|
329
|
+
// automatically.
|
|
330
|
+
this.passManager.addRuleToPass(PassId.Structural, {
|
|
331
|
+
id: 'join-existence-pruning',
|
|
332
|
+
nodeType: PlanNodeType.Project,
|
|
333
|
+
phase: 'rewrite',
|
|
334
|
+
fn: ruleJoinExistencePruning,
|
|
335
|
+
priority: 22,
|
|
336
|
+
// Drops only a derived, read-only `{true,false}` boolean column; both
|
|
337
|
+
// join sides survive verbatim, so no write can be skipped or reordered.
|
|
338
|
+
sideEffectMode: 'safe',
|
|
339
|
+
});
|
|
340
|
+
// Aggregate variant of existence-flag pruning: drop an `exists … as` match
|
|
341
|
+
// flag from a JoinNode reachable through a pass-through chain under an
|
|
342
|
+
// AggregateNode (the Project entrypoint never sees this shape). Priority 22
|
|
343
|
+
// mirrors the Project entrypoint and places it BEFORE
|
|
344
|
+
// join-elimination-aggregate (priority 26), so a freshly-pruned Aggregate
|
|
345
|
+
// threads into that rule in the same applyRules loop — the aggregate-side
|
|
346
|
+
// analogue of why join-existence-pruning (22) runs before
|
|
347
|
+
// join-elimination (24).
|
|
348
|
+
this.passManager.addRuleToPass(PassId.Structural, {
|
|
349
|
+
id: 'join-existence-pruning-aggregate',
|
|
350
|
+
nodeType: PlanNodeType.Aggregate,
|
|
351
|
+
phase: 'rewrite',
|
|
352
|
+
fn: ruleJoinExistencePruningUnderAggregate,
|
|
353
|
+
priority: 22,
|
|
354
|
+
// Same as the Project entrypoint: drops only a derived, read-only
|
|
355
|
+
// `{true,false}` boolean column; both join sides survive verbatim and
|
|
356
|
+
// the Aggregate is reconstructed with identical groupBy / aggregates /
|
|
357
|
+
// output attrs (a pure source swap), so no write can be skipped.
|
|
358
|
+
sideEffectMode: 'safe',
|
|
359
|
+
});
|
|
360
|
+
// Semi/anti-join existence-flag recovery (demand-SHAPE gated): the complement
|
|
361
|
+
// of `join-existence-pruning`. When the sole `exists … as` flag on a
|
|
362
|
+
// `left join` is demanded ONLY as a top-level boolean probe
|
|
363
|
+
// (`where flag` ⇒ semi, `where not flag` ⇒ anti), rewrite the JoinNode to the
|
|
364
|
+
// equivalent semi/anti join — the same shape `subquery-decorrelation` emits —
|
|
365
|
+
// re-opening physical join selection and the IND-folding cascade. Registered
|
|
366
|
+
// AFTER `join-existence-pruning` (so an undemanded sibling flag is dropped
|
|
367
|
+
// first, maximizing the sole-spec precondition) and BEFORE
|
|
368
|
+
// `fanout-lookup-join` / `join-elimination` and the IND folders
|
|
369
|
+
// `anti-join-fk-empty` / `semi-join-fk-trivial` (Join, registered below) so
|
|
370
|
+
// the recovered semi/anti threads into them in the same applyRules loop —
|
|
371
|
+
// exactly why `subquery-decorrelation` precedes those folders. Pass rules fire
|
|
372
|
+
// in REGISTRATION order, so this placement (22 < priority 23 < 26) is what
|
|
373
|
+
// realizes the ordering; the priority value is documentation.
|
|
374
|
+
this.passManager.addRuleToPass(PassId.Structural, {
|
|
375
|
+
id: 'semijoin-existence-recovery',
|
|
376
|
+
nodeType: PlanNodeType.Project,
|
|
377
|
+
phase: 'rewrite',
|
|
378
|
+
fn: ruleSemijoinExistenceRecovery,
|
|
379
|
+
priority: 23,
|
|
380
|
+
// Recovers a semi/anti join, which short-circuits the right side's scan at
|
|
381
|
+
// the first match — changing R's execution count. Refuses when R carries a
|
|
382
|
+
// write (mirrors subquery-decorrelation's impure-inner refusal).
|
|
383
|
+
sideEffectMode: 'aware',
|
|
384
|
+
});
|
|
385
|
+
// Inner-join existence-flag recovery (demand-SHAPE gated): the fallback
|
|
386
|
+
// complement of `semijoin-existence-recovery`. When the sole `exists … as`
|
|
387
|
+
// flag on a `left join` is a POSITIVE top-level probe (`where flag`) AND
|
|
388
|
+
// EITHER ≥1 right-side column is demanded above the join OR R fans out
|
|
389
|
+
// (non-unique on the join column, where a semi join would unsoundly collapse
|
|
390
|
+
// duplicates), rewrite the JoinNode to a plain `inner join` (drop the flag,
|
|
391
|
+
// keep both sides) — re-opening physical join selection, non-nullable right
|
|
392
|
+
// typing, and the FK/IND cascade the live flag pinned shut. The two recovery
|
|
393
|
+
// rules consult the SAME `rightMatchesAtMostOne` and so are provably disjoint
|
|
394
|
+
// on the positive-probe space INDEPENDENT of registration order (semi fires
|
|
395
|
+
// iff !rightColDemanded && unique-R; inner iff rightColDemanded || !unique-R).
|
|
396
|
+
// Registered (in registration order) BEFORE `fanout-lookup-join` /
|
|
397
|
+
// `join-elimination` (24) / the Join-typed IND folders (26) so the recovered
|
|
398
|
+
// inner join threads into them in the same applyRules loop.
|
|
399
|
+
this.passManager.addRuleToPass(PassId.Structural, {
|
|
400
|
+
id: 'inner-join-existence-recovery',
|
|
401
|
+
nodeType: PlanNodeType.Project,
|
|
402
|
+
phase: 'rewrite',
|
|
403
|
+
fn: ruleInnerJoinExistenceRecovery,
|
|
404
|
+
priority: 23,
|
|
405
|
+
// Logically scans R the same number of times as the flag-bearing left
|
|
406
|
+
// join, but dropping the flag re-enables join-physical-selection, which can
|
|
407
|
+
// pick a hash join that scans R once total — changing an impure R's
|
|
408
|
+
// execution count. Refuses when R carries a write (mirrors the sibling).
|
|
409
|
+
sideEffectMode: 'aware',
|
|
410
|
+
});
|
|
411
|
+
// Aggregate counterpart of `semijoin-existence-recovery`: the same probe-only
|
|
412
|
+
// flag recovery anchored on an `AggregateNode` for the bare `count(*) … where
|
|
413
|
+
// flag` / `group by` shape that plans with NO enclosing Project (the probe
|
|
414
|
+
// Filter + flag-bearing join sit under the Aggregate, so the Project entrypoint
|
|
415
|
+
// never fires). Registered (in registration order) AFTER
|
|
416
|
+
// `join-existence-pruning-aggregate` (22, so an undemanded sibling flag is
|
|
417
|
+
// dropped first, maximizing the sole-spec precondition) and BEFORE the
|
|
418
|
+
// Join-typed IND folders `anti-join-fk-empty` / `semi-join-fk-trivial` and
|
|
419
|
+
// `join-elimination-aggregate` (all 26), so the recovered semi/anti threads
|
|
420
|
+
// into them in the same applyRules loop — the aggregate analogue of the Project
|
|
421
|
+
// rule's placement. No nodeType collision with the Project `semijoin-existence-
|
|
422
|
+
// recovery` (Project vs Aggregate). Unlike the Project anchor it has NO inner
|
|
423
|
+
// fallback: a right-col-demanded / fan-out positive probe stays `left`.
|
|
424
|
+
this.passManager.addRuleToPass(PassId.Structural, {
|
|
425
|
+
id: 'semijoin-existence-recovery-aggregate',
|
|
426
|
+
nodeType: PlanNodeType.Aggregate,
|
|
427
|
+
phase: 'rewrite',
|
|
428
|
+
fn: ruleSemijoinExistenceRecoveryUnderAggregate,
|
|
429
|
+
priority: 23,
|
|
430
|
+
// Recovers a semi/anti join under an Aggregate — short-circuits R's scan at
|
|
431
|
+
// the first match (semi), changing R's execution count. Same impure-R refusal
|
|
432
|
+
// as the Project entrypoint.
|
|
433
|
+
sideEffectMode: 'aware',
|
|
213
434
|
});
|
|
214
435
|
// Fan-out lookup join (FK→PK): cluster N LEFT/INNER nested-loop joins from
|
|
215
436
|
// a common outer into one parallel `FanOutLookupJoinNode` when the cost
|
|
@@ -225,7 +446,11 @@ export class Optimizer {
|
|
|
225
446
|
nodeType: PlanNodeType.Project,
|
|
226
447
|
phase: 'rewrite',
|
|
227
448
|
fn: ruleFanOutLookupJoin,
|
|
228
|
-
priority: 23
|
|
449
|
+
priority: 23,
|
|
450
|
+
// Clusters per-outer-row branches into a parallel fan-out — drives
|
|
451
|
+
// branches concurrently. Refuses to cluster a branch whose subtree
|
|
452
|
+
// carries a write.
|
|
453
|
+
sideEffectMode: 'aware',
|
|
229
454
|
});
|
|
230
455
|
// Join elimination (FK→PK): drop LEFT/INNER joins whose non-preserved side
|
|
231
456
|
// is never referenced above the join and is at-most-one-matching per a
|
|
@@ -237,7 +462,10 @@ export class Optimizer {
|
|
|
237
462
|
nodeType: PlanNodeType.Project,
|
|
238
463
|
phase: 'rewrite',
|
|
239
464
|
fn: ruleJoinElimination,
|
|
240
|
-
priority: 24
|
|
465
|
+
priority: 24,
|
|
466
|
+
// Drops the non-preserved side of a join — refuses to drop a subtree
|
|
467
|
+
// that carries a write.
|
|
468
|
+
sideEffectMode: 'aware',
|
|
241
469
|
});
|
|
242
470
|
// Subquery decorrelation: transform correlated EXISTS/IN into semi/anti joins
|
|
243
471
|
// Runs after predicate pushdown (priority 25 > 20) so inner predicates are already pushed
|
|
@@ -246,7 +474,11 @@ export class Optimizer {
|
|
|
246
474
|
nodeType: PlanNodeType.Filter,
|
|
247
475
|
phase: 'rewrite',
|
|
248
476
|
fn: ruleSubqueryDecorrelation,
|
|
249
|
-
priority: 25
|
|
477
|
+
priority: 25,
|
|
478
|
+
// Transforms EXISTS(correlated) / IN(correlated) into semi/anti
|
|
479
|
+
// joins, changing how many times the inner subquery's subtree is
|
|
480
|
+
// executed — refuses when the inner subtree carries a write.
|
|
481
|
+
sideEffectMode: 'aware',
|
|
250
482
|
});
|
|
251
483
|
// IND-driven existence folding (priority 26 — runs after decorrelation has
|
|
252
484
|
// materialized EXISTS / NOT EXISTS as semi/anti joins):
|
|
@@ -259,17 +491,23 @@ export class Optimizer {
|
|
|
259
491
|
nodeType: PlanNodeType.Join,
|
|
260
492
|
phase: 'rewrite',
|
|
261
493
|
fn: ruleAntiJoinFkEmpty,
|
|
262
|
-
priority: 26
|
|
494
|
+
priority: 26,
|
|
495
|
+
// Folds an anti-join to EmptyRelation, dropping both sides. Refuses
|
|
496
|
+
// when either side carries a write.
|
|
497
|
+
sideEffectMode: 'aware',
|
|
263
498
|
});
|
|
264
499
|
this.passManager.addRuleToPass(PassId.Structural, {
|
|
265
500
|
id: 'semi-join-fk-trivial',
|
|
266
501
|
nodeType: PlanNodeType.Join,
|
|
267
502
|
phase: 'rewrite',
|
|
268
503
|
fn: ruleSemiJoinFkTrivial,
|
|
269
|
-
priority: 26
|
|
504
|
+
priority: 26,
|
|
505
|
+
// Drops the R side of a semi-join (replacing with a NOT NULL filter on
|
|
506
|
+
// L). Refuses when R carries a write.
|
|
507
|
+
sideEffectMode: 'aware',
|
|
270
508
|
});
|
|
271
509
|
// Aggregate variant of join-elimination: when an Aggregate sits over an
|
|
272
|
-
// FK-covered inner join and only references the FK side (or `count(*)`),
|
|
510
|
+
// FK-covered left/right/inner join and only references the FK side (or `count(*)`),
|
|
273
511
|
// drop the join. Shares chain-walking + FK-PK alignment with
|
|
274
512
|
// ruleJoinElimination via the same module.
|
|
275
513
|
this.passManager.addRuleToPass(PassId.Structural, {
|
|
@@ -277,7 +515,10 @@ export class Optimizer {
|
|
|
277
515
|
nodeType: PlanNodeType.Aggregate,
|
|
278
516
|
phase: 'rewrite',
|
|
279
517
|
fn: ruleJoinEliminationUnderAggregate,
|
|
280
|
-
priority: 26
|
|
518
|
+
priority: 26,
|
|
519
|
+
// Drops the non-preserved side of a left/right/inner join sitting under
|
|
520
|
+
// an Aggregate — same guard as ruleJoinElimination.
|
|
521
|
+
sideEffectMode: 'aware',
|
|
281
522
|
});
|
|
282
523
|
// ORDER BY FD pruning: drop trailing ORDER BY keys functionally determined
|
|
283
524
|
// by the leading bare-column keys (under the source's FDs + ECs). Reduces
|
|
@@ -292,7 +533,12 @@ export class Optimizer {
|
|
|
292
533
|
nodeType: PlanNodeType.Sort,
|
|
293
534
|
phase: 'rewrite',
|
|
294
535
|
fn: ruleOrderByFdPruning,
|
|
295
|
-
priority: 26
|
|
536
|
+
priority: 26,
|
|
537
|
+
// Drops trailing ORDER BY keys (or the whole Sort) — the keys are
|
|
538
|
+
// either bare ColumnReferenceNodes (pure) or kept opaque. The Sort's
|
|
539
|
+
// source is preserved verbatim. Whole-Sort elimination is also safe:
|
|
540
|
+
// it returns `node.source`, so every subtree below survives intact.
|
|
541
|
+
sideEffectMode: 'safe',
|
|
296
542
|
});
|
|
297
543
|
// Predicate-contradiction folding (priority 27 — after IND rules at 26):
|
|
298
544
|
// detect when (filter predicate ∧ source domainConstraints ∧ literal
|
|
@@ -312,6 +558,9 @@ export class Optimizer {
|
|
|
312
558
|
phase: 'rewrite',
|
|
313
559
|
fn: ruleFilterContradiction,
|
|
314
560
|
priority: 27,
|
|
561
|
+
// Replaces the Filter (and its source) with EmptyRelation — refuses
|
|
562
|
+
// when the source subtree carries a write.
|
|
563
|
+
sideEffectMode: 'aware',
|
|
315
564
|
});
|
|
316
565
|
// Empty-relation folding (priority 27 — after IND rules at 26): recognize
|
|
317
566
|
// provably-empty subtrees (Filter on lit-false, or any host with an
|
|
@@ -324,6 +573,8 @@ export class Optimizer {
|
|
|
324
573
|
phase: 'rewrite',
|
|
325
574
|
fn: ruleFilterFoldEmpty,
|
|
326
575
|
priority: 27,
|
|
576
|
+
// `Filter(x, lit-false)` drops `x` — refuses when `x` has side effects.
|
|
577
|
+
sideEffectMode: 'aware',
|
|
327
578
|
});
|
|
328
579
|
this.passManager.addRuleToPass(PassId.Structural, {
|
|
329
580
|
id: 'fold-project-empty',
|
|
@@ -331,6 +582,10 @@ export class Optimizer {
|
|
|
331
582
|
phase: 'rewrite',
|
|
332
583
|
fn: ruleProjectFoldEmpty,
|
|
333
584
|
priority: 27,
|
|
585
|
+
// Fires only when source is already an EmptyRelation (a pure marker
|
|
586
|
+
// with no children); side-effect-bearing subtree cannot reach this
|
|
587
|
+
// fold without itself first being folded.
|
|
588
|
+
sideEffectMode: 'safe',
|
|
334
589
|
});
|
|
335
590
|
this.passManager.addRuleToPass(PassId.Structural, {
|
|
336
591
|
id: 'fold-sort-empty',
|
|
@@ -338,6 +593,8 @@ export class Optimizer {
|
|
|
338
593
|
phase: 'rewrite',
|
|
339
594
|
fn: ruleSortFoldEmpty,
|
|
340
595
|
priority: 27,
|
|
596
|
+
// Source is EmptyRelation; see fold-project-empty.
|
|
597
|
+
sideEffectMode: 'safe',
|
|
341
598
|
});
|
|
342
599
|
this.passManager.addRuleToPass(PassId.Structural, {
|
|
343
600
|
id: 'fold-limit-empty',
|
|
@@ -345,6 +602,8 @@ export class Optimizer {
|
|
|
345
602
|
phase: 'rewrite',
|
|
346
603
|
fn: ruleLimitOffsetFoldEmpty,
|
|
347
604
|
priority: 27,
|
|
605
|
+
// Source is EmptyRelation; see fold-project-empty.
|
|
606
|
+
sideEffectMode: 'safe',
|
|
348
607
|
});
|
|
349
608
|
this.passManager.addRuleToPass(PassId.Structural, {
|
|
350
609
|
id: 'fold-distinct-empty',
|
|
@@ -352,6 +611,8 @@ export class Optimizer {
|
|
|
352
611
|
phase: 'rewrite',
|
|
353
612
|
fn: ruleDistinctFoldEmpty,
|
|
354
613
|
priority: 27,
|
|
614
|
+
// Source is EmptyRelation; see fold-project-empty.
|
|
615
|
+
sideEffectMode: 'safe',
|
|
355
616
|
});
|
|
356
617
|
this.passManager.addRuleToPass(PassId.Structural, {
|
|
357
618
|
id: 'fold-join-empty',
|
|
@@ -359,6 +620,10 @@ export class Optimizer {
|
|
|
359
620
|
phase: 'rewrite',
|
|
360
621
|
fn: ruleJoinFoldEmpty,
|
|
361
622
|
priority: 27,
|
|
623
|
+
// Folds an inner/cross/semi/anti join with an empty side to Empty,
|
|
624
|
+
// dropping the *other* side — refuses when the dropped side carries
|
|
625
|
+
// a write.
|
|
626
|
+
sideEffectMode: 'aware',
|
|
362
627
|
});
|
|
363
628
|
// Physical pass rules (bottom-up) - for logical to physical transformations
|
|
364
629
|
this.passManager.addRuleToPass(PassId.Physical, {
|
|
@@ -366,7 +631,10 @@ export class Optimizer {
|
|
|
366
631
|
nodeType: PlanNodeType.Retrieve,
|
|
367
632
|
phase: 'impl',
|
|
368
633
|
fn: ruleSelectAccessPath,
|
|
369
|
-
priority: 10
|
|
634
|
+
priority: 10,
|
|
635
|
+
// Replaces a logical Retrieve with a physical access node over the
|
|
636
|
+
// same TableReference — read-only by construction.
|
|
637
|
+
sideEffectMode: 'safe',
|
|
370
638
|
});
|
|
371
639
|
// QuickPick join enumeration (optional via tuning)
|
|
372
640
|
this.passManager.addRuleToPass(PassId.Physical, {
|
|
@@ -374,14 +642,20 @@ export class Optimizer {
|
|
|
374
642
|
nodeType: PlanNodeType.Join,
|
|
375
643
|
phase: 'impl',
|
|
376
644
|
fn: ruleQuickPickJoinEnumeration,
|
|
377
|
-
priority: 5
|
|
645
|
+
priority: 5,
|
|
646
|
+
// Reorders inner-join trees by cost — would change side-effect
|
|
647
|
+
// execution order. Refuses when any leaf relation has side effects.
|
|
648
|
+
sideEffectMode: 'aware',
|
|
378
649
|
});
|
|
379
650
|
this.passManager.addRuleToPass(PassId.Physical, {
|
|
380
651
|
id: 'aggregate-physical',
|
|
381
652
|
nodeType: PlanNodeType.Aggregate,
|
|
382
653
|
phase: 'impl',
|
|
383
654
|
fn: ruleAggregatePhysical,
|
|
384
|
-
priority: 20
|
|
655
|
+
priority: 20,
|
|
656
|
+
// Selects Stream vs Hash aggregate; the source is preserved verbatim
|
|
657
|
+
// (or wrapped in a Sort, which executes its source once).
|
|
658
|
+
sideEffectMode: 'safe',
|
|
385
659
|
});
|
|
386
660
|
// Recognize lateral-top-1 asof. Runs in the Structural pass (before
|
|
387
661
|
// predicate-pushdown at priority 20) so the lateral's Filter still
|
|
@@ -392,7 +666,12 @@ export class Optimizer {
|
|
|
392
666
|
nodeType: PlanNodeType.Join,
|
|
393
667
|
phase: 'rewrite',
|
|
394
668
|
fn: ruleLateralTop1Asof,
|
|
395
|
-
priority: 5
|
|
669
|
+
priority: 5,
|
|
670
|
+
// Recognizes a very narrow shape (Project/Limit/Sort/Filter chain
|
|
671
|
+
// over a vtab leaf that advertises asofRight) — leaf must be a
|
|
672
|
+
// physical TableReference, so all participating subtrees are
|
|
673
|
+
// read-only by construction.
|
|
674
|
+
sideEffectMode: 'safe',
|
|
396
675
|
});
|
|
397
676
|
// Post-optimization pass rules (bottom-up) - for cleanup and caching
|
|
398
677
|
// Physical join selection runs here (after Physical pass) so QuickPick can
|
|
@@ -406,7 +685,10 @@ export class Optimizer {
|
|
|
406
685
|
nodeType: PlanNodeType.Join,
|
|
407
686
|
phase: 'impl',
|
|
408
687
|
fn: ruleMonotonicMergeJoin,
|
|
409
|
-
priority: 4
|
|
688
|
+
priority: 4,
|
|
689
|
+
// Replaces a logical Join with a MergeJoin; both children survive
|
|
690
|
+
// in their original positions (no swap).
|
|
691
|
+
sideEffectMode: 'safe',
|
|
410
692
|
});
|
|
411
693
|
// Monotonic streaming-window recognition. Runs after monotonic-merge-join
|
|
412
694
|
// (priority 4) so child joins have already become MergeJoins and
|
|
@@ -417,14 +699,20 @@ export class Optimizer {
|
|
|
417
699
|
nodeType: PlanNodeType.Window,
|
|
418
700
|
phase: 'impl',
|
|
419
701
|
fn: ruleMonotonicWindow,
|
|
420
|
-
priority: 6
|
|
702
|
+
priority: 6,
|
|
703
|
+
// Tags the WindowNode with a streaming config in place; source and
|
|
704
|
+
// functions are preserved verbatim.
|
|
705
|
+
sideEffectMode: 'safe',
|
|
421
706
|
});
|
|
422
707
|
this.passManager.addRuleToPass(PassId.PostOptimization, {
|
|
423
708
|
id: 'join-physical-selection',
|
|
424
709
|
nodeType: PlanNodeType.Join,
|
|
425
710
|
phase: 'impl',
|
|
426
711
|
fn: ruleJoinPhysicalSelection,
|
|
427
|
-
priority: 5
|
|
712
|
+
priority: 5,
|
|
713
|
+
// May swap build/probe sides of an INNER hash join — would reorder
|
|
714
|
+
// side-effect execution. Refuses when either side has side effects.
|
|
715
|
+
sideEffectMode: 'aware',
|
|
428
716
|
});
|
|
429
717
|
// Monotonic LIMIT/OFFSET pushdown: replace LimitOffset[/Sort]/access-leaf
|
|
430
718
|
// with OrdinalSlice when the leaf advertises supportsOrdinalSeek. Runs in
|
|
@@ -434,7 +722,11 @@ export class Optimizer {
|
|
|
434
722
|
nodeType: PlanNodeType.LimitOffset,
|
|
435
723
|
phase: 'impl',
|
|
436
724
|
fn: ruleMonotonicLimitPushdown,
|
|
437
|
-
priority: 8
|
|
725
|
+
priority: 8,
|
|
726
|
+
// Slides LIMIT/OFFSET into a physical access leaf via OrdinalSlice;
|
|
727
|
+
// only fires when the chain peels to a SeqScan/IndexScan/IndexSeek
|
|
728
|
+
// (all read-only by construction).
|
|
729
|
+
sideEffectMode: 'safe',
|
|
438
730
|
});
|
|
439
731
|
// Monotonic range-scan recognition. Runs on physical leaves to annotate
|
|
440
732
|
// `rangeBoundedOn` when a handled range/equality bounds the monotonic
|
|
@@ -458,7 +750,9 @@ export class Optimizer {
|
|
|
458
750
|
nodeType,
|
|
459
751
|
phase: 'rewrite',
|
|
460
752
|
fn: ruleMonotonicRangeAccess,
|
|
461
|
-
priority: 9
|
|
753
|
+
priority: 9,
|
|
754
|
+
// Pure annotation of a physical access leaf (read-only).
|
|
755
|
+
sideEffectMode: 'safe',
|
|
462
756
|
});
|
|
463
757
|
}
|
|
464
758
|
this.passManager.addRuleToPass(PassId.PostOptimization, {
|
|
@@ -466,14 +760,20 @@ export class Optimizer {
|
|
|
466
760
|
nodeType: PlanNodeType.Filter,
|
|
467
761
|
phase: 'rewrite',
|
|
468
762
|
fn: ruleMonotonicRangeAccess,
|
|
469
|
-
priority: 9
|
|
763
|
+
priority: 9,
|
|
764
|
+
// Defensive escalation: drops a leaf's monotonicOn advertisement;
|
|
765
|
+
// the leaf and Filter source tree survive verbatim.
|
|
766
|
+
sideEffectMode: 'safe',
|
|
470
767
|
});
|
|
471
768
|
this.passManager.addRuleToPass(PassId.PostOptimization, {
|
|
472
769
|
id: 'mutating-subquery-cache',
|
|
473
770
|
nodeType: PlanNodeType.Join,
|
|
474
771
|
phase: 'rewrite',
|
|
475
772
|
fn: ruleMutatingSubqueryCache,
|
|
476
|
-
priority: 10
|
|
773
|
+
priority: 10,
|
|
774
|
+
// Specifically *targets* side-effect-bearing right sides and wraps
|
|
775
|
+
// them in a run-once CacheNode — the canonical aware rule.
|
|
776
|
+
sideEffectMode: 'aware',
|
|
477
777
|
});
|
|
478
778
|
// AsofScan strategy selection (hash → merge). Runs after the leaves'
|
|
479
779
|
// physical.ordering / monotonicOn are finalized (range-access at
|
|
@@ -483,7 +783,9 @@ export class Optimizer {
|
|
|
483
783
|
nodeType: PlanNodeType.AsofScan,
|
|
484
784
|
phase: 'impl',
|
|
485
785
|
fn: ruleAsofStrategySelect,
|
|
486
|
-
priority: 11
|
|
786
|
+
priority: 11,
|
|
787
|
+
// Flips a strategy field on an existing AsofScan; children survive.
|
|
788
|
+
sideEffectMode: 'safe',
|
|
487
789
|
});
|
|
488
790
|
// Async-gather UNION ALL fold: collapse a chain of
|
|
489
791
|
// SetOperationNode(unionAll) into one N-ary AsyncGatherNode(unionAll)
|
|
@@ -502,7 +804,11 @@ export class Optimizer {
|
|
|
502
804
|
nodeType: PlanNodeType.SetOperation,
|
|
503
805
|
phase: 'rewrite',
|
|
504
806
|
fn: ruleAsyncGatherUnionAll,
|
|
505
|
-
priority: 17
|
|
807
|
+
priority: 17,
|
|
808
|
+
// Drives N branches concurrently — would interleave writes from
|
|
809
|
+
// side-effect-bearing branches in non-deterministic order. Refuses
|
|
810
|
+
// when any branch carries a write.
|
|
811
|
+
sideEffectMode: 'aware',
|
|
506
812
|
});
|
|
507
813
|
// Async-gather ZIP BY KEY fold: collapse a `Project` over a chain of
|
|
508
814
|
// binary full-outer `JoinNode`s sharing a common key set into one N-ary
|
|
@@ -517,7 +823,9 @@ export class Optimizer {
|
|
|
517
823
|
nodeType: PlanNodeType.Project,
|
|
518
824
|
phase: 'rewrite',
|
|
519
825
|
fn: ruleAsyncGatherZipByKey,
|
|
520
|
-
priority: 17
|
|
826
|
+
priority: 17,
|
|
827
|
+
// Concurrent N-ary zip by key — same concern as union-all gather.
|
|
828
|
+
sideEffectMode: 'aware',
|
|
521
829
|
});
|
|
522
830
|
// Eager-prefetch probe wrap: when a physical hash join's build (right)
|
|
523
831
|
// side is high-latency, wrap the probe (left) side in an
|
|
@@ -536,7 +844,11 @@ export class Optimizer {
|
|
|
536
844
|
nodeType: PlanNodeType.HashJoin,
|
|
537
845
|
phase: 'rewrite',
|
|
538
846
|
fn: ruleEagerPrefetchProbe,
|
|
539
|
-
priority: 15
|
|
847
|
+
priority: 15,
|
|
848
|
+
// Wraps the probe side in a concurrent prefetch pump — iterates the
|
|
849
|
+
// probe subtree concurrently with the build side, which would
|
|
850
|
+
// interleave writes. Refuses when either side has side effects.
|
|
851
|
+
sideEffectMode: 'aware',
|
|
540
852
|
});
|
|
541
853
|
// Fan-out batched-outer recognition: flip an already-formed
|
|
542
854
|
// `FanOutLookupJoinNode` from serial to batched outer mode when the per-row
|
|
@@ -553,14 +865,23 @@ export class Optimizer {
|
|
|
553
865
|
nodeType: PlanNodeType.FanOutLookupJoin,
|
|
554
866
|
phase: 'rewrite',
|
|
555
867
|
fn: ruleFanOutBatchedOuter,
|
|
556
|
-
priority: 16
|
|
868
|
+
priority: 16,
|
|
869
|
+
// Flips fan-out outer pump to batched (concurrent) — interleaves
|
|
870
|
+
// outer iteration with branch lookups. Refuses on side-effect outer.
|
|
871
|
+
sideEffectMode: 'aware',
|
|
557
872
|
});
|
|
558
873
|
this.passManager.addRuleToPass(PassId.PostOptimization, {
|
|
559
874
|
id: 'cte-optimization',
|
|
560
875
|
nodeType: PlanNodeType.CTE,
|
|
561
876
|
phase: 'rewrite',
|
|
562
877
|
fn: ruleCteOptimization,
|
|
563
|
-
priority: 20
|
|
878
|
+
priority: 20,
|
|
879
|
+
// Wraps a CTE source in CacheNode. CacheNode materializes on first
|
|
880
|
+
// read and replays on subsequent reads — a run-once fence over the
|
|
881
|
+
// source, so a side-effect-bearing CTE that was previously rerun
|
|
882
|
+
// per reference would now run once. That is sound but order-changing,
|
|
883
|
+
// so the rule is aware of side effects.
|
|
884
|
+
sideEffectMode: 'aware',
|
|
564
885
|
});
|
|
565
886
|
// IN-subquery caching: wrap uncorrelated IN subquery sources in CacheNode
|
|
566
887
|
this.passManager.addRuleToPass(PassId.PostOptimization, {
|
|
@@ -568,7 +889,9 @@ export class Optimizer {
|
|
|
568
889
|
nodeType: PlanNodeType.In,
|
|
569
890
|
phase: 'rewrite',
|
|
570
891
|
fn: ruleInSubqueryCache,
|
|
571
|
-
priority: 25
|
|
892
|
+
priority: 25,
|
|
893
|
+
// Already gates on `isFunctional(source)` (deterministic + read-only).
|
|
894
|
+
sideEffectMode: 'aware',
|
|
572
895
|
});
|
|
573
896
|
// Register materialization advisory for multiple node types
|
|
574
897
|
const nodeTypesForMaterialization = [
|
|
@@ -591,7 +914,17 @@ export class Optimizer {
|
|
|
591
914
|
nodeType,
|
|
592
915
|
phase: 'rewrite',
|
|
593
916
|
fn: ruleMaterializationAdvisory,
|
|
594
|
-
priority: 30
|
|
917
|
+
priority: 30,
|
|
918
|
+
// Delegates to MaterializationAdvisory. The advisory does not
|
|
919
|
+
// explicitly consult `hasSideEffects` — soundness for impure
|
|
920
|
+
// subtrees rests on CacheNode itself being a run-once fence
|
|
921
|
+
// (materialize-on-first-read, replay thereafter), so a
|
|
922
|
+
// side-effect-bearing subtree that the advisory would otherwise
|
|
923
|
+
// wrap runs exactly once instead of per-reference. That is a
|
|
924
|
+
// count-change but order-preserving rewrite — and matches the
|
|
925
|
+
// run-once contract the scalar / IN / EXISTS emitters apply
|
|
926
|
+
// directly when their inner is impure (see `docs/runtime.md`).
|
|
927
|
+
sideEffectMode: 'aware',
|
|
595
928
|
});
|
|
596
929
|
}
|
|
597
930
|
log('Registered rules to optimization passes');
|