@quereus/quereus 0.7.2 → 0.7.4
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/package.json +3 -3
- package/dist/src/common/constants.js.map +0 -1
- package/dist/src/common/datatype.js.map +0 -1
- package/dist/src/common/errors.js.map +0 -1
- package/dist/src/common/json-types.js.map +0 -1
- package/dist/src/common/logger.js.map +0 -1
- package/dist/src/common/type-inference.js.map +0 -1
- package/dist/src/common/types.js.map +0 -1
- package/dist/src/core/database-options.js.map +0 -1
- package/dist/src/core/database.js.map +0 -1
- package/dist/src/core/param.js.map +0 -1
- package/dist/src/core/statement.js.map +0 -1
- package/dist/src/func/builtins/aggregate.js.map +0 -1
- package/dist/src/func/builtins/builtin-window-functions.js.map +0 -1
- package/dist/src/func/builtins/conversion.js.map +0 -1
- package/dist/src/func/builtins/datetime.js.map +0 -1
- package/dist/src/func/builtins/explain.js.map +0 -1
- package/dist/src/func/builtins/generation.js.map +0 -1
- package/dist/src/func/builtins/index.js.map +0 -1
- package/dist/src/func/builtins/json-helpers.js.map +0 -1
- package/dist/src/func/builtins/json-tvf.js.map +0 -1
- package/dist/src/func/builtins/json.js.map +0 -1
- package/dist/src/func/builtins/scalar.js.map +0 -1
- package/dist/src/func/builtins/schema.js.map +0 -1
- package/dist/src/func/builtins/string.js.map +0 -1
- package/dist/src/func/builtins/timespan.js.map +0 -1
- package/dist/src/func/context.js.map +0 -1
- package/dist/src/func/registration.js.map +0 -1
- package/dist/src/index.js.map +0 -1
- package/dist/src/parser/ast.js.map +0 -1
- package/dist/src/parser/index.js.map +0 -1
- package/dist/src/parser/lexer.js.map +0 -1
- package/dist/src/parser/parser.js.map +0 -1
- package/dist/src/parser/utils.js.map +0 -1
- package/dist/src/parser/visitor.js.map +0 -1
- package/dist/src/planner/analysis/binding-collector.js.map +0 -1
- package/dist/src/planner/analysis/const-evaluator.js.map +0 -1
- package/dist/src/planner/analysis/const-pass.js.map +0 -1
- package/dist/src/planner/analysis/constraint-extractor.js.map +0 -1
- package/dist/src/planner/analysis/predicate-normalizer.js.map +0 -1
- package/dist/src/planner/building/alter-table.js.map +0 -1
- package/dist/src/planner/building/block.js.map +0 -1
- package/dist/src/planner/building/constraint-builder.js.map +0 -1
- package/dist/src/planner/building/create-assertion.js.map +0 -1
- package/dist/src/planner/building/create-view.js.map +0 -1
- package/dist/src/planner/building/ddl.js.map +0 -1
- package/dist/src/planner/building/declare-schema.js.map +0 -1
- package/dist/src/planner/building/delete.js.map +0 -1
- package/dist/src/planner/building/drop-assertion.js.map +0 -1
- package/dist/src/planner/building/drop-table.js.map +0 -1
- package/dist/src/planner/building/drop-view.js.map +0 -1
- package/dist/src/planner/building/expression.js.map +0 -1
- package/dist/src/planner/building/function-call.js.map +0 -1
- package/dist/src/planner/building/insert.js.map +0 -1
- package/dist/src/planner/building/pragma.js.map +0 -1
- package/dist/src/planner/building/schema-resolution.js.map +0 -1
- package/dist/src/planner/building/select-aggregates.js.map +0 -1
- package/dist/src/planner/building/select-compound.js.map +0 -1
- package/dist/src/planner/building/select-context.js.map +0 -1
- package/dist/src/planner/building/select-modifiers.js.map +0 -1
- package/dist/src/planner/building/select-projections.js.map +0 -1
- package/dist/src/planner/building/select-window.js.map +0 -1
- package/dist/src/planner/building/select.js.map +0 -1
- package/dist/src/planner/building/table-function.js.map +0 -1
- package/dist/src/planner/building/table.js.map +0 -1
- package/dist/src/planner/building/transaction.js.map +0 -1
- package/dist/src/planner/building/update.js.map +0 -1
- package/dist/src/planner/building/with.js.map +0 -1
- package/dist/src/planner/cache/correlation-detector.js.map +0 -1
- package/dist/src/planner/cache/materialization-advisory.js.map +0 -1
- package/dist/src/planner/cache/reference-graph.js.map +0 -1
- package/dist/src/planner/cost/index.js.map +0 -1
- package/dist/src/planner/debug/logger-utils.js.map +0 -1
- package/dist/src/planner/debug.js.map +0 -1
- package/dist/src/planner/framework/characteristics.js.map +0 -1
- package/dist/src/planner/framework/context.js.map +0 -1
- package/dist/src/planner/framework/pass.js.map +0 -1
- package/dist/src/planner/framework/physical-utils.js.map +0 -1
- package/dist/src/planner/framework/registry.js.map +0 -1
- package/dist/src/planner/framework/trace.js.map +0 -1
- package/dist/src/planner/nodes/add-constraint-node.js.map +0 -1
- package/dist/src/planner/nodes/aggregate-function.js.map +0 -1
- package/dist/src/planner/nodes/aggregate-node.js.map +0 -1
- package/dist/src/planner/nodes/array-index-node.js.map +0 -1
- package/dist/src/planner/nodes/block.js.map +0 -1
- package/dist/src/planner/nodes/cache-node.js.map +0 -1
- package/dist/src/planner/nodes/constraint-check-node.js.map +0 -1
- package/dist/src/planner/nodes/create-assertion-node.js.map +0 -1
- package/dist/src/planner/nodes/create-index-node.js.map +0 -1
- package/dist/src/planner/nodes/create-table-node.js.map +0 -1
- package/dist/src/planner/nodes/create-view-node.js.map +0 -1
- package/dist/src/planner/nodes/cte-node.js.map +0 -1
- package/dist/src/planner/nodes/cte-reference-node.js.map +0 -1
- package/dist/src/planner/nodes/declarative-schema.js.map +0 -1
- package/dist/src/planner/nodes/delete-node.js.map +0 -1
- package/dist/src/planner/nodes/distinct-node.js.map +0 -1
- package/dist/src/planner/nodes/dml-executor-node.js.map +0 -1
- package/dist/src/planner/nodes/drop-assertion-node.js.map +0 -1
- package/dist/src/planner/nodes/drop-table-node.js.map +0 -1
- package/dist/src/planner/nodes/drop-view-node.js.map +0 -1
- package/dist/src/planner/nodes/filter.js.map +0 -1
- package/dist/src/planner/nodes/function.js.map +0 -1
- package/dist/src/planner/nodes/insert-node.js.map +0 -1
- package/dist/src/planner/nodes/internal-recursive-cte-ref-node.js.map +0 -1
- package/dist/src/planner/nodes/join-node.js.map +0 -1
- package/dist/src/planner/nodes/limit-offset.js.map +0 -1
- package/dist/src/planner/nodes/plan-node-type.js.map +0 -1
- package/dist/src/planner/nodes/plan-node.js.map +0 -1
- package/dist/src/planner/nodes/pragma.js.map +0 -1
- package/dist/src/planner/nodes/project-node.js.map +0 -1
- package/dist/src/planner/nodes/recursive-cte-node.js.map +0 -1
- package/dist/src/planner/nodes/reference.js.map +0 -1
- package/dist/src/planner/nodes/remote-query-node.js.map +0 -1
- package/dist/src/planner/nodes/retrieve-node.js.map +0 -1
- package/dist/src/planner/nodes/returning-node.js.map +0 -1
- package/dist/src/planner/nodes/scalar.js.map +0 -1
- package/dist/src/planner/nodes/sequencing-node.js.map +0 -1
- package/dist/src/planner/nodes/set-operation-node.js.map +0 -1
- package/dist/src/planner/nodes/single-row.js.map +0 -1
- package/dist/src/planner/nodes/sink-node.js.map +0 -1
- package/dist/src/planner/nodes/sort.js.map +0 -1
- package/dist/src/planner/nodes/stream-aggregate.js.map +0 -1
- package/dist/src/planner/nodes/subquery.js.map +0 -1
- package/dist/src/planner/nodes/table-access-nodes.js.map +0 -1
- package/dist/src/planner/nodes/table-function-call.js.map +0 -1
- package/dist/src/planner/nodes/transaction-node.js.map +0 -1
- package/dist/src/planner/nodes/update-node.js.map +0 -1
- package/dist/src/planner/nodes/values-node.js.map +0 -1
- package/dist/src/planner/nodes/view-reference-node.js.map +0 -1
- package/dist/src/planner/nodes/window-function.js.map +0 -1
- package/dist/src/planner/nodes/window-node.js.map +0 -1
- package/dist/src/planner/optimizer-tuning.js.map +0 -1
- package/dist/src/planner/optimizer.js.map +0 -1
- package/dist/src/planner/planning-context.js.map +0 -1
- package/dist/src/planner/resolve.js.map +0 -1
- package/dist/src/planner/rules/access/rule-select-access-path.js.map +0 -1
- package/dist/src/planner/rules/aggregate/rule-aggregate-streaming.js.map +0 -1
- package/dist/src/planner/rules/cache/rule-cte-optimization.js.map +0 -1
- package/dist/src/planner/rules/cache/rule-materialization-advisory.js.map +0 -1
- package/dist/src/planner/rules/cache/rule-mutating-subquery-cache.js.map +0 -1
- package/dist/src/planner/rules/join/rule-join-greedy-commute.js.map +0 -1
- package/dist/src/planner/rules/join/rule-join-key-inference.js.map +0 -1
- package/dist/src/planner/rules/join/rule-quickpick-enumeration.js.map +0 -1
- package/dist/src/planner/rules/predicate/rule-predicate-pushdown.js.map +0 -1
- package/dist/src/planner/rules/retrieve/rule-grow-retrieve.js.map +0 -1
- package/dist/src/planner/scopes/aliased.js.map +0 -1
- package/dist/src/planner/scopes/base.js.map +0 -1
- package/dist/src/planner/scopes/empty.js.map +0 -1
- package/dist/src/planner/scopes/global.js.map +0 -1
- package/dist/src/planner/scopes/multi.js.map +0 -1
- package/dist/src/planner/scopes/param.js.map +0 -1
- package/dist/src/planner/scopes/registered.js.map +0 -1
- package/dist/src/planner/scopes/scope.js.map +0 -1
- package/dist/src/planner/stats/basic-estimates.js.map +0 -1
- package/dist/src/planner/stats/index.js.map +0 -1
- package/dist/src/planner/type-utils.js.map +0 -1
- package/dist/src/planner/util/key-utils.js.map +0 -1
- package/dist/src/planner/validation/determinism-validator.js.map +0 -1
- package/dist/src/planner/validation/plan-validator.js.map +0 -1
- package/dist/src/runtime/async-util.js.map +0 -1
- package/dist/src/runtime/cache/shared-cache.js.map +0 -1
- package/dist/src/runtime/context-helpers.js.map +0 -1
- package/dist/src/runtime/deferred-constraint-queue.js.map +0 -1
- package/dist/src/runtime/emission-context.js.map +0 -1
- package/dist/src/runtime/emit/add-constraint.js.map +0 -1
- package/dist/src/runtime/emit/aggregate.js.map +0 -1
- package/dist/src/runtime/emit/array-index.js.map +0 -1
- package/dist/src/runtime/emit/between.js.map +0 -1
- package/dist/src/runtime/emit/binary.js.map +0 -1
- package/dist/src/runtime/emit/block.js.map +0 -1
- package/dist/src/runtime/emit/cache.js.map +0 -1
- package/dist/src/runtime/emit/case.js.map +0 -1
- package/dist/src/runtime/emit/cast.js.map +0 -1
- package/dist/src/runtime/emit/collate.js.map +0 -1
- package/dist/src/runtime/emit/column-reference.js.map +0 -1
- package/dist/src/runtime/emit/constraint-check.js.map +0 -1
- package/dist/src/runtime/emit/create-assertion.js.map +0 -1
- package/dist/src/runtime/emit/create-index.js.map +0 -1
- package/dist/src/runtime/emit/create-table.js.map +0 -1
- package/dist/src/runtime/emit/create-view.js.map +0 -1
- package/dist/src/runtime/emit/cte-reference.js.map +0 -1
- package/dist/src/runtime/emit/cte.js.map +0 -1
- package/dist/src/runtime/emit/delete.js.map +0 -1
- package/dist/src/runtime/emit/distinct.js.map +0 -1
- package/dist/src/runtime/emit/dml-executor.js.map +0 -1
- package/dist/src/runtime/emit/drop-assertion.js.map +0 -1
- package/dist/src/runtime/emit/drop-table.js.map +0 -1
- package/dist/src/runtime/emit/drop-view.js.map +0 -1
- package/dist/src/runtime/emit/filter.js.map +0 -1
- package/dist/src/runtime/emit/insert.js.map +0 -1
- package/dist/src/runtime/emit/internal-recursive-cte-ref.js.map +0 -1
- package/dist/src/runtime/emit/join.js.map +0 -1
- package/dist/src/runtime/emit/limit-offset.js.map +0 -1
- package/dist/src/runtime/emit/literal.js.map +0 -1
- package/dist/src/runtime/emit/parameter.js.map +0 -1
- package/dist/src/runtime/emit/pragma.js.map +0 -1
- package/dist/src/runtime/emit/project.js.map +0 -1
- package/dist/src/runtime/emit/recursive-cte.js.map +0 -1
- package/dist/src/runtime/emit/remote-query.js.map +0 -1
- package/dist/src/runtime/emit/retrieve.js.map +0 -1
- package/dist/src/runtime/emit/returning.js.map +0 -1
- package/dist/src/runtime/emit/scalar-function.js.map +0 -1
- package/dist/src/runtime/emit/scan.js.map +0 -1
- package/dist/src/runtime/emit/schema-declarative.js.map +0 -1
- package/dist/src/runtime/emit/sequencing.js.map +0 -1
- package/dist/src/runtime/emit/set-operation.js.map +0 -1
- package/dist/src/runtime/emit/sink.js.map +0 -1
- package/dist/src/runtime/emit/sort.js.map +0 -1
- package/dist/src/runtime/emit/subquery.js.map +0 -1
- package/dist/src/runtime/emit/table-valued-function.js.map +0 -1
- package/dist/src/runtime/emit/temporal-arithmetic.js.map +0 -1
- package/dist/src/runtime/emit/transaction.js.map +0 -1
- package/dist/src/runtime/emit/unary.js.map +0 -1
- package/dist/src/runtime/emit/update.js.map +0 -1
- package/dist/src/runtime/emit/values.js.map +0 -1
- package/dist/src/runtime/emit/window-function.js.map +0 -1
- package/dist/src/runtime/emit/window.js.map +0 -1
- package/dist/src/runtime/emitters.js.map +0 -1
- package/dist/src/runtime/register.js.map +0 -1
- package/dist/src/runtime/scheduler.js.map +0 -1
- package/dist/src/runtime/types.js.map +0 -1
- package/dist/src/runtime/utils.js.map +0 -1
- package/dist/src/schema/assertion.js.map +0 -1
- package/dist/src/schema/catalog.js.map +0 -1
- package/dist/src/schema/change-events.js.map +0 -1
- package/dist/src/schema/column.js.map +0 -1
- package/dist/src/schema/declared-schema-manager.js.map +0 -1
- package/dist/src/schema/function.js.map +0 -1
- package/dist/src/schema/manager.js.map +0 -1
- package/dist/src/schema/schema-differ.js.map +0 -1
- package/dist/src/schema/schema-hasher.js.map +0 -1
- package/dist/src/schema/schema.js.map +0 -1
- package/dist/src/schema/table.js.map +0 -1
- package/dist/src/schema/view.js.map +0 -1
- package/dist/src/schema/window-function.js.map +0 -1
- package/dist/src/types/builtin-types.js.map +0 -1
- package/dist/src/types/index.js.map +0 -1
- package/dist/src/types/json-type.js.map +0 -1
- package/dist/src/types/logical-type.js.map +0 -1
- package/dist/src/types/plugin-interface.js.map +0 -1
- package/dist/src/types/registry.js.map +0 -1
- package/dist/src/types/temporal-types.js.map +0 -1
- package/dist/src/types/validation.js.map +0 -1
- package/dist/src/util/affinity.js.map +0 -1
- package/dist/src/util/ast-stringify.js.map +0 -1
- package/dist/src/util/cached.js.map +0 -1
- package/dist/src/util/coercion.js.map +0 -1
- package/dist/src/util/comparison.js.map +0 -1
- package/dist/src/util/environment.js.map +0 -1
- package/dist/src/util/hash.js.map +0 -1
- package/dist/src/util/latches.js.map +0 -1
- package/dist/src/util/mutation-statement.js.map +0 -1
- package/dist/src/util/patterns.js.map +0 -1
- package/dist/src/util/plan-formatter.js.map +0 -1
- package/dist/src/util/plugin-helper.js.map +0 -1
- package/dist/src/util/row-descriptor.js.map +0 -1
- package/dist/src/util/serialization.js.map +0 -1
- package/dist/src/util/sql-literal.js.map +0 -1
- package/dist/src/util/working-table-iterable.js.map +0 -1
- package/dist/src/vtab/best-access-plan.js.map +0 -1
- package/dist/src/vtab/connection.js.map +0 -1
- package/dist/src/vtab/filter-info.js.map +0 -1
- package/dist/src/vtab/index-info.js.map +0 -1
- package/dist/src/vtab/manifest.js.map +0 -1
- package/dist/src/vtab/memory/connection.js.map +0 -1
- package/dist/src/vtab/memory/index.js.map +0 -1
- package/dist/src/vtab/memory/layer/base-cursor.js.map +0 -1
- package/dist/src/vtab/memory/layer/base.js.map +0 -1
- package/dist/src/vtab/memory/layer/connection.js.map +0 -1
- package/dist/src/vtab/memory/layer/interface.js.map +0 -1
- package/dist/src/vtab/memory/layer/manager.js.map +0 -1
- package/dist/src/vtab/memory/layer/safe-iterate.js.map +0 -1
- package/dist/src/vtab/memory/layer/scan-plan.js.map +0 -1
- package/dist/src/vtab/memory/layer/transaction-cursor.js.map +0 -1
- package/dist/src/vtab/memory/layer/transaction.js.map +0 -1
- package/dist/src/vtab/memory/module.js.map +0 -1
- package/dist/src/vtab/memory/table.js.map +0 -1
- package/dist/src/vtab/memory/types.js.map +0 -1
- package/dist/src/vtab/memory/utils/logging.js.map +0 -1
- package/dist/src/vtab/memory/utils/primary-key.js.map +0 -1
- package/dist/src/vtab/module.js.map +0 -1
- package/dist/src/vtab/table.js.map +0 -1
- package/src/common/constants.ts +0 -60
- package/src/common/datatype.ts +0 -85
- package/src/common/errors.ts +0 -189
- package/src/common/json-types.ts +0 -16
- package/src/common/logger.ts +0 -97
- package/src/common/type-inference.ts +0 -39
- package/src/common/types.ts +0 -151
- package/src/core/database-options.ts +0 -258
- package/src/core/database.ts +0 -1461
- package/src/core/param.ts +0 -56
- package/src/core/statement.ts +0 -528
- package/src/func/builtins/aggregate.ts +0 -269
- package/src/func/builtins/builtin-window-functions.ts +0 -166
- package/src/func/builtins/conversion.ts +0 -226
- package/src/func/builtins/datetime.ts +0 -500
- package/src/func/builtins/explain.ts +0 -779
- package/src/func/builtins/generation.ts +0 -43
- package/src/func/builtins/index.ts +0 -167
- package/src/func/builtins/json-helpers.ts +0 -237
- package/src/func/builtins/json-tvf.ts +0 -224
- package/src/func/builtins/json.ts +0 -588
- package/src/func/builtins/scalar.ts +0 -423
- package/src/func/builtins/schema.ts +0 -213
- package/src/func/builtins/string.ts +0 -306
- package/src/func/builtins/timespan.ts +0 -179
- package/src/func/context.ts +0 -258
- package/src/func/registration.ts +0 -201
- package/src/index.ts +0 -172
- package/src/parser/ast.ts +0 -581
- package/src/parser/index.ts +0 -65
- package/src/parser/lexer.ts +0 -806
- package/src/parser/parser.ts +0 -3352
- package/src/parser/utils.ts +0 -10
- package/src/parser/visitor.ts +0 -188
- package/src/planner/analysis/README.md +0 -93
- package/src/planner/analysis/binding-collector.ts +0 -83
- package/src/planner/analysis/const-evaluator.ts +0 -63
- package/src/planner/analysis/const-pass.ts +0 -282
- package/src/planner/analysis/constraint-extractor.ts +0 -764
- package/src/planner/analysis/predicate-normalizer.ts +0 -237
- package/src/planner/building/alter-table.ts +0 -49
- package/src/planner/building/block.ts +0 -93
- package/src/planner/building/constraint-builder.ts +0 -178
- package/src/planner/building/create-assertion.ts +0 -7
- package/src/planner/building/create-view.ts +0 -29
- package/src/planner/building/ddl.ts +0 -24
- package/src/planner/building/declare-schema.ts +0 -22
- package/src/planner/building/delete.ts +0 -218
- package/src/planner/building/drop-assertion.ts +0 -11
- package/src/planner/building/drop-table.ts +0 -13
- package/src/planner/building/drop-view.ts +0 -19
- package/src/planner/building/expression.ts +0 -205
- package/src/planner/building/function-call.ts +0 -129
- package/src/planner/building/insert.ts +0 -435
- package/src/planner/building/pragma.ts +0 -34
- package/src/planner/building/schema-resolution.ts +0 -176
- package/src/planner/building/select-aggregates.ts +0 -318
- package/src/planner/building/select-compound.ts +0 -119
- package/src/planner/building/select-context.ts +0 -85
- package/src/planner/building/select-modifiers.ts +0 -236
- package/src/planner/building/select-projections.ts +0 -177
- package/src/planner/building/select-window.ts +0 -259
- package/src/planner/building/select.ts +0 -567
- package/src/planner/building/table-function.ts +0 -49
- package/src/planner/building/table.ts +0 -40
- package/src/planner/building/transaction.ts +0 -23
- package/src/planner/building/update.ts +0 -331
- package/src/planner/building/with.ts +0 -180
- package/src/planner/cache/correlation-detector.ts +0 -83
- package/src/planner/cache/materialization-advisory.ts +0 -265
- package/src/planner/cache/reference-graph.ts +0 -196
- package/src/planner/cost/index.ts +0 -169
- package/src/planner/debug/logger-utils.ts +0 -68
- package/src/planner/debug.ts +0 -480
- package/src/planner/framework/README.md +0 -132
- package/src/planner/framework/characteristics.ts +0 -503
- package/src/planner/framework/context.ts +0 -239
- package/src/planner/framework/pass.ts +0 -354
- package/src/planner/framework/physical-utils.ts +0 -210
- package/src/planner/framework/registry.ts +0 -261
- package/src/planner/framework/trace.ts +0 -259
- package/src/planner/nodes/add-constraint-node.ts +0 -62
- package/src/planner/nodes/aggregate-function.ts +0 -155
- package/src/planner/nodes/aggregate-node.ts +0 -267
- package/src/planner/nodes/array-index-node.ts +0 -50
- package/src/planner/nodes/block.ts +0 -80
- package/src/planner/nodes/cache-node.ts +0 -103
- package/src/planner/nodes/constraint-check-node.ts +0 -138
- package/src/planner/nodes/create-assertion-node.ts +0 -51
- package/src/planner/nodes/create-index-node.ts +0 -41
- package/src/planner/nodes/create-table-node.ts +0 -35
- package/src/planner/nodes/create-view-node.ts +0 -44
- package/src/planner/nodes/cte-node.ts +0 -168
- package/src/planner/nodes/cte-reference-node.ts +0 -125
- package/src/planner/nodes/declarative-schema.ts +0 -221
- package/src/planner/nodes/delete-node.ts +0 -102
- package/src/planner/nodes/distinct-node.ts +0 -107
- package/src/planner/nodes/dml-executor-node.ts +0 -104
- package/src/planner/nodes/drop-assertion-node.ts +0 -50
- package/src/planner/nodes/drop-table-node.ts +0 -36
- package/src/planner/nodes/drop-view-node.ts +0 -37
- package/src/planner/nodes/filter.ts +0 -144
- package/src/planner/nodes/function.ts +0 -98
- package/src/planner/nodes/insert-node.ts +0 -126
- package/src/planner/nodes/internal-recursive-cte-ref-node.ts +0 -61
- package/src/planner/nodes/join-node.ts +0 -336
- package/src/planner/nodes/limit-offset.ts +0 -144
- package/src/planner/nodes/plan-node-type.ts +0 -95
- package/src/planner/nodes/plan-node.ts +0 -503
- package/src/planner/nodes/pragma.ts +0 -98
- package/src/planner/nodes/project-node.ts +0 -337
- package/src/planner/nodes/recursive-cte-node.ts +0 -158
- package/src/planner/nodes/reference.ts +0 -334
- package/src/planner/nodes/remote-query-node.ts +0 -73
- package/src/planner/nodes/retrieve-node.ts +0 -86
- package/src/planner/nodes/returning-node.ts +0 -269
- package/src/planner/nodes/scalar.ts +0 -772
- package/src/planner/nodes/sequencing-node.ts +0 -113
- package/src/planner/nodes/set-operation-node.ts +0 -87
- package/src/planner/nodes/single-row.ts +0 -85
- package/src/planner/nodes/sink-node.ts +0 -61
- package/src/planner/nodes/sort.ts +0 -166
- package/src/planner/nodes/stream-aggregate.ts +0 -293
- package/src/planner/nodes/subquery.ts +0 -268
- package/src/planner/nodes/table-access-nodes.ts +0 -323
- package/src/planner/nodes/table-function-call.ts +0 -134
- package/src/planner/nodes/transaction-node.ts +0 -55
- package/src/planner/nodes/update-node.ts +0 -138
- package/src/planner/nodes/values-node.ts +0 -244
- package/src/planner/nodes/view-reference-node.ts +0 -97
- package/src/planner/nodes/window-function.ts +0 -73
- package/src/planner/nodes/window-node.ts +0 -199
- package/src/planner/optimizer-tuning.ts +0 -105
- package/src/planner/optimizer.ts +0 -332
- package/src/planner/planning-context.ts +0 -190
- package/src/planner/resolve.ts +0 -101
- package/src/planner/rules/README.md +0 -96
- package/src/planner/rules/access/rule-select-access-path.ts +0 -399
- package/src/planner/rules/aggregate/rule-aggregate-streaming.ts +0 -162
- package/src/planner/rules/cache/rule-cte-optimization.ts +0 -79
- package/src/planner/rules/cache/rule-materialization-advisory.ts +0 -77
- package/src/planner/rules/cache/rule-mutating-subquery-cache.ts +0 -104
- package/src/planner/rules/join/rule-join-greedy-commute.ts +0 -48
- package/src/planner/rules/join/rule-join-key-inference.ts +0 -35
- package/src/planner/rules/join/rule-quickpick-enumeration.ts +0 -267
- package/src/planner/rules/predicate/rule-predicate-pushdown.ts +0 -144
- package/src/planner/rules/retrieve/rule-grow-retrieve.ts +0 -337
- package/src/planner/scopes/aliased.ts +0 -50
- package/src/planner/scopes/base.ts +0 -10
- package/src/planner/scopes/empty.ts +0 -12
- package/src/planner/scopes/global.ts +0 -73
- package/src/planner/scopes/multi.ts +0 -40
- package/src/planner/scopes/param.ts +0 -95
- package/src/planner/scopes/registered.ts +0 -67
- package/src/planner/scopes/scope.ts +0 -16
- package/src/planner/stats/basic-estimates.ts +0 -107
- package/src/planner/stats/index.ts +0 -158
- package/src/planner/type-utils.ts +0 -87
- package/src/planner/util/key-utils.ts +0 -46
- package/src/planner/validation/determinism-validator.ts +0 -104
- package/src/planner/validation/plan-validator.ts +0 -335
- package/src/runtime/async-util.ts +0 -283
- package/src/runtime/cache/shared-cache.ts +0 -169
- package/src/runtime/context-helpers.ts +0 -191
- package/src/runtime/deferred-constraint-queue.ts +0 -196
- package/src/runtime/emission-context.ts +0 -319
- package/src/runtime/emit/add-constraint.ts +0 -78
- package/src/runtime/emit/aggregate.ts +0 -581
- package/src/runtime/emit/array-index.ts +0 -25
- package/src/runtime/emit/between.ts +0 -51
- package/src/runtime/emit/binary.ts +0 -357
- package/src/runtime/emit/block.ts +0 -23
- package/src/runtime/emit/cache.ts +0 -64
- package/src/runtime/emit/case.ts +0 -87
- package/src/runtime/emit/cast.ts +0 -151
- package/src/runtime/emit/collate.ts +0 -9
- package/src/runtime/emit/column-reference.ts +0 -17
- package/src/runtime/emit/constraint-check.ts +0 -290
- package/src/runtime/emit/create-assertion.ts +0 -82
- package/src/runtime/emit/create-index.ts +0 -15
- package/src/runtime/emit/create-table.ts +0 -15
- package/src/runtime/emit/create-view.ts +0 -52
- package/src/runtime/emit/cte-reference.ts +0 -38
- package/src/runtime/emit/cte.ts +0 -39
- package/src/runtime/emit/delete.ts +0 -24
- package/src/runtime/emit/distinct.ts +0 -40
- package/src/runtime/emit/dml-executor.ts +0 -198
- package/src/runtime/emit/drop-assertion.ts +0 -45
- package/src/runtime/emit/drop-table.ts +0 -27
- package/src/runtime/emit/drop-view.ts +0 -49
- package/src/runtime/emit/filter.ts +0 -30
- package/src/runtime/emit/insert.ts +0 -42
- package/src/runtime/emit/internal-recursive-cte-ref.ts +0 -37
- package/src/runtime/emit/join.ts +0 -148
- package/src/runtime/emit/limit-offset.ts +0 -73
- package/src/runtime/emit/literal.ts +0 -17
- package/src/runtime/emit/parameter.ts +0 -59
- package/src/runtime/emit/pragma.ts +0 -56
- package/src/runtime/emit/project.ts +0 -46
- package/src/runtime/emit/recursive-cte.ts +0 -111
- package/src/runtime/emit/remote-query.ts +0 -47
- package/src/runtime/emit/retrieve.ts +0 -15
- package/src/runtime/emit/returning.ts +0 -41
- package/src/runtime/emit/scalar-function.ts +0 -69
- package/src/runtime/emit/scan.ts +0 -106
- package/src/runtime/emit/schema-declarative.ts +0 -215
- package/src/runtime/emit/sequencing.ts +0 -24
- package/src/runtime/emit/set-operation.ts +0 -141
- package/src/runtime/emit/sink.ts +0 -27
- package/src/runtime/emit/sort.ts +0 -75
- package/src/runtime/emit/subquery.ts +0 -203
- package/src/runtime/emit/table-valued-function.ts +0 -106
- package/src/runtime/emit/temporal-arithmetic.ts +0 -302
- package/src/runtime/emit/transaction.ts +0 -205
- package/src/runtime/emit/unary.ts +0 -101
- package/src/runtime/emit/update.ts +0 -66
- package/src/runtime/emit/values.ts +0 -66
- package/src/runtime/emit/window-function.ts +0 -42
- package/src/runtime/emit/window.ts +0 -458
- package/src/runtime/emitters.ts +0 -183
- package/src/runtime/register.ts +0 -150
- package/src/runtime/scheduler.ts +0 -488
- package/src/runtime/types.ts +0 -242
- package/src/runtime/utils.ts +0 -177
- package/src/schema/assertion.ts +0 -21
- package/src/schema/catalog.ts +0 -269
- package/src/schema/change-events.ts +0 -80
- package/src/schema/column.ts +0 -51
- package/src/schema/declared-schema-manager.ts +0 -82
- package/src/schema/function.ts +0 -188
- package/src/schema/manager.ts +0 -1034
- package/src/schema/schema-differ.ts +0 -214
- package/src/schema/schema-hasher.ts +0 -26
- package/src/schema/schema.ts +0 -222
- package/src/schema/table.ts +0 -409
- package/src/schema/view.ts +0 -19
- package/src/schema/window-function.ts +0 -56
- package/src/types/builtin-types.ts +0 -350
- package/src/types/index.ts +0 -17
- package/src/types/json-type.ts +0 -152
- package/src/types/logical-type.ts +0 -91
- package/src/types/plugin-interface.ts +0 -10
- package/src/types/registry.ts +0 -204
- package/src/types/temporal-types.ts +0 -290
- package/src/types/validation.ts +0 -120
- package/src/util/affinity.ts +0 -151
- package/src/util/ast-stringify.ts +0 -887
- package/src/util/cached.ts +0 -25
- package/src/util/coercion.ts +0 -113
- package/src/util/comparison.ts +0 -510
- package/src/util/environment.ts +0 -52
- package/src/util/hash.ts +0 -90
- package/src/util/latches.ts +0 -47
- package/src/util/mutation-statement.ts +0 -135
- package/src/util/patterns.ts +0 -56
- package/src/util/plan-formatter.ts +0 -48
- package/src/util/plugin-helper.ts +0 -110
- package/src/util/row-descriptor.ts +0 -105
- package/src/util/serialization.ts +0 -47
- package/src/util/sql-literal.ts +0 -22
- package/src/util/working-table-iterable.ts +0 -38
- package/src/vtab/best-access-plan.ts +0 -244
- package/src/vtab/connection.ts +0 -36
- package/src/vtab/filter-info.ts +0 -23
- package/src/vtab/index-info.ts +0 -84
- package/src/vtab/manifest.ts +0 -86
- package/src/vtab/memory/connection.ts +0 -73
- package/src/vtab/memory/index.ts +0 -191
- package/src/vtab/memory/layer/base-cursor.ts +0 -124
- package/src/vtab/memory/layer/base.ts +0 -275
- package/src/vtab/memory/layer/connection.ts +0 -203
- package/src/vtab/memory/layer/interface.ts +0 -47
- package/src/vtab/memory/layer/manager.ts +0 -909
- package/src/vtab/memory/layer/safe-iterate.ts +0 -49
- package/src/vtab/memory/layer/scan-plan.ts +0 -84
- package/src/vtab/memory/layer/transaction-cursor.ts +0 -162
- package/src/vtab/memory/layer/transaction.ts +0 -229
- package/src/vtab/memory/module.ts +0 -667
- package/src/vtab/memory/table.ts +0 -251
- package/src/vtab/memory/types.ts +0 -23
- package/src/vtab/memory/utils/logging.ts +0 -36
- package/src/vtab/memory/utils/primary-key.ts +0 -163
- package/src/vtab/module.ts +0 -162
- package/src/vtab/table.ts +0 -177
|
@@ -1,323 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Physical table access nodes for seek and range scan operations
|
|
3
|
-
* These replace logical TableReferenceNode during optimization
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { PlanNodeType } from './plan-node-type.js';
|
|
7
|
-
import { PlanNode, type UnaryRelationalNode, type PhysicalProperties, type Attribute } from './plan-node.js';
|
|
8
|
-
import { TableReferenceNode } from './reference.js';
|
|
9
|
-
import type { RelationType } from '../../common/datatype.js';
|
|
10
|
-
import type { Scope } from '../scopes/scope.js';
|
|
11
|
-
import { Cached } from '../../util/cached.js';
|
|
12
|
-
import type { FilterInfo } from '../../vtab/filter-info.js';
|
|
13
|
-
import type { ScalarPlanNode } from './plan-node.js';
|
|
14
|
-
import { TableAccessCapable } from '../framework/characteristics.js';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Base class for physical table access operations
|
|
18
|
-
* Provides common functionality for sequential scan, index scan, and index seek
|
|
19
|
-
*/
|
|
20
|
-
export abstract class TableAccessNode extends PlanNode implements UnaryRelationalNode, TableAccessCapable {
|
|
21
|
-
private attributesCache: Cached<Attribute[]>;
|
|
22
|
-
private outputType: Cached<RelationType>;
|
|
23
|
-
|
|
24
|
-
constructor(
|
|
25
|
-
scope: Scope,
|
|
26
|
-
public readonly source: TableReferenceNode,
|
|
27
|
-
public readonly filterInfo: FilterInfo,
|
|
28
|
-
estimatedCostOverride?: number
|
|
29
|
-
) {
|
|
30
|
-
super(scope, estimatedCostOverride ?? filterInfo.indexInfoOutput.estimatedCost);
|
|
31
|
-
|
|
32
|
-
this.attributesCache = new Cached(() => this.source.getAttributes());
|
|
33
|
-
this.outputType = new Cached(() => this.source.getType());
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
getAttributes(): Attribute[] {
|
|
37
|
-
return this.attributesCache.value;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
getType(): RelationType {
|
|
41
|
-
return this.outputType.value;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
getChildren(): readonly PlanNode[] {
|
|
45
|
-
return [this.source];
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
getRelations(): readonly [TableReferenceNode] {
|
|
49
|
-
return [this.source];
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// TableAccessCapable interface implementation
|
|
53
|
-
get tableSchema() {
|
|
54
|
-
return this.source.tableSchema;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
abstract getAccessMethod(): 'sequential' | 'index-scan' | 'index-seek' | 'virtual';
|
|
58
|
-
|
|
59
|
-
withChildren(newChildren: readonly PlanNode[]): PlanNode {
|
|
60
|
-
if (newChildren.length !== 1) {
|
|
61
|
-
throw new Error(`${this.nodeType} expects 1 child, got ${newChildren.length}`);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const [newSource] = newChildren;
|
|
65
|
-
|
|
66
|
-
// Type check - Physical access nodes specifically need a TableReferenceNode
|
|
67
|
-
if (!(newSource instanceof TableReferenceNode)) {
|
|
68
|
-
throw new Error(`${this.nodeType}: child must be a TableReferenceNode`);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// Return same instance if nothing changed
|
|
72
|
-
if (newSource === this.source) {
|
|
73
|
-
return this;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// Subclasses must override this with their specific constructor
|
|
77
|
-
throw new Error(`${this.nodeType} must override withChildren method`);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
override getLogicalAttributes(): Record<string, unknown> {
|
|
81
|
-
return {
|
|
82
|
-
table: this.source.tableSchema.name,
|
|
83
|
-
schema: this.source.tableSchema.schemaName,
|
|
84
|
-
accessMethod: this.getAccessMethod(),
|
|
85
|
-
filterInfo: {
|
|
86
|
-
usableIndex: this.filterInfo.indexInfoOutput.idxStr,
|
|
87
|
-
matchedClauses: this.filterInfo.indexInfoOutput.aConstraintUsage?.length || 0,
|
|
88
|
-
estimatedCost: this.filterInfo.indexInfoOutput.estimatedCost,
|
|
89
|
-
estimatedRows: this.filterInfo.indexInfoOutput.estimatedRows
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Sequential scan - reads entire table without using indexes
|
|
97
|
-
* Used when no suitable index exists or for small tables
|
|
98
|
-
*/
|
|
99
|
-
export class SeqScanNode extends TableAccessNode {
|
|
100
|
-
override readonly nodeType = PlanNodeType.SeqScan;
|
|
101
|
-
|
|
102
|
-
getAccessMethod(): 'sequential' {
|
|
103
|
-
return 'sequential';
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
computePhysical(): Partial<PhysicalProperties> {
|
|
107
|
-
return {
|
|
108
|
-
estimatedRows: this.source.estimatedRows,
|
|
109
|
-
uniqueKeys: this.source.getType().keys.map(key => key.map(colRef => colRef.index)),
|
|
110
|
-
// Sequential scans don't provide any specific ordering
|
|
111
|
-
ordering: undefined
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
override toString(): string {
|
|
116
|
-
return `SEQ SCAN ${this.source.tableSchema.name}`;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
override withChildren(newChildren: readonly PlanNode[]): PlanNode {
|
|
120
|
-
if (newChildren.length !== 1) {
|
|
121
|
-
throw new Error(`SeqScanNode expects 1 child, got ${newChildren.length}`);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
const [newSource] = newChildren;
|
|
125
|
-
|
|
126
|
-
// Type check - Physical access nodes specifically need a TableReferenceNode
|
|
127
|
-
if (!(newSource instanceof TableReferenceNode)) {
|
|
128
|
-
throw new Error('SeqScanNode: child must be a TableReferenceNode');
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// Return same instance if nothing changed
|
|
132
|
-
if (newSource === this.source) {
|
|
133
|
-
return this;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// Create new instance
|
|
137
|
-
return new SeqScanNode(
|
|
138
|
-
this.scope,
|
|
139
|
-
newSource,
|
|
140
|
-
this.filterInfo
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Index scan - uses an index to read table data in order
|
|
147
|
-
* Provides ordering and can handle range queries efficiently
|
|
148
|
-
*/
|
|
149
|
-
export class IndexScanNode extends TableAccessNode {
|
|
150
|
-
override readonly nodeType = PlanNodeType.IndexScan;
|
|
151
|
-
|
|
152
|
-
constructor(
|
|
153
|
-
scope: Scope,
|
|
154
|
-
source: TableReferenceNode,
|
|
155
|
-
filterInfo: FilterInfo,
|
|
156
|
-
public readonly indexName: string,
|
|
157
|
-
public readonly providesOrdering?: { column: number; desc: boolean }[],
|
|
158
|
-
estimatedCostOverride?: number
|
|
159
|
-
) {
|
|
160
|
-
super(scope, source, filterInfo, estimatedCostOverride);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
getAccessMethod(): 'index-scan' {
|
|
164
|
-
return 'index-scan';
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
computePhysical(): Partial<PhysicalProperties> {
|
|
168
|
-
return {
|
|
169
|
-
estimatedRows: this.source.estimatedRows,
|
|
170
|
-
uniqueKeys: this.source.getType().keys.map(key => key.map(colRef => colRef.index)),
|
|
171
|
-
// Index scans can provide ordering
|
|
172
|
-
ordering: this.providesOrdering
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
override toString(): string {
|
|
177
|
-
const orderDesc = this.providesOrdering
|
|
178
|
-
? ` ORDER BY ${this.providesOrdering.map(o => `${o.column}${o.desc ? ' DESC' : ''}`).join(', ')}`
|
|
179
|
-
: '';
|
|
180
|
-
return `INDEX SCAN ${this.source.tableSchema.name} USING ${this.indexName}${orderDesc}`;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
override getLogicalAttributes(): Record<string, unknown> {
|
|
184
|
-
return {
|
|
185
|
-
...super.getLogicalAttributes(),
|
|
186
|
-
indexName: this.indexName,
|
|
187
|
-
providesOrdering: this.providesOrdering
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
override withChildren(newChildren: readonly PlanNode[]): PlanNode {
|
|
192
|
-
if (newChildren.length !== 1) {
|
|
193
|
-
throw new Error(`IndexScanNode expects 1 child, got ${newChildren.length}`);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
const [newSource] = newChildren;
|
|
197
|
-
|
|
198
|
-
// Type check - Physical access nodes specifically need a TableReferenceNode
|
|
199
|
-
if (!(newSource instanceof TableReferenceNode)) {
|
|
200
|
-
throw new Error('IndexScanNode: child must be a TableReferenceNode');
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
// Return same instance if nothing changed
|
|
204
|
-
if (newSource === this.source) {
|
|
205
|
-
return this;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
// Create new instance
|
|
209
|
-
return new IndexScanNode(
|
|
210
|
-
this.scope,
|
|
211
|
-
newSource,
|
|
212
|
-
this.filterInfo,
|
|
213
|
-
this.indexName,
|
|
214
|
-
this.providesOrdering
|
|
215
|
-
);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* Index seek - point lookup or tight range using an index
|
|
221
|
-
* Very efficient for equality constraints and small ranges
|
|
222
|
-
*/
|
|
223
|
-
export class IndexSeekNode extends TableAccessNode {
|
|
224
|
-
override readonly nodeType = PlanNodeType.IndexSeek;
|
|
225
|
-
|
|
226
|
-
constructor(
|
|
227
|
-
scope: Scope,
|
|
228
|
-
source: TableReferenceNode,
|
|
229
|
-
filterInfo: FilterInfo,
|
|
230
|
-
public readonly indexName: string,
|
|
231
|
-
public readonly seekKeys: ScalarPlanNode[],
|
|
232
|
-
public readonly isRange: boolean = false,
|
|
233
|
-
public readonly providesOrdering?: { column: number; desc: boolean }[],
|
|
234
|
-
estimatedCostOverride?: number
|
|
235
|
-
) {
|
|
236
|
-
super(scope, source, filterInfo, estimatedCostOverride);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
getAccessMethod(): 'index-seek' {
|
|
240
|
-
return 'index-seek';
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
computePhysical(): Partial<PhysicalProperties> {
|
|
244
|
-
const base = {
|
|
245
|
-
uniqueKeys: this.source.getType().keys.map(key => key.map(colRef => colRef.index)),
|
|
246
|
-
ordering: this.providesOrdering,
|
|
247
|
-
estimatedRows: Math.min(this.source.estimatedRows || 1000, 100)
|
|
248
|
-
} as Partial<PhysicalProperties>;
|
|
249
|
-
if (!this.isRange) {
|
|
250
|
-
const pk = this.source.tableSchema.primaryKeyDefinition ?? [];
|
|
251
|
-
if (pk.length > 0 && this.seekKeys.length >= pk.length) {
|
|
252
|
-
return { ...base, estimatedRows: 1, uniqueKeys: [[]] } as Partial<PhysicalProperties>;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
return base;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
override toString(): string {
|
|
259
|
-
const seekDesc = this.isRange ? 'RANGE' : 'SEEK';
|
|
260
|
-
const orderDesc = this.providesOrdering
|
|
261
|
-
? ` ORDER BY ${this.providesOrdering.map(o => `${o.column}${o.desc ? ' DESC' : ''}`).join(', ')}`
|
|
262
|
-
: '';
|
|
263
|
-
return `INDEX ${seekDesc} ${this.source.tableSchema.name} USING ${this.indexName}${orderDesc}`;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
override getLogicalAttributes(): Record<string, unknown> {
|
|
267
|
-
return {
|
|
268
|
-
...super.getLogicalAttributes(),
|
|
269
|
-
indexName: this.indexName,
|
|
270
|
-
seekKeys: this.seekKeys.map(key => key.toString()),
|
|
271
|
-
isRange: this.isRange,
|
|
272
|
-
providesOrdering: this.providesOrdering
|
|
273
|
-
};
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
getSeekKeys(): readonly ScalarPlanNode[] {
|
|
277
|
-
return this.seekKeys;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
override getChildren(): readonly PlanNode[] {
|
|
281
|
-
return [this.source, ...this.seekKeys];
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
override withChildren(newChildren: readonly PlanNode[]): PlanNode {
|
|
285
|
-
const expectedLength = 1 + this.seekKeys.length;
|
|
286
|
-
if (newChildren.length !== expectedLength) {
|
|
287
|
-
throw new Error(`IndexSeekNode expects ${expectedLength} children, got ${newChildren.length}`);
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
const [newSource, ...newSeekKeys] = newChildren;
|
|
291
|
-
|
|
292
|
-
// Type check - Physical access nodes specifically need a TableReferenceNode
|
|
293
|
-
if (!(newSource instanceof TableReferenceNode)) {
|
|
294
|
-
throw new Error('IndexSeekNode: first child must be a TableReferenceNode');
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
// Type check seek keys
|
|
298
|
-
for (const seekKey of newSeekKeys) {
|
|
299
|
-
if (!('expression' in seekKey)) {
|
|
300
|
-
throw new Error('IndexSeekNode: seek keys must be ScalarPlanNodes');
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
// Check if anything changed
|
|
305
|
-
const sourceChanged = newSource !== this.source;
|
|
306
|
-
const seekKeysChanged = newSeekKeys.some((key, i) => key !== this.seekKeys[i]);
|
|
307
|
-
|
|
308
|
-
if (!sourceChanged && !seekKeysChanged) {
|
|
309
|
-
return this;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
// Create new instance
|
|
313
|
-
return new IndexSeekNode(
|
|
314
|
-
this.scope,
|
|
315
|
-
newSource,
|
|
316
|
-
this.filterInfo,
|
|
317
|
-
this.indexName,
|
|
318
|
-
newSeekKeys as ScalarPlanNode[],
|
|
319
|
-
this.isRange,
|
|
320
|
-
this.providesOrdering
|
|
321
|
-
);
|
|
322
|
-
}
|
|
323
|
-
}
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { PlanNodeType } from './plan-node-type.js';
|
|
2
|
-
import { PlanNode, type RelationalPlanNode, type ScalarPlanNode, type Attribute } from './plan-node.js';
|
|
3
|
-
import type { RelationType } from '../../common/datatype.js';
|
|
4
|
-
import type { Scope } from '../scopes/scope.js';
|
|
5
|
-
import type { FunctionSchema } from '../../schema/function.js';
|
|
6
|
-
import { isTableValuedFunctionSchema } from '../../schema/function.js';
|
|
7
|
-
import { Cached } from '../../util/cached.js';
|
|
8
|
-
import { formatExpressionList } from '../../util/plan-formatter.js';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Represents a table-valued function call in the FROM clause.
|
|
12
|
-
* This produces a relation from a function call like query_plan('SELECT ...').
|
|
13
|
-
*/
|
|
14
|
-
export class TableFunctionCallNode extends PlanNode implements RelationalPlanNode {
|
|
15
|
-
override readonly nodeType = PlanNodeType.TableFunctionCall;
|
|
16
|
-
|
|
17
|
-
private attributesCache: Cached<Attribute[]>;
|
|
18
|
-
|
|
19
|
-
constructor(
|
|
20
|
-
scope: Scope,
|
|
21
|
-
public readonly functionName: string,
|
|
22
|
-
public readonly functionSchema: FunctionSchema,
|
|
23
|
-
public readonly operands: readonly ScalarPlanNode[],
|
|
24
|
-
public readonly alias?: string,
|
|
25
|
-
public readonly aliasColumns?: readonly string[],
|
|
26
|
-
estimatedCostOverride?: number
|
|
27
|
-
) {
|
|
28
|
-
super(scope, estimatedCostOverride ?? 1); // Default cost for function calls
|
|
29
|
-
|
|
30
|
-
this.attributesCache = new Cached(() => {
|
|
31
|
-
// Create attributes from function schema return type
|
|
32
|
-
if (isTableValuedFunctionSchema(this.functionSchema)) {
|
|
33
|
-
const renamed = this.functionSchema.returnType.columns.map((col, i) => ({
|
|
34
|
-
id: PlanNode.nextAttrId(),
|
|
35
|
-
name: (this.aliasColumns && this.aliasColumns[i]) ? this.aliasColumns[i] : col.name,
|
|
36
|
-
type: col.type,
|
|
37
|
-
sourceRelation: `${this.functionName}()`
|
|
38
|
-
}));
|
|
39
|
-
return renamed;
|
|
40
|
-
}
|
|
41
|
-
return [];
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
getType(): RelationType {
|
|
46
|
-
// Return the function's defined return type
|
|
47
|
-
if (isTableValuedFunctionSchema(this.functionSchema)) {
|
|
48
|
-
return this.functionSchema.returnType;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Fallback for non-table-valued functions (shouldn't happen)
|
|
52
|
-
return {
|
|
53
|
-
typeClass: 'relation',
|
|
54
|
-
isReadOnly: true,
|
|
55
|
-
isSet: false, // Table functions can return duplicate rows (bags)
|
|
56
|
-
columns: [],
|
|
57
|
-
keys: [], // Functions don't typically have inherent keys
|
|
58
|
-
rowConstraints: [],
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
getAttributes(): Attribute[] {
|
|
63
|
-
return this.attributesCache.value;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
getChildren(): readonly ScalarPlanNode[] {
|
|
67
|
-
return this.operands;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
getRelations(): readonly [] {
|
|
71
|
-
return [];
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
withChildren(newChildren: readonly PlanNode[]): PlanNode {
|
|
75
|
-
if (newChildren.length !== this.operands.length) {
|
|
76
|
-
throw new Error(`TableFunctionCallNode expects ${this.operands.length} children, got ${newChildren.length}`);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// Type check
|
|
80
|
-
for (const child of newChildren) {
|
|
81
|
-
if (!('expression' in child)) {
|
|
82
|
-
throw new Error('TableFunctionCallNode: all children must be ScalarPlanNodes');
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// Check if anything changed
|
|
87
|
-
const childrenChanged = newChildren.some((child, i) => child !== this.operands[i]);
|
|
88
|
-
if (!childrenChanged) {
|
|
89
|
-
return this;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// Create new instance
|
|
93
|
-
return new TableFunctionCallNode(
|
|
94
|
-
this.scope,
|
|
95
|
-
this.functionName,
|
|
96
|
-
this.functionSchema,
|
|
97
|
-
newChildren as ScalarPlanNode[],
|
|
98
|
-
this.alias,
|
|
99
|
-
this.aliasColumns
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
get estimatedRows(): number | undefined {
|
|
104
|
-
// Functions can return variable numbers of rows, so we'll use a default estimate
|
|
105
|
-
return 10; // Conservative estimate
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
override toString(): string {
|
|
109
|
-
const argsStr = formatExpressionList(this.operands);
|
|
110
|
-
const aliasColsStr = this.aliasColumns && this.aliasColumns.length > 0 ? `(${this.aliasColumns.join(', ')})` : '';
|
|
111
|
-
const aliasStr = this.alias ? ` AS ${this.alias}${aliasColsStr}` : '';
|
|
112
|
-
return `${this.functionName}(${argsStr})${aliasStr}`;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
override getLogicalAttributes(): Record<string, unknown> {
|
|
116
|
-
const props: Record<string, unknown> = {
|
|
117
|
-
function: this.functionName,
|
|
118
|
-
arguments: this.operands.map(op => op.toString())
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
if (this.alias) {
|
|
122
|
-
props.alias = this.alias;
|
|
123
|
-
}
|
|
124
|
-
if (this.aliasColumns && this.aliasColumns.length > 0) {
|
|
125
|
-
props.aliasColumns = [...this.aliasColumns];
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
if (isTableValuedFunctionSchema(this.functionSchema)) {
|
|
129
|
-
props.columns = this.functionSchema.returnType.columns.map(col => col.name);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
return props;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { VoidNode } from './plan-node.js';
|
|
2
|
-
import { PlanNodeType } from './plan-node-type.js';
|
|
3
|
-
import type { Scope } from '../scopes/scope.js';
|
|
4
|
-
import * as AST from '../../parser/ast.js';
|
|
5
|
-
import { astToString } from '../../util/ast-stringify.js';
|
|
6
|
-
|
|
7
|
-
export interface TransactionNode extends VoidNode {
|
|
8
|
-
nodeType: PlanNodeType.Transaction;
|
|
9
|
-
operation: 'begin' | 'commit' | 'rollback' | 'savepoint' | 'release';
|
|
10
|
-
savepoint?: string; // For ROLLBACK TO, SAVEPOINT, RELEASE
|
|
11
|
-
statementAst: AST.BeginStmt | AST.CommitStmt | AST.RollbackStmt | AST.SavepointStmt | AST.ReleaseStmt;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export class TransactionPlanNode extends VoidNode implements TransactionNode {
|
|
15
|
-
override readonly nodeType = PlanNodeType.Transaction;
|
|
16
|
-
|
|
17
|
-
constructor(
|
|
18
|
-
scope: Scope,
|
|
19
|
-
public readonly operation: 'begin' | 'commit' | 'rollback' | 'savepoint' | 'release',
|
|
20
|
-
public readonly statementAst: AST.BeginStmt | AST.CommitStmt | AST.RollbackStmt | AST.SavepointStmt | AST.ReleaseStmt,
|
|
21
|
-
public readonly savepoint?: string
|
|
22
|
-
) {
|
|
23
|
-
super(scope, 1); // Transaction operations have low cost
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
override toString(): string {
|
|
27
|
-
switch (this.operation) {
|
|
28
|
-
case 'begin':
|
|
29
|
-
return 'BEGIN';
|
|
30
|
-
case 'commit':
|
|
31
|
-
return 'COMMIT';
|
|
32
|
-
case 'rollback':
|
|
33
|
-
return this.savepoint ? `ROLLBACK TO ${this.savepoint}` : 'ROLLBACK';
|
|
34
|
-
case 'savepoint':
|
|
35
|
-
return `SAVEPOINT ${this.savepoint}`;
|
|
36
|
-
case 'release':
|
|
37
|
-
return `RELEASE ${this.savepoint}`;
|
|
38
|
-
default:
|
|
39
|
-
return `TRANSACTION ${this.operation}`;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
override getLogicalAttributes(): Record<string, unknown> {
|
|
44
|
-
const props: Record<string, unknown> = {
|
|
45
|
-
operation: this.operation,
|
|
46
|
-
statement: astToString(this.statementAst)
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
if (this.savepoint) {
|
|
50
|
-
props.savepoint = this.savepoint;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return props;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import type * as AST from '../../parser/ast.js';
|
|
2
|
-
import type { Scope } from '../scopes/scope.js';
|
|
3
|
-
import { PlanNode, type RelationalPlanNode, type Attribute, type RowDescriptor, isRelationalNode } from './plan-node.js';
|
|
4
|
-
import { PlanNodeType } from './plan-node-type.js';
|
|
5
|
-
import type { TableReferenceNode } from './reference.js';
|
|
6
|
-
import type { ScalarPlanNode } from './plan-node.js';
|
|
7
|
-
import type { ConflictResolution } from '../../common/constants.js';
|
|
8
|
-
import type { RelationType } from '../../common/datatype.js';
|
|
9
|
-
import { formatExpression } from '../../util/plan-formatter.js';
|
|
10
|
-
import { buildAttributesFromFlatDescriptor } from '../../util/row-descriptor.js';
|
|
11
|
-
import type { PhysicalProperties } from './plan-node.js';
|
|
12
|
-
|
|
13
|
-
export interface UpdateAssignment {
|
|
14
|
-
targetColumn: AST.ColumnExpr; // Could be resolved ColumnReferenceNode or just index
|
|
15
|
-
value: ScalarPlanNode;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Represents an UPDATE statement in the logical query plan.
|
|
20
|
-
*/
|
|
21
|
-
export class UpdateNode extends PlanNode implements RelationalPlanNode {
|
|
22
|
-
override readonly nodeType = PlanNodeType.Update;
|
|
23
|
-
|
|
24
|
-
constructor(
|
|
25
|
-
scope: Scope,
|
|
26
|
-
public readonly table: TableReferenceNode,
|
|
27
|
-
public readonly assignments: ReadonlyArray<UpdateAssignment>,
|
|
28
|
-
public readonly source: RelationalPlanNode, // Typically a FilterNode wrapping a TableReferenceNode
|
|
29
|
-
public readonly onConflict: ConflictResolution | undefined,
|
|
30
|
-
public readonly oldRowDescriptor: RowDescriptor, // For constraint checking
|
|
31
|
-
public readonly newRowDescriptor: RowDescriptor, // For constraint checking
|
|
32
|
-
public readonly flatRowDescriptor: RowDescriptor, // For flat OLD/NEW row attributes
|
|
33
|
-
public readonly mutationContextValues?: Map<string, ScalarPlanNode>, // Mutation context value expressions
|
|
34
|
-
public readonly contextAttributes?: Attribute[], // Mutation context attributes
|
|
35
|
-
public readonly contextDescriptor?: RowDescriptor, // Mutation context row descriptor
|
|
36
|
-
) {
|
|
37
|
-
super(scope);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
getType(): RelationType {
|
|
41
|
-
return this.source.getType();
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
getAttributes(): Attribute[] {
|
|
45
|
-
return buildAttributesFromFlatDescriptor(this.flatRowDescriptor);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
getRelations(): readonly [RelationalPlanNode, TableReferenceNode] {
|
|
49
|
-
// The source provides rows to be updated, table is the target of updates.
|
|
50
|
-
return [this.source, this.table];
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
getChildren(): readonly PlanNode[] {
|
|
54
|
-
// Return ALL child nodes: the source relation and the scalar assignment values
|
|
55
|
-
return [this.source, ...this.assignments.map(a => a.value)];
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
withChildren(newChildren: readonly PlanNode[]): PlanNode {
|
|
59
|
-
const expectedChildCount = 1 + this.assignments.length; // source + assignment values
|
|
60
|
-
if (newChildren.length !== expectedChildCount) {
|
|
61
|
-
throw new Error(`UpdateNode expects ${expectedChildCount} children (1 source + ${this.assignments.length} assignments), got ${newChildren.length}`);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// First child is the source
|
|
65
|
-
const newSource = newChildren[0] as RelationalPlanNode;
|
|
66
|
-
if (!isRelationalNode(newSource)) {
|
|
67
|
-
throw new Error('UpdateNode: first child must be a RelationalPlanNode (source)');
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Remaining children are assignment values
|
|
71
|
-
const newAssignmentValues = newChildren.slice(1);
|
|
72
|
-
for (const child of newAssignmentValues) {
|
|
73
|
-
if (!('expression' in child)) {
|
|
74
|
-
throw new Error('UpdateNode: assignment children must be ScalarPlanNodes');
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// Check if anything changed
|
|
79
|
-
const sourceChanged = newSource !== this.source;
|
|
80
|
-
const assignmentsChanged = newAssignmentValues.some((child, i) => child !== this.assignments[i].value);
|
|
81
|
-
|
|
82
|
-
if (!sourceChanged && !assignmentsChanged) {
|
|
83
|
-
return this;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// Create new assignments with updated values
|
|
87
|
-
const newAssignments = this.assignments.map((assignment, i) => ({
|
|
88
|
-
targetColumn: assignment.targetColumn,
|
|
89
|
-
value: newAssignmentValues[i] as ScalarPlanNode
|
|
90
|
-
}));
|
|
91
|
-
|
|
92
|
-
// Create new instance
|
|
93
|
-
return new UpdateNode(
|
|
94
|
-
this.scope,
|
|
95
|
-
this.table,
|
|
96
|
-
newAssignments,
|
|
97
|
-
newSource,
|
|
98
|
-
this.onConflict,
|
|
99
|
-
this.oldRowDescriptor,
|
|
100
|
-
this.newRowDescriptor,
|
|
101
|
-
this.flatRowDescriptor,
|
|
102
|
-
this.mutationContextValues,
|
|
103
|
-
this.contextAttributes,
|
|
104
|
-
this.contextDescriptor
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
computePhysical(): Partial<PhysicalProperties> {
|
|
109
|
-
return {
|
|
110
|
-
readonly: false, // UPDATE has side effects
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
get estimatedRows(): number | undefined {
|
|
115
|
-
return this.source.estimatedRows;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
override toString(): string {
|
|
119
|
-
return `UPDATE ${this.table.tableSchema.name}`;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
override getLogicalAttributes(): Record<string, unknown> {
|
|
123
|
-
const props: Record<string, unknown> = {
|
|
124
|
-
table: this.table.tableSchema.name,
|
|
125
|
-
schema: this.table.tableSchema.schemaName,
|
|
126
|
-
assignments: this.assignments.map(assign => ({
|
|
127
|
-
column: assign.targetColumn.name,
|
|
128
|
-
value: formatExpression(assign.value)
|
|
129
|
-
}))
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
if (this.onConflict) {
|
|
133
|
-
props.onConflict = this.onConflict;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
return props;
|
|
137
|
-
}
|
|
138
|
-
}
|