@quereus/quereus 0.7.3 → 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
package/src/vtab/memory/table.ts
DELETED
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
import { VirtualTable } from '../table.js';
|
|
2
|
-
import type { AnyVirtualTableModule, SchemaChangeInfo } from '../module.js';
|
|
3
|
-
import type { Database } from '../../core/database.js';
|
|
4
|
-
import type { Row } from '../../common/types.js';
|
|
5
|
-
import { type IndexSchema, type TableSchema } from '../../schema/table.js';
|
|
6
|
-
import { MemoryTableManager } from './layer/manager.js';
|
|
7
|
-
import type { MemoryTableConnection } from './layer/connection.js';
|
|
8
|
-
import { QuereusError } from '../../common/errors.js';
|
|
9
|
-
import { StatusCode } from '../../common/types.js';
|
|
10
|
-
import type { FilterInfo } from '../filter-info.js';
|
|
11
|
-
import { buildScanPlanFromFilterInfo } from './layer/scan-plan.js';
|
|
12
|
-
import type { ColumnDef as ASTColumnDef } from '../../parser/ast.js'; // Assuming this will be updated for renameColumn
|
|
13
|
-
import { createMemoryTableLoggers } from './utils/logging.js';
|
|
14
|
-
import { safeJsonStringify } from '../../util/serialization.js';
|
|
15
|
-
import type { VirtualTableConnection } from '../connection.js';
|
|
16
|
-
import { MemoryVirtualTableConnection } from './connection.js';
|
|
17
|
-
import type { ConflictResolution } from '../../common/constants.js';
|
|
18
|
-
|
|
19
|
-
const logger = createMemoryTableLoggers('table');
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Represents a connection-specific instance of an in-memory table using the layer-based MVCC model.
|
|
23
|
-
* This class acts as a thin wrapper around the shared MemoryTableManager,
|
|
24
|
-
* holding the connection state.
|
|
25
|
-
*/
|
|
26
|
-
export class MemoryTable extends VirtualTable {
|
|
27
|
-
/** @internal The shared manager handling layers, schema, and global state */
|
|
28
|
-
public readonly manager: MemoryTableManager;
|
|
29
|
-
/** @internal Connection state specific to this table instance (lazily initialized) */
|
|
30
|
-
private connection: MemoryTableConnection | null = null;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* @internal - Use MemoryTableModule.connect or create
|
|
34
|
-
* Creates a connection-specific instance linked to a manager.
|
|
35
|
-
*/
|
|
36
|
-
constructor(
|
|
37
|
-
db: Database,
|
|
38
|
-
module: AnyVirtualTableModule,
|
|
39
|
-
manager: MemoryTableManager // Pass the shared manager instance
|
|
40
|
-
) {
|
|
41
|
-
// Use manager's schema and name for the base class constructor
|
|
42
|
-
super(db, module, manager.schemaName, manager.tableName);
|
|
43
|
-
this.manager = manager;
|
|
44
|
-
// Set the tableSchema directly from the manager's current canonical schema
|
|
45
|
-
// This ensures the VirtualTable base class has the correct schema reference.
|
|
46
|
-
this.tableSchema = manager.tableSchema;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/** Returns the canonical schema from the manager */
|
|
50
|
-
getSchema(): TableSchema | undefined {
|
|
51
|
-
// Always return the potentially updated schema from the manager
|
|
52
|
-
return this.manager.tableSchema;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/** Checks read-only status via the manager */
|
|
56
|
-
isReadOnly(): boolean {
|
|
57
|
-
// Access readOnly via a public method on the manager
|
|
58
|
-
return this.manager.isReadOnly;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/** Ensures the connection to the manager is established */
|
|
62
|
-
private async ensureConnection(): Promise<MemoryTableConnection> {
|
|
63
|
-
if (!this.connection) {
|
|
64
|
-
// Check if there's already an active connection for this table in the database
|
|
65
|
-
const existingConnections = this.db.getConnectionsForTable(this.tableName);
|
|
66
|
-
if (existingConnections.length > 0 && existingConnections[0] instanceof MemoryVirtualTableConnection) {
|
|
67
|
-
const memoryVirtualConnection = existingConnections[0] as MemoryVirtualTableConnection;
|
|
68
|
-
this.connection = memoryVirtualConnection.getMemoryConnection();
|
|
69
|
-
logger.debugLog(`ensureConnection: Reused existing connection ${this.connection.connectionId} for table ${this.tableName}`);
|
|
70
|
-
} else {
|
|
71
|
-
// Establish connection state with the manager upon first use
|
|
72
|
-
this.connection = this.manager.connect();
|
|
73
|
-
|
|
74
|
-
// Create a VirtualTableConnection wrapper and register it with the database
|
|
75
|
-
const vtabConnection = new MemoryVirtualTableConnection(this.tableName, this.connection);
|
|
76
|
-
await this.db.registerConnection(vtabConnection);
|
|
77
|
-
|
|
78
|
-
logger.debugLog(`ensureConnection: Created and registered new connection ${this.connection.connectionId} for table ${this.tableName}`);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return this.connection;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/** Sets an existing connection for this table instance (for transaction reuse) */
|
|
85
|
-
setConnection(memoryConnection: MemoryTableConnection): void {
|
|
86
|
-
logger.debugLog(`Setting connection ${memoryConnection.connectionId} for table ${this.tableName}`);
|
|
87
|
-
this.connection = memoryConnection;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/** Creates a new VirtualTableConnection for transaction support */
|
|
91
|
-
createConnection(): VirtualTableConnection {
|
|
92
|
-
const memoryConnection = this.manager.connect();
|
|
93
|
-
return new MemoryVirtualTableConnection(this.tableName, memoryConnection);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/** Gets the current connection if this table maintains one internally */
|
|
97
|
-
getConnection(): VirtualTableConnection | undefined {
|
|
98
|
-
if (!this.connection) {
|
|
99
|
-
return undefined;
|
|
100
|
-
}
|
|
101
|
-
return new MemoryVirtualTableConnection(this.tableName, this.connection);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// Direct async iteration for query execution
|
|
105
|
-
async* query(filterInfo: FilterInfo): AsyncIterable<Row> {
|
|
106
|
-
const conn = await this.ensureConnection();
|
|
107
|
-
logger.debugLog(`query using connection ${conn.connectionId} (pending: ${conn.pendingTransactionLayer?.getLayerId()}, read: ${conn.readLayer.getLayerId()})`);
|
|
108
|
-
const currentSchema = this.manager.tableSchema;
|
|
109
|
-
if (!currentSchema) {
|
|
110
|
-
logger.error('query', this.tableName, 'Table schema is undefined');
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
const plan = buildScanPlanFromFilterInfo(filterInfo, currentSchema);
|
|
114
|
-
logger.debugLog(`query invoked for ${this.tableName} with plan: ${safeJsonStringify(plan)}`);
|
|
115
|
-
|
|
116
|
-
const startLayer = conn.pendingTransactionLayer ?? conn.readLayer;
|
|
117
|
-
logger.debugLog(`query reading from layer ${startLayer.getLayerId()}`);
|
|
118
|
-
|
|
119
|
-
// Delegate scanning to the manager, which handles layer recursion
|
|
120
|
-
yield* this.manager.scanLayer(startLayer, plan);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// Note: getBestAccessPlan is handled by the MemoryTableModule, not the table instance.
|
|
124
|
-
|
|
125
|
-
/** Performs mutation through the connection's transaction layer */
|
|
126
|
-
async update(args: import('../table.js').UpdateArgs): Promise<Row | undefined> {
|
|
127
|
-
const conn = await this.ensureConnection();
|
|
128
|
-
// Delegate mutation to the manager.
|
|
129
|
-
// Note: mutationStatement is ignored by memory table (could be logged if needed)
|
|
130
|
-
return this.manager.performMutation(conn, args.operation, args.values, args.oldKeyValues, args.onConflict);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/** Begins a transaction for this connection */
|
|
134
|
-
async begin(): Promise<void> {
|
|
135
|
-
(await this.ensureConnection()).begin();
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/** Commits this connection's transaction */
|
|
139
|
-
async commit(): Promise<void> {
|
|
140
|
-
// Only commit if a connection has actually been established
|
|
141
|
-
if (this.connection) {
|
|
142
|
-
await this.connection.commit();
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/** Rolls back this connection's transaction */
|
|
147
|
-
async rollback(): Promise<void> {
|
|
148
|
-
// Only rollback if a connection has actually been established
|
|
149
|
-
if (this.connection) {
|
|
150
|
-
this.connection.rollback();
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/** Sync operation (currently no-op for memory table layers) */
|
|
155
|
-
async sync(): Promise<void> {
|
|
156
|
-
// This might trigger background collapse in the manager in the future
|
|
157
|
-
// await this.manager.tryCollapseLayers(); // Optional: trigger collapse on sync?
|
|
158
|
-
return Promise.resolve();
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/** Renames the underlying table via the manager */
|
|
162
|
-
async rename(newName: string): Promise<void> {
|
|
163
|
-
logger.operation('Rename', this.tableName, { newName });
|
|
164
|
-
await this.manager.renameTable(newName);
|
|
165
|
-
// Update this instance's schema reference after rename
|
|
166
|
-
this.tableSchema = this.manager.tableSchema;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
// --- Savepoint operations ---
|
|
170
|
-
async savepoint(savepointIndex: number): Promise<void> {
|
|
171
|
-
const conn = await this.ensureConnection();
|
|
172
|
-
conn.createSavepoint(savepointIndex);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
async release(savepointIndex: number): Promise<void> {
|
|
176
|
-
if (!this.connection) return; // No connection, no savepoints to release
|
|
177
|
-
this.connection.releaseSavepoint(savepointIndex);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
async rollbackTo(savepointIndex: number): Promise<void> {
|
|
181
|
-
if (!this.connection) return; // No connection, no savepoints to rollback to
|
|
182
|
-
this.connection.rollbackToSavepoint(savepointIndex);
|
|
183
|
-
}
|
|
184
|
-
// --- End Savepoint operations ---
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
/** Handles schema changes via the manager */
|
|
188
|
-
async alterSchema(changeInfo: SchemaChangeInfo): Promise<void> {
|
|
189
|
-
const originalManagerSchema = this.manager.tableSchema; // For potential error recovery
|
|
190
|
-
try {
|
|
191
|
-
switch (changeInfo.type) {
|
|
192
|
-
case 'addColumn':
|
|
193
|
-
await this.manager.addColumn(changeInfo.columnDef);
|
|
194
|
-
break;
|
|
195
|
-
case 'dropColumn':
|
|
196
|
-
await this.manager.dropColumn(changeInfo.columnName);
|
|
197
|
-
break;
|
|
198
|
-
case 'renameColumn':
|
|
199
|
-
if (!('newColumnDefAst' in changeInfo)) {
|
|
200
|
-
throw new QuereusError('SchemaChangeInfo for renameColumn missing newColumnDefAst', StatusCode.INTERNAL);
|
|
201
|
-
}
|
|
202
|
-
await this.manager.renameColumn(changeInfo.oldName, changeInfo.newColumnDefAst as ASTColumnDef);
|
|
203
|
-
break;
|
|
204
|
-
default: {
|
|
205
|
-
const exhaustiveCheck: never = changeInfo;
|
|
206
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
207
|
-
throw new QuereusError(`Unhandled schema change: ${(exhaustiveCheck as any)?.type}`, StatusCode.INTERNAL);
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
this.tableSchema = this.manager.tableSchema; // Refresh local schema ref
|
|
211
|
-
} catch (e) {
|
|
212
|
-
logger.error('Schema Change', this.tableName, e);
|
|
213
|
-
// Manager DDL methods should handle reverting their own BaseLayer schema updates on error.
|
|
214
|
-
// Refresh local schema ref to ensure it's consistent with manager after potential error/revert.
|
|
215
|
-
this.tableSchema = originalManagerSchema;
|
|
216
|
-
// It might be safer for manager DDL to not alter its own this.tableSchema until baseLayer op succeeds.
|
|
217
|
-
// And if baseLayer op fails, manager DDL reverts baseLayer.tableSchema.
|
|
218
|
-
// Then here, we always sync from manager: this.tableSchema = this.manager.tableSchema;
|
|
219
|
-
throw e;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
/** Disconnects this connection instance from the manager */
|
|
224
|
-
async disconnect(): Promise<void> {
|
|
225
|
-
if (this.connection) {
|
|
226
|
-
// Manager handles cleanup and potential layer collapse trigger
|
|
227
|
-
await this.manager.disconnect(this.connection.connectionId);
|
|
228
|
-
this.connection = null; // Clear connection reference on this instance
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
// --- Index DDL methods delegate to the manager ---
|
|
233
|
-
async createIndex(indexSchema: IndexSchema): Promise<void> {
|
|
234
|
-
logger.operation('Create Index', this.tableName, { indexName: indexSchema.name });
|
|
235
|
-
await this.manager.createIndex(indexSchema);
|
|
236
|
-
this.tableSchema = this.manager.tableSchema; // Refresh local schema ref
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
async dropIndex(indexName: string): Promise<void> {
|
|
240
|
-
logger.operation('Drop Index', this.tableName, { indexName });
|
|
241
|
-
await this.manager.dropIndex(indexName);
|
|
242
|
-
// Update schema reference
|
|
243
|
-
this.tableSchema = this.manager.tableSchema;
|
|
244
|
-
}
|
|
245
|
-
// --- End Index DDL methods ---
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
// Helper function (moved from MemoryTableCursor and adapted)
|
|
249
|
-
// function buildScanPlanInternal(filterInfo: FilterInfo, tableSchema: TableSchema): ScanPlan { ... MOVED ... }
|
|
250
|
-
|
|
251
|
-
|
package/src/vtab/memory/types.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { SqlValue } from '../../common/types.js';
|
|
2
|
-
|
|
3
|
-
/** Key type used in B-Trees (primary key or index key part) */
|
|
4
|
-
export type BTreeKey = BTreeKeyForPrimary | BTreeKeyForIndex;
|
|
5
|
-
|
|
6
|
-
/** Alias for BTreeKey when explicitly referring to a primary key. */
|
|
7
|
-
export type BTreeKeyForPrimary = SqlValue | SqlValue[];
|
|
8
|
-
|
|
9
|
-
/** Alias for BTreeKey when explicitly referring to a key of a secondary index. */
|
|
10
|
-
export type BTreeKeyForIndex = SqlValue | SqlValue[];
|
|
11
|
-
|
|
12
|
-
/** Represents an entry in a MemoryIndex BTree, mapping an IndexKey to an array of PrimaryKeys */
|
|
13
|
-
export interface MemoryIndexEntry {
|
|
14
|
-
indexKey: BTreeKeyForIndex;
|
|
15
|
-
primaryKeys: Set<BTreeKeyForPrimary>;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Configuration options for MemoryTable creation
|
|
20
|
-
*/
|
|
21
|
-
export interface MemoryTableConfig {
|
|
22
|
-
readOnly?: boolean;
|
|
23
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { createLogger } from '../../../common/logger.js';
|
|
2
|
-
import { safeJsonStringify } from '../../../util/serialization.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Factory for creating standardized memory table loggers with consistent namespacing
|
|
6
|
-
*/
|
|
7
|
-
export function createMemoryTableLoggers(subModule: string) {
|
|
8
|
-
const log = createLogger(`vtab:memory:${subModule}`);
|
|
9
|
-
|
|
10
|
-
const warnLog = log.extend('warn');
|
|
11
|
-
const errorLog = log.extend('error');
|
|
12
|
-
const debugLog = log.extend('debug');
|
|
13
|
-
|
|
14
|
-
return {
|
|
15
|
-
info: log,
|
|
16
|
-
warnLog,
|
|
17
|
-
errorLog,
|
|
18
|
-
debugLog,
|
|
19
|
-
|
|
20
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
|
-
operation: (operation: string, tableName: string, details?: any) => {
|
|
22
|
-
log(`[${tableName}] ${operation}${details ? `: ${safeJsonStringify(details)}` : ''}`);
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
|
-
warn: (operation: string, tableName: string, message: string, details?: any) => {
|
|
27
|
-
warnLog(`[${tableName}] ${operation}: ${message}${details ? ` - ${safeJsonStringify(details)}` : ''}`);
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
31
|
-
error: (operation: string, tableName: string, innerError: unknown, details?: any) => {
|
|
32
|
-
const errorMessage = innerError instanceof Error ? innerError.message : innerError;
|
|
33
|
-
errorLog(`[${tableName}] ${operation} failed: ${errorMessage}${details ? ` - ${safeJsonStringify(details)}` : ''}`);
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
}
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import type { TableSchema, PrimaryKeyColumnDefinition } from '../../../schema/table.js';
|
|
2
|
-
import type { Row, SqlValue } from '../../../common/types.js';
|
|
3
|
-
import type { BTreeKeyForPrimary } from '../types.js';
|
|
4
|
-
import { compareSqlValuesFast, resolveCollation, type CollationFunction, createTypedComparator } from '../../../util/comparison.js';
|
|
5
|
-
import { QuereusError } from '../../../common/errors.js';
|
|
6
|
-
import { StatusCode } from '../../../common/types.js';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Result of creating primary key functions for a given schema
|
|
10
|
-
*/
|
|
11
|
-
export interface PrimaryKeyFunctions {
|
|
12
|
-
extractFromRow: (row: Row) => BTreeKeyForPrimary;
|
|
13
|
-
compare: (a: BTreeKeyForPrimary, b: BTreeKeyForPrimary) => number;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Creates optimized primary key extraction and comparison functions for a given table schema.
|
|
18
|
-
* This centralizes the logic that was previously duplicated across BaseLayer and TransactionLayer.
|
|
19
|
-
*/
|
|
20
|
-
export function createPrimaryKeyFunctions(schema: TableSchema): PrimaryKeyFunctions {
|
|
21
|
-
const pkDefinition = schema.primaryKeyDefinition
|
|
22
|
-
// Use all columns if no primary key is defined (that's different from an empty primary key)
|
|
23
|
-
// This is an important design change and documented deviation from SQLite behavior, and not something we want to change
|
|
24
|
-
?? schema.columns.map((col, index) => ({ index, collation: col.collation || 'BINARY' }));
|
|
25
|
-
|
|
26
|
-
if (pkDefinition.length === 0) {
|
|
27
|
-
return createSingletonPrimaryKeyFunctions();
|
|
28
|
-
} else if (pkDefinition.length === 1) {
|
|
29
|
-
return createSingleColumnPrimaryKeyFunctions(pkDefinition[0], schema);
|
|
30
|
-
} else {
|
|
31
|
-
return createCompositeColumnPrimaryKeyFunctions(pkDefinition, schema);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Creates functions for tables with empty primary keys (zero or one rows possible)
|
|
37
|
-
*/
|
|
38
|
-
function createSingletonPrimaryKeyFunctions(): PrimaryKeyFunctions {
|
|
39
|
-
return {
|
|
40
|
-
extractFromRow: (): BTreeKeyForPrimary => {
|
|
41
|
-
return [];
|
|
42
|
-
},
|
|
43
|
-
compare: (): number => {
|
|
44
|
-
return 0; // Always equal
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Creates functions for single-column primary keys (optimized path)
|
|
51
|
-
*/
|
|
52
|
-
function createSingleColumnPrimaryKeyFunctions(
|
|
53
|
-
columnDef: PrimaryKeyColumnDefinition,
|
|
54
|
-
schema: TableSchema
|
|
55
|
-
): PrimaryKeyFunctions {
|
|
56
|
-
const pkColIndex = columnDef.index;
|
|
57
|
-
const descMultiplier = columnDef.desc ? -1 : 1;
|
|
58
|
-
|
|
59
|
-
// Get the column's logical type and create type-aware comparator
|
|
60
|
-
const columnSchema = schema.columns[pkColIndex];
|
|
61
|
-
const collationFunc = columnDef.collation ? resolveCollation(columnDef.collation) : undefined;
|
|
62
|
-
const typedComparator = createTypedComparator(columnSchema.logicalType, collationFunc);
|
|
63
|
-
|
|
64
|
-
const extractFromRow = (row: Row): BTreeKeyForPrimary => {
|
|
65
|
-
if (!row || !Array.isArray(row)) {
|
|
66
|
-
throw new QuereusError(
|
|
67
|
-
`Primary key extraction requires a valid row array, got: ${typeof row}`,
|
|
68
|
-
StatusCode.INTERNAL
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
if (pkColIndex < 0 || pkColIndex >= row.length) {
|
|
72
|
-
throw new QuereusError(
|
|
73
|
-
`PK index ${pkColIndex} is out of bounds for row length ${row.length}`,
|
|
74
|
-
StatusCode.INTERNAL
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
return row[pkColIndex];
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
const compare = (a: BTreeKeyForPrimary, b: BTreeKeyForPrimary): number => {
|
|
81
|
-
return typedComparator(a as SqlValue, b as SqlValue) * descMultiplier;
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
return { extractFromRow, compare };
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Creates functions for composite (multi-column) primary keys
|
|
89
|
-
*/
|
|
90
|
-
function createCompositeColumnPrimaryKeyFunctions(
|
|
91
|
-
pkDefinition: ReadonlyArray<PrimaryKeyColumnDefinition>,
|
|
92
|
-
schema: TableSchema
|
|
93
|
-
): PrimaryKeyFunctions {
|
|
94
|
-
// Pre-create type-aware comparators for each primary key column
|
|
95
|
-
const comparators = pkDefinition.map(def => {
|
|
96
|
-
const columnSchema = schema.columns[def.index];
|
|
97
|
-
const collationFunc = def.collation ? resolveCollation(def.collation) : undefined;
|
|
98
|
-
return createTypedComparator(columnSchema.logicalType, collationFunc);
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
const extractFromRow = (row: Row): BTreeKeyForPrimary => {
|
|
102
|
-
if (!row || !Array.isArray(row)) {
|
|
103
|
-
throw new QuereusError(
|
|
104
|
-
`Primary key extraction requires a valid row array, got: ${typeof row}`,
|
|
105
|
-
StatusCode.INTERNAL
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
return pkDefinition.map(def => {
|
|
109
|
-
if (def.index < 0 || def.index >= row.length) {
|
|
110
|
-
throw new QuereusError(
|
|
111
|
-
`PK index ${def.index} is out of bounds for row length ${row.length}`,
|
|
112
|
-
StatusCode.INTERNAL
|
|
113
|
-
);
|
|
114
|
-
}
|
|
115
|
-
return row[def.index];
|
|
116
|
-
});
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
const compare = (a: BTreeKeyForPrimary, b: BTreeKeyForPrimary): number => {
|
|
120
|
-
const arrA = a as SqlValue[];
|
|
121
|
-
const arrB = b as SqlValue[];
|
|
122
|
-
|
|
123
|
-
for (let i = 0; i < pkDefinition.length; i++) {
|
|
124
|
-
if (i >= arrA.length || i >= arrB.length) {
|
|
125
|
-
return arrA.length - arrB.length;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
const def = pkDefinition[i];
|
|
129
|
-
const comparison = comparators[i](arrA[i], arrB[i]);
|
|
130
|
-
|
|
131
|
-
if (comparison !== 0) {
|
|
132
|
-
return def.desc ? -comparison : comparison;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
return 0;
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
return { extractFromRow, compare };
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Builds a primary key from key values and a primary key definition.
|
|
144
|
-
* Used for constructing keys from old key values in UPDATE/DELETE operations.
|
|
145
|
-
*/
|
|
146
|
-
export function buildPrimaryKeyFromValues(
|
|
147
|
-
keyValues: Row,
|
|
148
|
-
pkDefinition: ReadonlyArray<PrimaryKeyColumnDefinition>
|
|
149
|
-
): BTreeKeyForPrimary {
|
|
150
|
-
if (pkDefinition.length === 0) {
|
|
151
|
-
// Empty primary key definition means singleton table - return empty array
|
|
152
|
-
return [];
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
if (keyValues.length !== pkDefinition.length) {
|
|
156
|
-
throw new QuereusError(
|
|
157
|
-
`Key value count mismatch. Expected ${pkDefinition.length}, got ${keyValues.length}.`,
|
|
158
|
-
StatusCode.INTERNAL
|
|
159
|
-
);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
return pkDefinition.length === 1 ? keyValues[0] : keyValues;
|
|
163
|
-
}
|
package/src/vtab/module.ts
DELETED
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import type { Database } from '../core/database.js'; // Assuming Database class exists
|
|
2
|
-
import type { VirtualTable } from './table.js';
|
|
3
|
-
import type { IndexInfo } from './index-info.js';
|
|
4
|
-
import type { ColumnDef } from '../parser/ast.js'; // <-- Add parser AST import
|
|
5
|
-
import type { TableSchema, IndexSchema } from '../schema/table.js'; // Add import for TableSchema and IndexSchema
|
|
6
|
-
import type { BestAccessPlanRequest, BestAccessPlanResult } from './best-access-plan.js';
|
|
7
|
-
import type { PlanNode } from '../planner/nodes/plan-node.js';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Base interface for module-specific configuration passed to create/connect.
|
|
11
|
-
* Modules should define their own interface extending this if they need options.
|
|
12
|
-
*/
|
|
13
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
14
|
-
export interface BaseModuleConfig {}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Assessment result from a module's supports() method indicating
|
|
18
|
-
* whether it can execute a plan subtree and at what cost.
|
|
19
|
-
*/
|
|
20
|
-
export interface SupportAssessment {
|
|
21
|
-
/** Estimated cost comparable to local evaluation cost */
|
|
22
|
-
cost: number;
|
|
23
|
-
/** Optional context data persisted for the emitter */
|
|
24
|
-
ctx?: unknown;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Interface defining the methods for a virtual table module implementation.
|
|
29
|
-
* The module primarily acts as a factory for connection-specific VirtualTable instances.
|
|
30
|
-
*
|
|
31
|
-
* @template TTable The specific type of VirtualTable managed by this module.
|
|
32
|
-
* @template TConfig The type defining module-specific configuration options.
|
|
33
|
-
*/
|
|
34
|
-
export interface VirtualTableModule<
|
|
35
|
-
TTable extends VirtualTable,
|
|
36
|
-
TConfig extends BaseModuleConfig = BaseModuleConfig
|
|
37
|
-
> {
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Creates the persistent definition of a virtual table.
|
|
41
|
-
* Called by CREATE VIRTUAL TABLE to define schema and initialize storage.
|
|
42
|
-
*
|
|
43
|
-
* @param db The database connection
|
|
44
|
-
* @param tableSchema The schema definition for the table being created
|
|
45
|
-
* @returns The new VirtualTable instance
|
|
46
|
-
* @throws QuereusError on failure
|
|
47
|
-
*/
|
|
48
|
-
create(
|
|
49
|
-
db: Database,
|
|
50
|
-
tableSchema: TableSchema,
|
|
51
|
-
): TTable;
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Connects to an existing virtual table definition.
|
|
55
|
-
* Called when the schema is loaded or a connection needs to interact with the table.
|
|
56
|
-
*
|
|
57
|
-
* @param db The database connection
|
|
58
|
-
* @param pAux Client data passed during module registration
|
|
59
|
-
* @param moduleName The name the module was registered with
|
|
60
|
-
* @param schemaName The name of the database schema
|
|
61
|
-
* @param tableName The name of the virtual table to connect to
|
|
62
|
-
* @param options Module-specific configuration options from the original CREATE VIRTUAL TABLE
|
|
63
|
-
* @param tableSchema Optional table schema when connecting during import (columns, PK, etc.)
|
|
64
|
-
* @returns The connection-specific VirtualTable instance
|
|
65
|
-
* @throws QuereusError on failure
|
|
66
|
-
*/
|
|
67
|
-
connect(
|
|
68
|
-
db: Database,
|
|
69
|
-
pAux: unknown,
|
|
70
|
-
moduleName: string,
|
|
71
|
-
schemaName: string,
|
|
72
|
-
tableName: string,
|
|
73
|
-
options: TConfig,
|
|
74
|
-
tableSchema?: TableSchema
|
|
75
|
-
): TTable;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Determines if this module can execute a plan subtree starting at the given node.
|
|
79
|
-
* Used for query push-down to virtual table modules that support arbitrary queries.
|
|
80
|
-
*
|
|
81
|
-
* @param node The root node of the subtree to evaluate
|
|
82
|
-
* @returns Assessment with cost and optional context, or undefined if not supported
|
|
83
|
-
*/
|
|
84
|
-
supports?(
|
|
85
|
-
node: PlanNode
|
|
86
|
-
): SupportAssessment | undefined;
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Modern, type-safe access planning interface.
|
|
90
|
-
* Preferred over xBestIndex for new implementations.
|
|
91
|
-
*
|
|
92
|
-
* @param db The database connection
|
|
93
|
-
* @param tableInfo The schema information for the table being planned
|
|
94
|
-
* @param request Planning request with constraints and requirements
|
|
95
|
-
* @returns Access plan result describing the chosen strategy
|
|
96
|
-
*/
|
|
97
|
-
getBestAccessPlan?(
|
|
98
|
-
db: Database,
|
|
99
|
-
tableInfo: TableSchema,
|
|
100
|
-
request: BestAccessPlanRequest
|
|
101
|
-
): BestAccessPlanResult;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Destroys the underlying persistent representation of the virtual table.
|
|
107
|
-
* Called by DROP TABLE.
|
|
108
|
-
*
|
|
109
|
-
* @param db The database connection
|
|
110
|
-
* @param pAux Client data passed during module registration
|
|
111
|
-
* @param moduleName The name the module was registered with
|
|
112
|
-
* @param schemaName The name of the database schema
|
|
113
|
-
* @param tableName The name of the virtual table being destroyed
|
|
114
|
-
* @throws QuereusError on failure
|
|
115
|
-
*/
|
|
116
|
-
destroy(
|
|
117
|
-
db: Database,
|
|
118
|
-
pAux: unknown,
|
|
119
|
-
moduleName: string,
|
|
120
|
-
schemaName: string,
|
|
121
|
-
tableName: string
|
|
122
|
-
): Promise<void>;
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Creates an index on a virtual table.
|
|
126
|
-
* Called by CREATE INDEX.
|
|
127
|
-
*
|
|
128
|
-
* @param db The database connection
|
|
129
|
-
* @param schemaName The name of the database schema
|
|
130
|
-
* @param tableName The name of the virtual table
|
|
131
|
-
* @param indexSchema The schema definition for the index being created
|
|
132
|
-
* @throws QuereusError on failure
|
|
133
|
-
*/
|
|
134
|
-
createIndex?(
|
|
135
|
-
db: Database,
|
|
136
|
-
schemaName: string,
|
|
137
|
-
tableName: string,
|
|
138
|
-
indexSchema: IndexSchema
|
|
139
|
-
): Promise<void>;
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Checks for shadow table name conflicts
|
|
143
|
-
* @param name The name to check
|
|
144
|
-
* @returns true if the name would conflict
|
|
145
|
-
*/
|
|
146
|
-
shadowName?(name: string): boolean;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Defines the structure for schema change information passed to xAlterSchema
|
|
151
|
-
*/
|
|
152
|
-
export type SchemaChangeInfo =
|
|
153
|
-
| { type: 'addColumn'; columnDef: ColumnDef }
|
|
154
|
-
| { type: 'dropColumn'; columnName: string }
|
|
155
|
-
| { type: 'renameColumn'; oldName: string; newName: string; newColumnDefAst?: ColumnDef };
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Type alias for the common usage pattern where specific table and config types are not known.
|
|
159
|
-
* Use this for storage scenarios like the SchemaManager where modules of different types are stored together.
|
|
160
|
-
* eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
161
|
-
*/
|
|
162
|
-
export type AnyVirtualTableModule = VirtualTableModule<any, any>;
|