@slexisvn/query-engine 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/binder/binder.d.ts +130 -0
- package/dist/binder/expression-binder.d.ts +168 -0
- package/dist/binder/scope.d.ts +40 -0
- package/dist/browser.d.ts +8 -0
- package/dist/catalog/catalog.d.ts +53 -0
- package/dist/catalog/function-registry.d.ts +26 -0
- package/dist/catalog/statistics-cache.d.ts +39 -0
- package/dist/catalog/statistics.d.ts +72 -0
- package/dist/catalog/tpch-schema.d.ts +15 -0
- package/dist/cli/cli-common.d.ts +11 -0
- package/dist/cli/coordinator.d.ts +1 -0
- package/dist/cli/format.d.ts +8 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/loaders/csv-loader.d.ts +17 -0
- package/dist/cli/loaders/data-loader.d.ts +7 -0
- package/dist/cli/loaders/json-loader.d.ts +13 -0
- package/dist/cli/loaders/loader-factory.d.ts +4 -0
- package/dist/cli/repl.d.ts +6 -0
- package/dist/cli/worker.d.ts +1 -0
- package/dist/config.d.ts +42 -0
- package/dist/core.wasm +0 -0
- package/dist/dataframe/column-expr.d.ts +67 -0
- package/dist/dataframe/dataframe.d.ts +96 -0
- package/dist/dataframe/expr-types.d.ts +6 -0
- package/dist/dataframe/in-memory-relation.d.ts +31 -0
- package/dist/dataframe/index.d.ts +4 -0
- package/dist/dataframe/schema.d.ts +35 -0
- package/dist/dataframe/sql-expr-binder.d.ts +17 -0
- package/dist/dataframe/type-inference.d.ts +8 -0
- package/dist/distributed/cluster/cluster-manager.d.ts +54 -0
- package/dist/distributed/cluster/heartbeat-monitor.d.ts +27 -0
- package/dist/distributed/cluster/node-descriptor.d.ts +41 -0
- package/dist/distributed/distributed-types.d.ts +336 -0
- package/dist/distributed/execution/coordinator.d.ts +53 -0
- package/dist/distributed/execution/exchange-operator.d.ts +44 -0
- package/dist/distributed/execution/fragment-executor.d.ts +48 -0
- package/dist/distributed/execution/merge-exchange.d.ts +55 -0
- package/dist/distributed/optimizer/distributed-sort.d.ts +6 -0
- package/dist/distributed/optimizer/distribution-aware-join.d.ts +28 -0
- package/dist/distributed/optimizer/partial-aggregate.d.ts +9 -0
- package/dist/distributed/partition/partition-map.d.ts +27 -0
- package/dist/distributed/partition/partition-pruner.d.ts +33 -0
- package/dist/distributed/partition/partition-strategy.d.ts +43 -0
- package/dist/distributed/planner/distributed-planner.d.ts +71 -0
- package/dist/distributed/planner/exchange-placement.d.ts +19 -0
- package/dist/distributed/planner/expr-utils.d.ts +2 -0
- package/dist/distributed/planner/fragment.d.ts +47 -0
- package/dist/distributed/transport/chunk-codec.d.ts +18 -0
- package/dist/distributed/transport/http-transport.d.ts +49 -0
- package/dist/distributed/transport/transport.d.ts +13 -0
- package/dist/engine/query-engine.d.ts +142 -0
- package/dist/engine-entry.d.ts +12 -0
- package/dist/execution/builders/aggregate-builder.d.ts +46 -0
- package/dist/execution/builders/builder-utils.d.ts +5 -0
- package/dist/execution/builders/cte-builders.d.ts +20 -0
- package/dist/execution/builders/exchange-builders.d.ts +33 -0
- package/dist/execution/builders/join-builder.d.ts +67 -0
- package/dist/execution/builders/pipeline-builders.d.ts +30 -0
- package/dist/execution/builders/source-builders.d.ts +23 -0
- package/dist/execution/column-resolve.d.ts +7 -0
- package/dist/execution/execution-types.d.ts +33 -0
- package/dist/execution/expression-eval.d.ts +13 -0
- package/dist/execution/fragment-spec.d.ts +125 -0
- package/dist/execution/join-utils.d.ts +14 -0
- package/dist/execution/operator-registry.d.ts +9 -0
- package/dist/execution/operators/agg-wasm.d.ts +16 -0
- package/dist/execution/operators/dedup-core.d.ts +10 -0
- package/dist/execution/operators/dependent-join.d.ts +14 -0
- package/dist/execution/operators/distinct.d.ts +12 -0
- package/dist/execution/operators/filter.d.ts +87 -0
- package/dist/execution/operators/hash-aggregate.d.ts +121 -0
- package/dist/execution/operators/hash-join.d.ts +74 -0
- package/dist/execution/operators/index-scan.d.ts +34 -0
- package/dist/execution/operators/join-core.d.ts +47 -0
- package/dist/execution/operators/merge-join.d.ts +38 -0
- package/dist/execution/operators/nested-loop-join.d.ts +28 -0
- package/dist/execution/operators/projection.d.ts +20 -0
- package/dist/execution/operators/scan.d.ts +17 -0
- package/dist/execution/operators/sort.d.ts +48 -0
- package/dist/execution/operators/stream-aggregate.d.ts +30 -0
- package/dist/execution/operators/union.d.ts +13 -0
- package/dist/execution/operators/vector-aggregate.d.ts +73 -0
- package/dist/execution/operators/window.d.ts +22 -0
- package/dist/execution/physical-plan.d.ts +14 -0
- package/dist/execution/pipeline.d.ts +28 -0
- package/dist/execution/query-executor.d.ts +70 -0
- package/dist/execution/query-result.d.ts +15 -0
- package/dist/execution/result-sink.d.ts +26 -0
- package/dist/execution/scheduler.d.ts +8 -0
- package/dist/execution/vector-ops.d.ts +32 -0
- package/dist/execution/wasm-expr-eval.d.ts +7 -0
- package/dist/index.browser.js +17999 -0
- package/dist/index.cli.js +1002 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.node.js +21432 -0
- package/dist/optimizer/dphyp/cardinality.d.ts +69 -0
- package/dist/optimizer/dphyp/cost-model.d.ts +47 -0
- package/dist/optimizer/dphyp/dphyp.d.ts +32 -0
- package/dist/optimizer/dphyp/hypergraph.d.ts +38 -0
- package/dist/optimizer/optimizer.d.ts +12 -0
- package/dist/optimizer/pass.d.ts +5 -0
- package/dist/optimizer/passes/aggregate-pushdown.d.ts +6 -0
- package/dist/optimizer/passes/cte-optimization.d.ts +6 -0
- package/dist/optimizer/passes/empty-propagation.d.ts +6 -0
- package/dist/optimizer/passes/expr-walk.d.ts +20 -0
- package/dist/optimizer/passes/expression-simplifier.d.ts +8 -0
- package/dist/optimizer/passes/filter-ordering.d.ts +13 -0
- package/dist/optimizer/passes/having-pushdown.d.ts +6 -0
- package/dist/optimizer/passes/index-selection.d.ts +24 -0
- package/dist/optimizer/passes/join-elimination.d.ts +6 -0
- package/dist/optimizer/passes/join-reorder.d.ts +12 -0
- package/dist/optimizer/passes/join-residual-split.d.ts +6 -0
- package/dist/optimizer/passes/limit-pushdown.d.ts +6 -0
- package/dist/optimizer/passes/node-merge.d.ts +6 -0
- package/dist/optimizer/passes/outer-to-inner.d.ts +6 -0
- package/dist/optimizer/passes/physical-design.d.ts +12 -0
- package/dist/optimizer/passes/plan-refs.d.ts +22 -0
- package/dist/optimizer/passes/predicate-dedup.d.ts +6 -0
- package/dist/optimizer/passes/predicate-inference.d.ts +6 -0
- package/dist/optimizer/passes/predicate-pushdown.d.ts +9 -0
- package/dist/optimizer/passes/projection-pushdown.d.ts +6 -0
- package/dist/optimizer/passes/sort-elimination.d.ts +6 -0
- package/dist/optimizer/passes/subquery-unnesting.d.ts +6 -0
- package/dist/optimizer/passes/topn-fusion.d.ts +6 -0
- package/dist/parallel/chunk-transport.d.ts +24 -0
- package/dist/parallel/fragment-pool.d.ts +49 -0
- package/dist/parallel/fragment-worker.d.ts +1 -0
- package/dist/parallel/morsel-scheduler.d.ts +11 -0
- package/dist/parallel/parallel-dispatch.d.ts +69 -0
- package/dist/parallel/partial-spill.d.ts +3 -0
- package/dist/parallel/worker-messages.d.ts +243 -0
- package/dist/parallel/worker-pool.d.ts +62 -0
- package/dist/parallel/worker-thread.d.ts +1 -0
- package/dist/parser/ast.d.ts +298 -0
- package/dist/parser/lexer.d.ts +135 -0
- package/dist/parser/parser.d.ts +64 -0
- package/dist/planner/logical-plan.d.ts +250 -0
- package/dist/planner/logical-planner.d.ts +23 -0
- package/dist/planner/plan-formatter.d.ts +4 -0
- package/dist/planner/plan-visitor.d.ts +58 -0
- package/dist/runtime/platform.d.ts +4 -0
- package/dist/storage/backend/memory-storage-backend.d.ts +14 -0
- package/dist/storage/backend/node-storage-backend.d.ts +11 -0
- package/dist/storage/btree.d.ts +34 -0
- package/dist/storage/buffer-pool.d.ts +17 -0
- package/dist/storage/chunk.d.ts +26 -0
- package/dist/storage/column.d.ts +38 -0
- package/dist/storage/data-type.d.ts +54 -0
- package/dist/storage/dictionary-column.d.ts +33 -0
- package/dist/storage/page-store/file-page-store.d.ts +13 -0
- package/dist/storage/page-store/memory-page-store.d.ts +9 -0
- package/dist/storage/sab-arena.d.ts +26 -0
- package/dist/storage/serializer.d.ts +6 -0
- package/dist/storage/spill-manager/fs-storage.d.ts +11 -0
- package/dist/storage/spill-manager/memory-storage.d.ts +10 -0
- package/dist/storage/spill-manager/spill-manager.d.ts +17 -0
- package/dist/storage/storage-constants.d.ts +3 -0
- package/dist/storage/table.d.ts +31 -0
- package/dist/storage/temp-space/memory-temp-space.d.ts +11 -0
- package/dist/storage/temp-space/temp-directory-manager.d.ts +14 -0
- package/dist/utils/bitmap.d.ts +11 -0
- package/dist/utils/hash.d.ts +1 -0
- package/dist/utils/lru-cache.d.ts +24 -0
- package/dist/utils/priority-queue.d.ts +18 -0
- package/dist/wasm/dispatch.d.ts +13 -0
- package/dist/wasm/fetch-byte-source.d.ts +2 -0
- package/dist/wasm/kernels/core-instance.d.ts +6 -0
- package/dist/wasm/kernels/kernel-factory.d.ts +8 -0
- package/dist/wasm/kernels/wasm-aggregate.d.ts +6 -0
- package/dist/wasm/kernels/wasm-arithmetic.d.ts +13 -0
- package/dist/wasm/kernels/wasm-filter-f64.d.ts +8 -0
- package/dist/wasm/kernels/wasm-filter.d.ts +5 -0
- package/dist/wasm/loader.d.ts +17 -0
- package/dist/wasm/node-byte-source.d.ts +1 -0
- package/dist/wasm/region-allocator.d.ts +23 -0
- package/dist/wasm/register-kernels.d.ts +1 -0
- package/dist/wasm/wasm-loader-base.d.ts +33 -0
- package/dist/wasm/wasm-types.d.ts +103 -0
- package/package.json +60 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ScanOperator } from '../operators/scan.js';
|
|
2
|
+
import { IndexScanOperator } from '../operators/index-scan.js';
|
|
3
|
+
import type { ColumnMapping, CompiledPipeline, ExecSchema } from '../execution-types.js';
|
|
4
|
+
import type { LogicalPlanNode, LogicalScanNode, LogicalIndexScanNode, LogicalSingleRowNode, LogicalEmptyNode } from '../../planner/logical-plan.js';
|
|
5
|
+
import type { ColumnInfo } from '../../binder/scope.js';
|
|
6
|
+
type ScanStorage = ConstructorParameters<typeof ScanOperator>[0];
|
|
7
|
+
type IndexStorage = ConstructorParameters<typeof IndexScanOperator>[1];
|
|
8
|
+
type IndexBTree = ConstructorParameters<typeof IndexScanOperator>[0];
|
|
9
|
+
interface CatalogLike {
|
|
10
|
+
getTableStorage(name: string): (ScanStorage & IndexStorage) | null;
|
|
11
|
+
getIndexForColumn(table: string, column: string): IndexBTree | null;
|
|
12
|
+
}
|
|
13
|
+
interface ExecutorLike {
|
|
14
|
+
catalog: CatalogLike;
|
|
15
|
+
buildPipeline(node: LogicalPlanNode): Promise<CompiledPipeline>;
|
|
16
|
+
resolveProjectedColumnIndexes(schema: ExecSchema, planColumns: ColumnInfo[] | null): number[] | null;
|
|
17
|
+
buildSchemaMapping(schema: ExecSchema, alias: string): ColumnMapping;
|
|
18
|
+
}
|
|
19
|
+
export declare function buildScan(executor: ExecutorLike, node: LogicalScanNode): Promise<CompiledPipeline>;
|
|
20
|
+
export declare function buildIndexScan(executor: ExecutorLike, node: LogicalIndexScanNode): Promise<CompiledPipeline>;
|
|
21
|
+
export declare function buildSingleRow(executor: ExecutorLike, node: LogicalSingleRowNode): Promise<CompiledPipeline>;
|
|
22
|
+
export declare function buildEmpty(executor: ExecutorLike, node: LogicalEmptyNode): Promise<CompiledPipeline>;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { BoundColumnRefNode } from '../binder/expression-binder.js';
|
|
2
|
+
import type { ColumnMapping } from './execution-types.js';
|
|
3
|
+
interface ResolveColumnIndexOpts {
|
|
4
|
+
clampNegative?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function resolveColumnIndex(expr: BoundColumnRefNode, columnMapping: ColumnMapping | null, opts?: ResolveColumnIndexOpts): number;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { DataChunk } from '../storage/chunk.js';
|
|
2
|
+
import type { ColumnValue, DataType } from '../storage/data-type.js';
|
|
3
|
+
import type { PipelineGraph, CancelToken } from './pipeline.js';
|
|
4
|
+
export type ColumnMapping = Map<string, number>;
|
|
5
|
+
export interface IntervalValue {
|
|
6
|
+
value: number;
|
|
7
|
+
unit: string;
|
|
8
|
+
_isInterval: true;
|
|
9
|
+
}
|
|
10
|
+
export type EvalValue = ColumnValue | IntervalValue | undefined;
|
|
11
|
+
export type CompiledExpr = (chunk: DataChunk, rowIdx: number) => EvalValue;
|
|
12
|
+
export interface ExecColumn {
|
|
13
|
+
name: string;
|
|
14
|
+
dataType: DataType;
|
|
15
|
+
tableAlias?: string;
|
|
16
|
+
tableName?: string;
|
|
17
|
+
alias?: string;
|
|
18
|
+
outputName?: string;
|
|
19
|
+
}
|
|
20
|
+
export type ExecSchema = ExecColumn[];
|
|
21
|
+
export interface Sink {
|
|
22
|
+
consume(chunk: DataChunk): Promise<void>;
|
|
23
|
+
finalize?(): Promise<void>;
|
|
24
|
+
init?(): Promise<void>;
|
|
25
|
+
error?(err: Error): void;
|
|
26
|
+
cancelToken?: CancelToken;
|
|
27
|
+
}
|
|
28
|
+
export interface CompiledPipeline {
|
|
29
|
+
schema: ExecSchema;
|
|
30
|
+
columnMapping: ColumnMapping;
|
|
31
|
+
register(graph: PipelineGraph, currentPipelineId: number, currentSink: Sink): void;
|
|
32
|
+
}
|
|
33
|
+
export type SourceGenerator = () => AsyncGenerator<DataChunk>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { BoundExpr, BoundAggregateNode, BoundWindowNode } from '../binder/expression-binder.js';
|
|
2
|
+
import type { CompiledExpr, ColumnMapping, ExecColumn } from './execution-types.js';
|
|
3
|
+
interface MappingSchema {
|
|
4
|
+
columns?: ExecColumn[];
|
|
5
|
+
alias?: string;
|
|
6
|
+
tableName?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function compileExpression(expr: BoundExpr | null, columnMapping: ColumnMapping | null): CompiledExpr;
|
|
9
|
+
declare function aggExprKey(expr: BoundAggregateNode): string;
|
|
10
|
+
export { aggExprKey };
|
|
11
|
+
declare function windowExprKey(expr: BoundWindowNode): string;
|
|
12
|
+
export { windowExprKey };
|
|
13
|
+
export declare function buildColumnMapping(schemas: MappingSchema[] | ExecColumn[][]): ColumnMapping;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { type LogicalPlanNode } from '../planner/logical-plan.js';
|
|
2
|
+
import type { ColumnInfo } from '../binder/scope.js';
|
|
3
|
+
import type { BoundExpr, BoundColumnRefNode, BoundAggregateNode } from '../binder/expression-binder.js';
|
|
4
|
+
import { DataType } from '../storage/data-type.js';
|
|
5
|
+
import { FilterOperator } from './operators/filter.js';
|
|
6
|
+
import { ProjectionOperator } from './operators/projection.js';
|
|
7
|
+
import { HashAggregateOperator, getAccumulatorFactory } from './operators/hash-aggregate.js';
|
|
8
|
+
import type { CompiledExpr, ColumnMapping, ExecSchema } from './execution-types.js';
|
|
9
|
+
export declare enum StageKind {
|
|
10
|
+
FILTER = "filter",
|
|
11
|
+
PROJECT = "project"
|
|
12
|
+
}
|
|
13
|
+
interface FilterStage {
|
|
14
|
+
kind: StageKind.FILTER;
|
|
15
|
+
condition: BoundExpr | null;
|
|
16
|
+
}
|
|
17
|
+
interface ProjectStage {
|
|
18
|
+
kind: StageKind.PROJECT;
|
|
19
|
+
expressions: BoundExpr[];
|
|
20
|
+
}
|
|
21
|
+
export type Stage = FilterStage | ProjectStage;
|
|
22
|
+
interface AggregateSpec {
|
|
23
|
+
name: string;
|
|
24
|
+
distinct: boolean;
|
|
25
|
+
args: BoundExpr[];
|
|
26
|
+
}
|
|
27
|
+
interface AggregateDef {
|
|
28
|
+
name: string;
|
|
29
|
+
valueKey: string | null;
|
|
30
|
+
resultType: DataType;
|
|
31
|
+
createAccumulator: ReturnType<typeof getAccumulatorFactory>;
|
|
32
|
+
extractValue: CompiledExpr;
|
|
33
|
+
_wasmColIndex?: number;
|
|
34
|
+
_sourceExpr: BoundExpr | null;
|
|
35
|
+
_columnMapping: ColumnMapping;
|
|
36
|
+
}
|
|
37
|
+
interface StageChain {
|
|
38
|
+
table: string;
|
|
39
|
+
alias: string;
|
|
40
|
+
scanColumns: ColumnInfo[];
|
|
41
|
+
stages: Stage[];
|
|
42
|
+
}
|
|
43
|
+
export interface FragmentSpec {
|
|
44
|
+
baseSchema: ExecSchema;
|
|
45
|
+
stages: Stage[];
|
|
46
|
+
groupBy: BoundExpr[];
|
|
47
|
+
aggregates: AggregateSpec[];
|
|
48
|
+
}
|
|
49
|
+
interface BuiltFragmentSpec {
|
|
50
|
+
spec: FragmentSpec;
|
|
51
|
+
columnIndexes: number[];
|
|
52
|
+
estimatedRowBytes: number;
|
|
53
|
+
}
|
|
54
|
+
interface InstantiatedStages {
|
|
55
|
+
operators: (FilterOperator | ProjectionOperator)[];
|
|
56
|
+
schema: ExecSchema;
|
|
57
|
+
mapping: ColumnMapping;
|
|
58
|
+
}
|
|
59
|
+
interface InstantiatedFragment {
|
|
60
|
+
operators: (FilterOperator | ProjectionOperator)[];
|
|
61
|
+
aggregate: HashAggregateOperator;
|
|
62
|
+
}
|
|
63
|
+
interface SideSpec {
|
|
64
|
+
baseSchema: ExecSchema;
|
|
65
|
+
stages: Stage[];
|
|
66
|
+
schema: ExecSchema;
|
|
67
|
+
}
|
|
68
|
+
interface JoinSpecInput {
|
|
69
|
+
build: SideSpec;
|
|
70
|
+
probe: SideSpec;
|
|
71
|
+
buildKeys: BoundExpr[];
|
|
72
|
+
probeKeys: BoundExpr[];
|
|
73
|
+
residualCondition: BoundExpr | null;
|
|
74
|
+
joinType: string;
|
|
75
|
+
buildPreserved: boolean;
|
|
76
|
+
uniqueKeys: boolean;
|
|
77
|
+
buildMapping: ColumnMapping;
|
|
78
|
+
probeMapping: ColumnMapping;
|
|
79
|
+
combinedMapping: ColumnMapping;
|
|
80
|
+
}
|
|
81
|
+
export interface JoinSpec {
|
|
82
|
+
build: SideSpec;
|
|
83
|
+
probe: SideSpec;
|
|
84
|
+
buildKeys: BoundExpr[];
|
|
85
|
+
probeKeys: BoundExpr[];
|
|
86
|
+
residualCondition: BoundExpr | null;
|
|
87
|
+
joinType: string;
|
|
88
|
+
buildPreserved: boolean;
|
|
89
|
+
uniqueKeys: boolean;
|
|
90
|
+
buildColCount: number;
|
|
91
|
+
probeColCount: number;
|
|
92
|
+
}
|
|
93
|
+
interface InstantiatedJoinSpec {
|
|
94
|
+
buildOperators: (FilterOperator | ProjectionOperator)[];
|
|
95
|
+
probeOperators: (FilterOperator | ProjectionOperator)[];
|
|
96
|
+
buildExtractors: CompiledExpr[];
|
|
97
|
+
probeExtractors: CompiledExpr[];
|
|
98
|
+
conditionEvaluator: CompiledExpr | null;
|
|
99
|
+
}
|
|
100
|
+
interface AggregateLike {
|
|
101
|
+
name?: string;
|
|
102
|
+
}
|
|
103
|
+
export declare function normalizeExecType(dt: DataType | string): DataType;
|
|
104
|
+
export declare function normalizeAggResultType(agg: BoundAggregateNode | AggregateLike): DataType;
|
|
105
|
+
export declare function expressionCacheKey(expr: BoundExpr | null): string;
|
|
106
|
+
export declare function schemaMappingOf(schema: ExecSchema): ColumnMapping;
|
|
107
|
+
export declare function projectionSchemaOf(expressions: BoundExpr[]): ExecSchema;
|
|
108
|
+
export declare function collectColumnRefs(node: BoundExpr | BoundExpr[] | null, acc?: BoundColumnRefNode[]): BoundColumnRefNode[];
|
|
109
|
+
export declare function resolveRef(ref: BoundColumnRefNode, mapping: ColumnMapping): number | undefined;
|
|
110
|
+
export declare function buildAggregateDefs(aggregates: AggregateSpec[], columnMapping: ColumnMapping): AggregateDef[];
|
|
111
|
+
export declare function extractStageChain(startNode: LogicalPlanNode | null): StageChain | null;
|
|
112
|
+
export declare function extractAggregateFragment(node: LogicalPlanNode): StageChain | null;
|
|
113
|
+
export declare function stagedSchemaOf(baseSchema: ExecSchema, stages: Stage[]): ExecSchema;
|
|
114
|
+
export declare function instantiateStages(baseSchema: ExecSchema, stages: Stage[]): InstantiatedStages;
|
|
115
|
+
export declare function buildFragmentSpec(fragment: StageChain, node: LogicalPlanNode & {
|
|
116
|
+
groupBy?: BoundExpr[];
|
|
117
|
+
aggregates: BoundExpr[];
|
|
118
|
+
}, storageSchema: ExecSchema): BuiltFragmentSpec | null;
|
|
119
|
+
export declare function instantiateFragment(spec: FragmentSpec): InstantiatedFragment;
|
|
120
|
+
export declare function instantiateAggregate(spec: FragmentSpec): HashAggregateOperator;
|
|
121
|
+
export declare function plainSchemaOf(schema: ExecSchema): ExecSchema;
|
|
122
|
+
export declare function schemasEqual(a: ExecSchema, b: ExecSchema): boolean;
|
|
123
|
+
export declare function buildJoinSpec({ build, probe, buildKeys, probeKeys, residualCondition, joinType, buildPreserved, uniqueKeys, buildMapping, probeMapping, combinedMapping, }: JoinSpecInput): JoinSpec | null;
|
|
124
|
+
export declare function instantiateJoinSpec(spec: JoinSpec): InstantiatedJoinSpec;
|
|
125
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { BoundExpr, BoundColumnRefNode } from '../binder/expression-binder.js';
|
|
2
|
+
import type { ColumnMapping } from './execution-types.js';
|
|
3
|
+
export interface JoinKeyPair {
|
|
4
|
+
buildKey: BoundColumnRefNode;
|
|
5
|
+
probeKey: BoundColumnRefNode;
|
|
6
|
+
}
|
|
7
|
+
export interface ExtractedJoinKeys {
|
|
8
|
+
buildKeys: BoundExpr[];
|
|
9
|
+
probeKeys: BoundExpr[];
|
|
10
|
+
residualCondition: BoundExpr | null;
|
|
11
|
+
}
|
|
12
|
+
export declare function splitAnd(expr: BoundExpr | null): BoundExpr[];
|
|
13
|
+
export declare function findCommonEquiJoinKeys(expr: BoundExpr | null, leftMapping: ColumnMapping, rightMapping: ColumnMapping): JoinKeyPair | null;
|
|
14
|
+
export declare function extractJoinKeys(condition: BoundExpr | null, leftMapping: ColumnMapping, rightMapping: ColumnMapping): ExtractedJoinKeys;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type OperatorArg = string | number | boolean | object | null;
|
|
2
|
+
export type OperatorFactory = (...args: OperatorArg[]) => object;
|
|
3
|
+
export declare class OperatorRegistry {
|
|
4
|
+
factories: Map<string, OperatorFactory>;
|
|
5
|
+
constructor();
|
|
6
|
+
register(logicalType: string, factory: OperatorFactory): this;
|
|
7
|
+
create(logicalType: string, ...args: OperatorArg[]): object;
|
|
8
|
+
has(logicalType: string): boolean;
|
|
9
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { globalDispatch } from '../../wasm/dispatch.js';
|
|
2
|
+
import { DataType } from '../../storage/data-type.js';
|
|
3
|
+
type GlobalDispatch = typeof globalDispatch;
|
|
4
|
+
interface AggregateDef {
|
|
5
|
+
name: string;
|
|
6
|
+
resultType: DataType;
|
|
7
|
+
}
|
|
8
|
+
export interface ResolvedKernel {
|
|
9
|
+
kernelKey: string | null;
|
|
10
|
+
dataType: string | null;
|
|
11
|
+
kind: string;
|
|
12
|
+
}
|
|
13
|
+
export type ScalarReduceKernel = (data: Float64Array | Int32Array) => number | Promise<number>;
|
|
14
|
+
export type BitmapCountKernel = (bitmap: Uint32Array, count: number) => number | Promise<number>;
|
|
15
|
+
export declare function resolveWasmAggKernel(def: AggregateDef, globalDispatch: GlobalDispatch): ResolvedKernel | null;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DataChunk } from '../../storage/chunk.js';
|
|
2
|
+
import type { DataType } from '../../storage/data-type.js';
|
|
3
|
+
export interface DedupTarget {
|
|
4
|
+
seen: Set<string>;
|
|
5
|
+
schema: DataType[] | null;
|
|
6
|
+
_legacyChunks: DataChunk[];
|
|
7
|
+
}
|
|
8
|
+
export declare function dedupProcess(target: DedupTarget, chunk: DataChunk): DataChunk;
|
|
9
|
+
export declare function dedupConsume(target: DedupTarget, result: DataChunk): Promise<void>;
|
|
10
|
+
export declare function dedupFinalize(target: DedupTarget): DataChunk[];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DataChunk } from '../../storage/chunk.js';
|
|
2
|
+
import type { ColumnValue } from '../../storage/data-type.js';
|
|
3
|
+
import type { ExecSchema } from '../execution-types.js';
|
|
4
|
+
type JoinRow = ColumnValue[];
|
|
5
|
+
export declare class DependentJoinOperator {
|
|
6
|
+
subqueryType: string;
|
|
7
|
+
outerSchema: ExecSchema;
|
|
8
|
+
resultRows: JoinRow[];
|
|
9
|
+
resultSchema: ExecSchema;
|
|
10
|
+
constructor(subqueryType: string, outerSchema: ExecSchema);
|
|
11
|
+
processOuterRow(outerRow: JoinRow, subResultChunks: DataChunk[]): Promise<void>;
|
|
12
|
+
finalize(): Promise<DataChunk[]>;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DataChunk } from '../../storage/chunk.js';
|
|
2
|
+
import type { DataType } from '../../storage/data-type.js';
|
|
3
|
+
export declare class DistinctOperator {
|
|
4
|
+
seen: Set<string>;
|
|
5
|
+
schema: DataType[] | null;
|
|
6
|
+
_legacyChunks: DataChunk[];
|
|
7
|
+
constructor();
|
|
8
|
+
init(): Promise<void>;
|
|
9
|
+
process(chunk: DataChunk): Promise<DataChunk>;
|
|
10
|
+
consume(chunk: DataChunk): Promise<void>;
|
|
11
|
+
finalize(): Promise<DataChunk[]>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { DataChunk, AnyColumn, SelectionVector } from '../../storage/chunk.js';
|
|
2
|
+
import { BoundExprKind } from '../../binder/expression-binder.js';
|
|
3
|
+
import type { BoundExpr, BoundColumnRefNode } from '../../binder/expression-binder.js';
|
|
4
|
+
import type { AnyTypedArray, ColumnValue, DataType } from '../../storage/data-type.js';
|
|
5
|
+
import type { CompiledExpr, ColumnMapping } from '../execution-types.js';
|
|
6
|
+
interface BoundComparisonNode {
|
|
7
|
+
kind: BoundExprKind.COMPARISON;
|
|
8
|
+
op: string;
|
|
9
|
+
left: BoundExpr;
|
|
10
|
+
right: BoundExpr;
|
|
11
|
+
dataType?: string | null;
|
|
12
|
+
}
|
|
13
|
+
type PredicateExpr = BoundExpr | BoundComparisonNode;
|
|
14
|
+
interface ParallelFilterResult {
|
|
15
|
+
selectionVector: Uint32Array;
|
|
16
|
+
matchCount: number;
|
|
17
|
+
}
|
|
18
|
+
interface ParallelDispatch {
|
|
19
|
+
canParallelize(op: string, dt: DataType, n: number): boolean;
|
|
20
|
+
filterParallel(data: AnyTypedArray, len: number, op: string, dt: DataType, args: {
|
|
21
|
+
value?: ColumnValue;
|
|
22
|
+
low?: ColumnValue;
|
|
23
|
+
high?: ColumnValue;
|
|
24
|
+
}): Promise<ParallelFilterResult | null>;
|
|
25
|
+
}
|
|
26
|
+
interface SimpleFilterPlan {
|
|
27
|
+
type: 'simple';
|
|
28
|
+
operation: string;
|
|
29
|
+
dataType: DataType;
|
|
30
|
+
columnIndex: number;
|
|
31
|
+
value: ColumnValue;
|
|
32
|
+
}
|
|
33
|
+
interface BetweenFilterPlan {
|
|
34
|
+
type: 'between';
|
|
35
|
+
operation: string;
|
|
36
|
+
dataType: DataType;
|
|
37
|
+
columnIndex: number;
|
|
38
|
+
low: ColumnValue;
|
|
39
|
+
high: ColumnValue;
|
|
40
|
+
}
|
|
41
|
+
interface AndFilterPlan {
|
|
42
|
+
type: 'and';
|
|
43
|
+
left: FilterPlan;
|
|
44
|
+
right: FilterPlan;
|
|
45
|
+
}
|
|
46
|
+
interface OrFilterPlan {
|
|
47
|
+
type: 'or';
|
|
48
|
+
left: FilterPlan;
|
|
49
|
+
right: FilterPlan;
|
|
50
|
+
}
|
|
51
|
+
type FilterPlan = SimpleFilterPlan | BetweenFilterPlan | AndFilterPlan | OrFilterPlan;
|
|
52
|
+
export declare class FilterOperator {
|
|
53
|
+
predicate: PredicateExpr | null;
|
|
54
|
+
evaluator: CompiledExpr;
|
|
55
|
+
columnMapping: ColumnMapping | null;
|
|
56
|
+
parallelDispatch: ParallelDispatch | null;
|
|
57
|
+
constructor(predicate: PredicateExpr | null, evaluator: CompiledExpr, columnMapping: ColumnMapping | null, parallelDispatch: ParallelDispatch | null);
|
|
58
|
+
init(): Promise<void>;
|
|
59
|
+
process(chunk: DataChunk): Promise<DataChunk>;
|
|
60
|
+
_analyze(expr: PredicateExpr | null): FilterPlan | null;
|
|
61
|
+
_analyzeComparison(expr: PredicateExpr): FilterPlan | null;
|
|
62
|
+
_analyzeBetween(expr: PredicateExpr): FilterPlan | null;
|
|
63
|
+
_analyzeLogical(expr: PredicateExpr): FilterPlan | null;
|
|
64
|
+
_extractColumnAndLiteral(expr: PredicateExpr): {
|
|
65
|
+
columnRef: BoundColumnRefNode | null;
|
|
66
|
+
literal: ColumnValue;
|
|
67
|
+
};
|
|
68
|
+
_extractLiteralValue(expr: BoundExpr | null): ColumnValue;
|
|
69
|
+
_executeParallel(chunk: DataChunk, plan: FilterPlan): Promise<DataChunk | null>;
|
|
70
|
+
_executeSimple(chunk: DataChunk, plan: SimpleFilterPlan): Promise<DataChunk | null>;
|
|
71
|
+
_dropNullRows(column: AnyColumn, sv: Uint32Array, count: number): number;
|
|
72
|
+
_executeBetween(chunk: DataChunk, plan: BetweenFilterPlan): Promise<DataChunk | null>;
|
|
73
|
+
_executeAnd(chunk: DataChunk, plan: AndFilterPlan): Promise<DataChunk | null>;
|
|
74
|
+
_executeOr(chunk: DataChunk, plan: OrFilterPlan): Promise<DataChunk | null>;
|
|
75
|
+
_getColumnData(chunk: DataChunk, column: AnyColumn): AnyTypedArray | null;
|
|
76
|
+
_applySelectionVector(chunk: DataChunk, sv: SelectionVector, count: number): DataChunk;
|
|
77
|
+
_executeFallback(chunk: DataChunk): DataChunk;
|
|
78
|
+
}
|
|
79
|
+
export declare function intersectSorted(a: SelectionVector, aLen: number, b: SelectionVector, bLen: number): {
|
|
80
|
+
data: Uint32Array;
|
|
81
|
+
count: number;
|
|
82
|
+
};
|
|
83
|
+
export declare function unionSorted(a: SelectionVector, aLen: number, b: SelectionVector, bLen: number): {
|
|
84
|
+
data: Uint32Array;
|
|
85
|
+
count: number;
|
|
86
|
+
};
|
|
87
|
+
export {};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { DataChunk } from '../../storage/chunk.js';
|
|
2
|
+
import { DataType, type ColumnValue } from '../../storage/data-type.js';
|
|
3
|
+
import type { BoundExpr } from '../../binder/expression-binder.js';
|
|
4
|
+
import type { CompiledExpr, ColumnMapping, EvalValue } from '../execution-types.js';
|
|
5
|
+
type AvgState = {
|
|
6
|
+
sum: number;
|
|
7
|
+
count: number;
|
|
8
|
+
};
|
|
9
|
+
type AccumulatorState = ColumnValue | AvgState | ColumnValue[];
|
|
10
|
+
interface Accumulator {
|
|
11
|
+
add(val: EvalValue): void;
|
|
12
|
+
result(): ColumnValue;
|
|
13
|
+
exportState(): AccumulatorState;
|
|
14
|
+
mergeState(state: AccumulatorState): void;
|
|
15
|
+
}
|
|
16
|
+
interface AggregateDef {
|
|
17
|
+
name: string;
|
|
18
|
+
valueKey: string | null;
|
|
19
|
+
resultType: DataType;
|
|
20
|
+
createAccumulator: () => Accumulator;
|
|
21
|
+
extractValue: CompiledExpr;
|
|
22
|
+
_wasmColIndex?: number;
|
|
23
|
+
_sourceExpr: BoundExpr | null;
|
|
24
|
+
_columnMapping: ColumnMapping;
|
|
25
|
+
}
|
|
26
|
+
type GroupKey = string | number | bigint | boolean | null;
|
|
27
|
+
interface GroupState {
|
|
28
|
+
groupValues: ColumnValue[];
|
|
29
|
+
accumulators: Accumulator[];
|
|
30
|
+
}
|
|
31
|
+
interface PartialGroup {
|
|
32
|
+
key: GroupKey;
|
|
33
|
+
groupValues: ColumnValue[];
|
|
34
|
+
states: AccumulatorState[];
|
|
35
|
+
}
|
|
36
|
+
export declare class HashAggregateOperator {
|
|
37
|
+
groupByExtractors: CompiledExpr[];
|
|
38
|
+
groupByTypes: DataType[];
|
|
39
|
+
aggregateDefs: AggregateDef[];
|
|
40
|
+
hasCachedValues: boolean;
|
|
41
|
+
groups: Map<GroupKey, GroupState>;
|
|
42
|
+
groupKeys: GroupKey[];
|
|
43
|
+
constructor(groupByExtractors: CompiledExpr[], groupByTypes: DataType[], aggregateDefs: AggregateDef[]);
|
|
44
|
+
init(): Promise<void>;
|
|
45
|
+
consume(chunk: DataChunk): Promise<void>;
|
|
46
|
+
finalize(): Promise<DataChunk[]>;
|
|
47
|
+
exportPartials(partitionCount: number): PartialGroup[][];
|
|
48
|
+
absorbPartials(partials: PartialGroup[]): void;
|
|
49
|
+
_tryWasmUngrouped(chunk: DataChunk): Promise<boolean>;
|
|
50
|
+
}
|
|
51
|
+
export declare const GLOBAL_GROUP_KEY = "__ALL__";
|
|
52
|
+
export declare function hashGroupKey(key: GroupKey): number;
|
|
53
|
+
export declare class SumAccumulator implements Accumulator {
|
|
54
|
+
sum: number;
|
|
55
|
+
hasValue: boolean;
|
|
56
|
+
constructor();
|
|
57
|
+
add(val: EvalValue): void;
|
|
58
|
+
result(): ColumnValue;
|
|
59
|
+
exportState(): ColumnValue;
|
|
60
|
+
mergeState(state: number | null): void;
|
|
61
|
+
}
|
|
62
|
+
export declare class CountAccumulator implements Accumulator {
|
|
63
|
+
count: number;
|
|
64
|
+
constructor();
|
|
65
|
+
add(val: EvalValue): void;
|
|
66
|
+
result(): ColumnValue;
|
|
67
|
+
exportState(): ColumnValue;
|
|
68
|
+
mergeState(state: number): void;
|
|
69
|
+
}
|
|
70
|
+
export declare class CountStarAccumulator implements Accumulator {
|
|
71
|
+
count: number;
|
|
72
|
+
constructor();
|
|
73
|
+
add(): void;
|
|
74
|
+
result(): ColumnValue;
|
|
75
|
+
exportState(): ColumnValue;
|
|
76
|
+
mergeState(state: number): void;
|
|
77
|
+
}
|
|
78
|
+
export declare class AvgAccumulator implements Accumulator {
|
|
79
|
+
sum: number;
|
|
80
|
+
count: number;
|
|
81
|
+
constructor();
|
|
82
|
+
add(val: EvalValue): void;
|
|
83
|
+
result(): ColumnValue;
|
|
84
|
+
exportState(): AvgState;
|
|
85
|
+
mergeState(state: AvgState): void;
|
|
86
|
+
}
|
|
87
|
+
export declare class AvgFinalAccumulator implements Accumulator {
|
|
88
|
+
sum: number;
|
|
89
|
+
count: number;
|
|
90
|
+
constructor();
|
|
91
|
+
add(pair: EvalValue | ColumnValue[]): void;
|
|
92
|
+
result(): ColumnValue;
|
|
93
|
+
exportState(): AvgState;
|
|
94
|
+
mergeState(state: AvgState): void;
|
|
95
|
+
}
|
|
96
|
+
export declare class MinAccumulator implements Accumulator {
|
|
97
|
+
min: ColumnValue;
|
|
98
|
+
constructor();
|
|
99
|
+
add(val: EvalValue): void;
|
|
100
|
+
result(): ColumnValue;
|
|
101
|
+
exportState(): ColumnValue;
|
|
102
|
+
mergeState(state: ColumnValue): void;
|
|
103
|
+
}
|
|
104
|
+
export declare class MaxAccumulator implements Accumulator {
|
|
105
|
+
max: ColumnValue;
|
|
106
|
+
constructor();
|
|
107
|
+
add(val: EvalValue): void;
|
|
108
|
+
result(): ColumnValue;
|
|
109
|
+
exportState(): ColumnValue;
|
|
110
|
+
mergeState(state: ColumnValue): void;
|
|
111
|
+
}
|
|
112
|
+
export declare class CountDistinctAccumulator implements Accumulator {
|
|
113
|
+
values: Set<ColumnValue>;
|
|
114
|
+
constructor();
|
|
115
|
+
add(val: EvalValue): void;
|
|
116
|
+
result(): ColumnValue;
|
|
117
|
+
exportState(): ColumnValue[];
|
|
118
|
+
mergeState(state: ColumnValue[]): void;
|
|
119
|
+
}
|
|
120
|
+
export declare function getAccumulatorFactory(name: string, distinct?: boolean): () => Accumulator;
|
|
121
|
+
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { DataChunk } from '../../storage/chunk.js';
|
|
2
|
+
import { JoinType } from '../../planner/logical-plan.js';
|
|
3
|
+
import type { DataType, ColumnValue } from '../../storage/data-type.js';
|
|
4
|
+
import type { CompiledExpr } from '../execution-types.js';
|
|
5
|
+
type JoinKey = ColumnValue;
|
|
6
|
+
interface BuildItem {
|
|
7
|
+
row: ColumnValue[];
|
|
8
|
+
pIdx?: number;
|
|
9
|
+
rIdx?: number;
|
|
10
|
+
}
|
|
11
|
+
interface PartitionRow {
|
|
12
|
+
row: ColumnValue[];
|
|
13
|
+
key: JoinKey;
|
|
14
|
+
}
|
|
15
|
+
interface BuildPartition {
|
|
16
|
+
rows: PartitionRow[];
|
|
17
|
+
spilled: boolean;
|
|
18
|
+
}
|
|
19
|
+
interface ProbeItem {
|
|
20
|
+
row: ColumnValue[];
|
|
21
|
+
key: JoinKey;
|
|
22
|
+
}
|
|
23
|
+
interface SpillManagerLike {
|
|
24
|
+
appendChunk(id: string, chunk: DataChunk | null): Promise<void>;
|
|
25
|
+
readChunks(id: string): AsyncGenerator<DataChunk>;
|
|
26
|
+
clearAll(): Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
interface JoinSink {
|
|
29
|
+
consume(chunk: DataChunk): Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
export declare class HashJoinBuild {
|
|
32
|
+
keyExtractors: CompiledExpr[];
|
|
33
|
+
joinType: JoinType;
|
|
34
|
+
uniqueKeys: boolean;
|
|
35
|
+
buildPreserved: boolean;
|
|
36
|
+
hashTable: Map<JoinKey, BuildItem[]>;
|
|
37
|
+
buildSchema: DataType[] | null;
|
|
38
|
+
hasNullKey: boolean;
|
|
39
|
+
nullKeyRows: ColumnValue[][];
|
|
40
|
+
spillManager: SpillManagerLike;
|
|
41
|
+
partitions: BuildPartition[];
|
|
42
|
+
totalRowsInRAM: number;
|
|
43
|
+
matchedSet: Set<string>;
|
|
44
|
+
constructor(keyExtractors: CompiledExpr[], joinType: JoinType, uniqueKeys: boolean, spillManager: SpillManagerLike, buildPreserved?: boolean);
|
|
45
|
+
init(): Promise<void>;
|
|
46
|
+
consume(chunk: DataChunk): Promise<void>;
|
|
47
|
+
flushPartition(pIdx: number): Promise<void>;
|
|
48
|
+
rowsToChunk(rows: ColumnValue[][]): DataChunk;
|
|
49
|
+
finalize(): Promise<void>;
|
|
50
|
+
markMatched(packed: BuildItem): void;
|
|
51
|
+
emitUnmatched(probeColCount: number): ColumnValue[][];
|
|
52
|
+
probe(key: JoinKey): BuildItem[] | null;
|
|
53
|
+
buildKey(chunk: DataChunk, rowIdx: number): JoinKey | null;
|
|
54
|
+
}
|
|
55
|
+
export declare class HashJoinProbe {
|
|
56
|
+
buildSide: HashJoinBuild;
|
|
57
|
+
probeKeyExtractors: CompiledExpr[];
|
|
58
|
+
buildColCount: number;
|
|
59
|
+
probeColCount: number;
|
|
60
|
+
joinType: JoinType;
|
|
61
|
+
conditionEvaluator: CompiledExpr | null;
|
|
62
|
+
spillBuffers: ProbeItem[][];
|
|
63
|
+
probeSchema: DataType[] | null;
|
|
64
|
+
constructor(buildSide: HashJoinBuild, probeKeyExtractors: CompiledExpr[], buildColCount: number, probeColCount: number, joinType?: JoinType, conditionEvaluator?: CompiledExpr | null);
|
|
65
|
+
init(): Promise<void>;
|
|
66
|
+
process(probeChunk: DataChunk): Promise<DataChunk | null>;
|
|
67
|
+
flushProbePartition(pIdx: number): Promise<void>;
|
|
68
|
+
rowsToProbeChunk(rows: ColumnValue[][]): DataChunk;
|
|
69
|
+
executeInMemoryJoin(probeItems: ProbeItem[]): DataChunk;
|
|
70
|
+
finalize(sink: JoinSink): Promise<void>;
|
|
71
|
+
extractProbeKey(chunk: DataChunk, rowIdx: number): JoinKey | null;
|
|
72
|
+
buildOutputChunk(rows: ColumnValue[][]): DataChunk;
|
|
73
|
+
}
|
|
74
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { DataChunk } from '../../storage/chunk.js';
|
|
2
|
+
import type { ColumnValue } from '../../storage/data-type.js';
|
|
3
|
+
import type { ExecSchema } from '../execution-types.js';
|
|
4
|
+
type IndexScanKey = string | number | bigint | boolean | null | undefined;
|
|
5
|
+
interface RowLocationLike {
|
|
6
|
+
pageId: string;
|
|
7
|
+
rowIndex: number;
|
|
8
|
+
}
|
|
9
|
+
interface BTreeLike {
|
|
10
|
+
search(key: IndexScanKey): RowLocationLike[];
|
|
11
|
+
range(low: IndexScanKey, high: IndexScanKey, lowInclusive: boolean, highInclusive: boolean): Generator<RowLocationLike>;
|
|
12
|
+
}
|
|
13
|
+
interface BufferPoolLike {
|
|
14
|
+
fetchPage(pageId: string, bypassCache: boolean): Promise<DataChunk | null>;
|
|
15
|
+
}
|
|
16
|
+
interface IndexTableLike {
|
|
17
|
+
bufferPool: BufferPoolLike;
|
|
18
|
+
getSchema(): ExecSchema;
|
|
19
|
+
}
|
|
20
|
+
export declare class IndexScanOperator {
|
|
21
|
+
btreeIndex: BTreeLike;
|
|
22
|
+
table: IndexTableLike;
|
|
23
|
+
scanType: string;
|
|
24
|
+
scanKey: IndexScanKey;
|
|
25
|
+
scanLow: IndexScanKey;
|
|
26
|
+
scanHigh: IndexScanKey;
|
|
27
|
+
lowInc: boolean;
|
|
28
|
+
highInc: boolean;
|
|
29
|
+
projectedColumns: number[] | null;
|
|
30
|
+
constructor(btreeIndex: BTreeLike, table: IndexTableLike, scanType: string, scanKey: IndexScanKey, scanLow: IndexScanKey, scanHigh: IndexScanKey, lowInc: boolean, highInc: boolean, projectedColumns: number[] | null);
|
|
31
|
+
scan(): AsyncGenerator<DataChunk>;
|
|
32
|
+
_buildChunk(rows: ColumnValue[][], schema: ExecSchema): DataChunk;
|
|
33
|
+
}
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { DataType, ColumnValue } from '../../storage/data-type.js';
|
|
2
|
+
import { DataChunk } from '../../storage/chunk.js';
|
|
3
|
+
import { JoinType } from '../../planner/logical-plan.js';
|
|
4
|
+
import type { Allocator } from '../../storage/sab-arena.js';
|
|
5
|
+
import type { CompiledExpr, EvalValue } from '../execution-types.js';
|
|
6
|
+
type JoinKey = ColumnValue;
|
|
7
|
+
type JoinRow = ColumnValue[];
|
|
8
|
+
interface RowAdapterColumn {
|
|
9
|
+
get(): ColumnValue;
|
|
10
|
+
}
|
|
11
|
+
interface RowAdapter {
|
|
12
|
+
row: JoinRow | null;
|
|
13
|
+
columns: RowAdapterColumn[];
|
|
14
|
+
setRow(r: JoinRow): void;
|
|
15
|
+
}
|
|
16
|
+
type ConditionEvaluator = (adapter: RowAdapter, rowIdx: number) => EvalValue;
|
|
17
|
+
interface BuildItem {
|
|
18
|
+
row: JoinRow;
|
|
19
|
+
}
|
|
20
|
+
interface ProbeItem {
|
|
21
|
+
row: JoinRow;
|
|
22
|
+
key: JoinKey;
|
|
23
|
+
}
|
|
24
|
+
interface ProbeOpts {
|
|
25
|
+
joinType: JoinType;
|
|
26
|
+
buildColCount: number;
|
|
27
|
+
probeColCount: number;
|
|
28
|
+
conditionEvaluator: ConditionEvaluator | null;
|
|
29
|
+
hasNullKey: boolean;
|
|
30
|
+
onMatched: ((item: BuildItem) => void) | null;
|
|
31
|
+
}
|
|
32
|
+
interface BuildChunkOpts {
|
|
33
|
+
joinType: JoinType;
|
|
34
|
+
buildColCount: number;
|
|
35
|
+
buildSchema?: (DataType | string)[];
|
|
36
|
+
probeSchema?: (DataType | string)[];
|
|
37
|
+
}
|
|
38
|
+
export declare function joinKeyOf(extractors: CompiledExpr[], chunk: DataChunk, rowIdx: number): JoinKey;
|
|
39
|
+
export declare function joinKeyHash(key: JoinKey): number;
|
|
40
|
+
export declare function createCombinedRowAdapter(totalCols: number): RowAdapter;
|
|
41
|
+
export declare function probeJoinRows(items: Iterable<ProbeItem>, lookup: (key: JoinKey) => BuildItem[] | null, opts: ProbeOpts): JoinRow[];
|
|
42
|
+
export declare function emitsOnUnmatchedProbe(joinType: JoinType): boolean;
|
|
43
|
+
export declare function emitsUnmatchedBuild(joinType: JoinType): boolean;
|
|
44
|
+
export declare function buildJoinOutputChunk(rows: JoinRow[], { joinType, buildColCount, buildSchema, probeSchema }: BuildChunkOpts, allocator?: Allocator): DataChunk;
|
|
45
|
+
export declare function materializeRow(chunk: DataChunk, rowIdx: number): JoinRow;
|
|
46
|
+
export declare function materializeActiveRow(chunk: DataChunk, i: number): JoinRow;
|
|
47
|
+
export {};
|