@quereus/quereus 0.6.2 → 0.6.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/README.md +1 -1
- package/dist/src/index.d.ts +4 -6
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -4
- package/dist/src/index.js.map +1 -1
- package/dist/src/runtime/emit/schema-declarative.js +1 -1
- package/dist/src/runtime/emit/schema-declarative.js.map +1 -1
- package/dist/src/schema/schema-hasher.d.ts +3 -3
- package/dist/src/schema/schema-hasher.d.ts.map +1 -1
- package/dist/src/schema/schema-hasher.js +9 -27
- package/dist/src/schema/schema-hasher.js.map +1 -1
- package/dist/src/util/hash.d.ts +19 -0
- package/dist/src/util/hash.d.ts.map +1 -0
- package/dist/src/util/hash.js +76 -0
- package/dist/src/util/hash.js.map +1 -0
- package/dist/src/util/plugin-helper.d.ts +45 -0
- package/dist/src/util/plugin-helper.d.ts.map +1 -0
- package/dist/src/util/plugin-helper.js +85 -0
- package/dist/src/util/plugin-helper.js.map +1 -0
- package/package.json +4 -2
- package/src/index.ts +10 -16
- package/src/planner/building/delete.ts +214 -214
- package/src/planner/building/insert.ts +428 -428
- package/src/planner/building/update.ts +319 -319
- package/src/runtime/emit/schema-declarative.ts +1 -1
- package/src/schema/schema-hasher.ts +9 -27
- package/src/util/ast-stringify.ts +864 -864
- package/src/util/hash.ts +90 -0
- package/src/util/plugin-helper.ts +110 -0
- package/src/vtab/memory/table.ts +256 -256
- package/src/vtab/table.ts +162 -162
- package/dist/src/config/loader.d.ts +0 -41
- package/dist/src/config/loader.d.ts.map +0 -1
- package/dist/src/config/loader.js +0 -102
- package/dist/src/config/loader.js.map +0 -1
- package/dist/src/planner/nodes/physical-access-nodes.d.ts +0 -83
- package/dist/src/planner/nodes/physical-access-nodes.d.ts.map +0 -1
- package/dist/src/planner/nodes/physical-access-nodes.js +0 -226
- package/dist/src/planner/nodes/physical-access-nodes.js.map +0 -1
- package/dist/src/planner/nodes/scan.d.ts +0 -27
- package/dist/src/planner/nodes/scan.d.ts.map +0 -1
- package/dist/src/planner/nodes/scan.js +0 -78
- package/dist/src/planner/nodes/scan.js.map +0 -1
- package/dist/src/planner/nodes/update-executor-node.d.ts +0 -24
- package/dist/src/planner/nodes/update-executor-node.d.ts.map +0 -1
- package/dist/src/planner/nodes/update-executor-node.js +0 -57
- package/dist/src/planner/nodes/update-executor-node.js.map +0 -1
- package/dist/src/planner/physical-utils.d.ts +0 -36
- package/dist/src/planner/physical-utils.d.ts.map +0 -1
- package/dist/src/planner/physical-utils.js +0 -122
- package/dist/src/planner/physical-utils.js.map +0 -1
- package/dist/src/planner/rules/physical/rule-filter-optimization.d.ts +0 -11
- package/dist/src/planner/rules/physical/rule-filter-optimization.d.ts.map +0 -1
- package/dist/src/planner/rules/physical/rule-filter-optimization.js +0 -49
- package/dist/src/planner/rules/physical/rule-filter-optimization.js.map +0 -1
- package/dist/src/planner/rules/physical/rule-mark-physical.d.ts +0 -11
- package/dist/src/planner/rules/physical/rule-mark-physical.d.ts.map +0 -1
- package/dist/src/planner/rules/physical/rule-mark-physical.js +0 -29
- package/dist/src/planner/rules/physical/rule-mark-physical.js.map +0 -1
- package/dist/src/planner/rules/physical/rule-project-optimization.d.ts +0 -11
- package/dist/src/planner/rules/physical/rule-project-optimization.d.ts.map +0 -1
- package/dist/src/planner/rules/physical/rule-project-optimization.js +0 -44
- package/dist/src/planner/rules/physical/rule-project-optimization.js.map +0 -1
- package/dist/src/planner/rules/physical/rule-sort-optimization.d.ts +0 -11
- package/dist/src/planner/rules/physical/rule-sort-optimization.d.ts.map +0 -1
- package/dist/src/planner/rules/physical/rule-sort-optimization.js +0 -53
- package/dist/src/planner/rules/physical/rule-sort-optimization.js.map +0 -1
- package/dist/src/planner/rules/rewrite/rule-constant-folding.d.ts +0 -11
- package/dist/src/planner/rules/rewrite/rule-constant-folding.d.ts.map +0 -1
- package/dist/src/planner/rules/rewrite/rule-constant-folding.js +0 -59
- package/dist/src/planner/rules/rewrite/rule-constant-folding.js.map +0 -1
- package/dist/src/planner/util/deferred-constraint.d.ts +0 -14
- package/dist/src/planner/util/deferred-constraint.d.ts.map +0 -1
- package/dist/src/planner/util/deferred-constraint.js +0 -85
- package/dist/src/planner/util/deferred-constraint.js.map +0 -1
- package/dist/src/runtime/emit/table-reference.d.ts +0 -5
- package/dist/src/runtime/emit/table-reference.d.ts.map +0 -1
- package/dist/src/runtime/emit/table-reference.js +0 -67
- package/dist/src/runtime/emit/table-reference.js.map +0 -1
- package/dist/src/runtime/emit/update-executor.d.ts +0 -5
- package/dist/src/runtime/emit/update-executor.d.ts.map +0 -1
- package/dist/src/runtime/emit/update-executor.js +0 -54
- package/dist/src/runtime/emit/update-executor.js.map +0 -1
- package/dist/src/util/plugin-loader.d.ts +0 -52
- package/dist/src/util/plugin-loader.d.ts.map +0 -1
- package/dist/src/util/plugin-loader.js +0 -307
- package/dist/src/util/plugin-loader.js.map +0 -1
- package/src/config/loader.ts +0 -140
- package/src/util/plugin-loader.ts +0 -387
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Physical table access nodes for seek and range scan operations
|
|
3
|
-
* These replace logical TableScanNode during optimization
|
|
4
|
-
*/
|
|
5
|
-
import { PlanNodeType } from './plan-node-type.js';
|
|
6
|
-
import { PlanNode } from './plan-node.js';
|
|
7
|
-
import { TableReferenceNode } from './reference.js';
|
|
8
|
-
import { Cached } from '../../util/cached.js';
|
|
9
|
-
/**
|
|
10
|
-
* Base class for physical table access operations
|
|
11
|
-
* Provides common functionality for sequential scan, index scan, and index seek
|
|
12
|
-
*/
|
|
13
|
-
export class PhysicalTableAccessNode extends PlanNode {
|
|
14
|
-
source;
|
|
15
|
-
filterInfo;
|
|
16
|
-
attributesCache;
|
|
17
|
-
outputType;
|
|
18
|
-
constructor(scope, source, filterInfo, estimatedCostOverride) {
|
|
19
|
-
super(scope, estimatedCostOverride ?? filterInfo.indexInfoOutput.estimatedCost);
|
|
20
|
-
this.source = source;
|
|
21
|
-
this.filterInfo = filterInfo;
|
|
22
|
-
this.attributesCache = new Cached(() => this.source.getAttributes());
|
|
23
|
-
this.outputType = new Cached(() => this.source.getType());
|
|
24
|
-
}
|
|
25
|
-
getAttributes() {
|
|
26
|
-
return this.attributesCache.value;
|
|
27
|
-
}
|
|
28
|
-
getType() {
|
|
29
|
-
return this.outputType.value;
|
|
30
|
-
}
|
|
31
|
-
getChildren() {
|
|
32
|
-
return [this.source];
|
|
33
|
-
}
|
|
34
|
-
getRelations() {
|
|
35
|
-
return [this.source];
|
|
36
|
-
}
|
|
37
|
-
withChildren(newChildren) {
|
|
38
|
-
if (newChildren.length !== 1) {
|
|
39
|
-
throw new Error(`${this.nodeType} expects 1 child, got ${newChildren.length}`);
|
|
40
|
-
}
|
|
41
|
-
const [newSource] = newChildren;
|
|
42
|
-
// Type check - Physical access nodes specifically need a TableReferenceNode
|
|
43
|
-
if (!(newSource instanceof TableReferenceNode)) {
|
|
44
|
-
throw new Error(`${this.nodeType}: child must be a TableReferenceNode`);
|
|
45
|
-
}
|
|
46
|
-
// Return same instance if nothing changed
|
|
47
|
-
if (newSource === this.source) {
|
|
48
|
-
return this;
|
|
49
|
-
}
|
|
50
|
-
// Subclasses must override this with their specific constructor
|
|
51
|
-
throw new Error(`${this.nodeType} must override withChildren method`);
|
|
52
|
-
}
|
|
53
|
-
getLogicalAttributes() {
|
|
54
|
-
return {
|
|
55
|
-
table: this.source.tableSchema.name,
|
|
56
|
-
schema: this.source.tableSchema.schemaName,
|
|
57
|
-
accessMethod: this.nodeType,
|
|
58
|
-
filterInfo: {
|
|
59
|
-
usableIndex: this.filterInfo.indexInfoOutput.idxStr,
|
|
60
|
-
matchedClauses: this.filterInfo.indexInfoOutput.aConstraintUsage?.length || 0,
|
|
61
|
-
estimatedCost: this.filterInfo.indexInfoOutput.estimatedCost,
|
|
62
|
-
estimatedRows: this.filterInfo.indexInfoOutput.estimatedRows
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Sequential scan - reads entire table without using indexes
|
|
69
|
-
* Used when no suitable index exists or for small tables
|
|
70
|
-
*/
|
|
71
|
-
export class SeqScanNode extends PhysicalTableAccessNode {
|
|
72
|
-
nodeType = PlanNodeType.SeqScan;
|
|
73
|
-
computePhysical() {
|
|
74
|
-
return {
|
|
75
|
-
estimatedRows: this.source.estimatedRows,
|
|
76
|
-
uniqueKeys: this.source.getType().keys.map(key => key.map(colRef => colRef.index)),
|
|
77
|
-
// Sequential scans don't provide any specific ordering
|
|
78
|
-
ordering: undefined
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
toString() {
|
|
82
|
-
return `SEQ SCAN ${this.source.tableSchema.name}`;
|
|
83
|
-
}
|
|
84
|
-
withChildren(newChildren) {
|
|
85
|
-
if (newChildren.length !== 1) {
|
|
86
|
-
throw new Error(`SeqScanNode expects 1 child, got ${newChildren.length}`);
|
|
87
|
-
}
|
|
88
|
-
const [newSource] = newChildren;
|
|
89
|
-
// Type check - Physical access nodes specifically need a TableReferenceNode
|
|
90
|
-
if (!(newSource instanceof TableReferenceNode)) {
|
|
91
|
-
throw new Error('SeqScanNode: child must be a TableReferenceNode');
|
|
92
|
-
}
|
|
93
|
-
// Return same instance if nothing changed
|
|
94
|
-
if (newSource === this.source) {
|
|
95
|
-
return this;
|
|
96
|
-
}
|
|
97
|
-
// Create new instance
|
|
98
|
-
return new SeqScanNode(this.scope, newSource, this.filterInfo);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Index scan - uses an index to read table data in order
|
|
103
|
-
* Provides ordering and can handle range queries efficiently
|
|
104
|
-
*/
|
|
105
|
-
export class IndexScanNode extends PhysicalTableAccessNode {
|
|
106
|
-
indexName;
|
|
107
|
-
providesOrdering;
|
|
108
|
-
nodeType = PlanNodeType.IndexScan;
|
|
109
|
-
constructor(scope, source, filterInfo, indexName, providesOrdering, estimatedCostOverride) {
|
|
110
|
-
super(scope, source, filterInfo, estimatedCostOverride);
|
|
111
|
-
this.indexName = indexName;
|
|
112
|
-
this.providesOrdering = providesOrdering;
|
|
113
|
-
}
|
|
114
|
-
computePhysical() {
|
|
115
|
-
return {
|
|
116
|
-
estimatedRows: this.source.estimatedRows,
|
|
117
|
-
uniqueKeys: this.source.getType().keys.map(key => key.map(colRef => colRef.index)),
|
|
118
|
-
// Index scans can provide ordering
|
|
119
|
-
ordering: this.providesOrdering
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
toString() {
|
|
123
|
-
const orderDesc = this.providesOrdering
|
|
124
|
-
? ` ORDER BY ${this.providesOrdering.map(o => `${o.column}${o.desc ? ' DESC' : ''}`).join(', ')}`
|
|
125
|
-
: '';
|
|
126
|
-
return `INDEX SCAN ${this.source.tableSchema.name} USING ${this.indexName}${orderDesc}`;
|
|
127
|
-
}
|
|
128
|
-
getLogicalAttributes() {
|
|
129
|
-
return {
|
|
130
|
-
...super.getLogicalAttributes(),
|
|
131
|
-
indexName: this.indexName,
|
|
132
|
-
providesOrdering: this.providesOrdering
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
withChildren(newChildren) {
|
|
136
|
-
if (newChildren.length !== 1) {
|
|
137
|
-
throw new Error(`IndexScanNode expects 1 child, got ${newChildren.length}`);
|
|
138
|
-
}
|
|
139
|
-
const [newSource] = newChildren;
|
|
140
|
-
// Type check - Physical access nodes specifically need a TableReferenceNode
|
|
141
|
-
if (!(newSource instanceof TableReferenceNode)) {
|
|
142
|
-
throw new Error('IndexScanNode: child must be a TableReferenceNode');
|
|
143
|
-
}
|
|
144
|
-
// Return same instance if nothing changed
|
|
145
|
-
if (newSource === this.source) {
|
|
146
|
-
return this;
|
|
147
|
-
}
|
|
148
|
-
// Create new instance
|
|
149
|
-
return new IndexScanNode(this.scope, newSource, this.filterInfo, this.indexName, this.providesOrdering);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Index seek - point lookup or tight range using an index
|
|
154
|
-
* Very efficient for equality constraints and small ranges
|
|
155
|
-
*/
|
|
156
|
-
export class IndexSeekNode extends PhysicalTableAccessNode {
|
|
157
|
-
indexName;
|
|
158
|
-
seekKeys;
|
|
159
|
-
isRange;
|
|
160
|
-
providesOrdering;
|
|
161
|
-
nodeType = PlanNodeType.IndexSeek;
|
|
162
|
-
constructor(scope, source, filterInfo, indexName, seekKeys, isRange = false, providesOrdering, estimatedCostOverride) {
|
|
163
|
-
super(scope, source, filterInfo, estimatedCostOverride);
|
|
164
|
-
this.indexName = indexName;
|
|
165
|
-
this.seekKeys = seekKeys;
|
|
166
|
-
this.isRange = isRange;
|
|
167
|
-
this.providesOrdering = providesOrdering;
|
|
168
|
-
}
|
|
169
|
-
computePhysical() {
|
|
170
|
-
return {
|
|
171
|
-
uniqueKeys: this.source.getType().keys.map(key => key.map(colRef => colRef.index)),
|
|
172
|
-
// Index seeks can provide ordering and usually return few rows
|
|
173
|
-
ordering: this.providesOrdering,
|
|
174
|
-
// Seeks typically return much fewer rows than estimated
|
|
175
|
-
estimatedRows: Math.min(this.source.estimatedRows || 1000, 100)
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
toString() {
|
|
179
|
-
const seekDesc = this.isRange ? 'RANGE' : 'SEEK';
|
|
180
|
-
const orderDesc = this.providesOrdering
|
|
181
|
-
? ` ORDER BY ${this.providesOrdering.map(o => `${o.column}${o.desc ? ' DESC' : ''}`).join(', ')}`
|
|
182
|
-
: '';
|
|
183
|
-
return `INDEX ${seekDesc} ${this.source.tableSchema.name} USING ${this.indexName}${orderDesc}`;
|
|
184
|
-
}
|
|
185
|
-
getLogicalAttributes() {
|
|
186
|
-
return {
|
|
187
|
-
...super.getLogicalAttributes(),
|
|
188
|
-
indexName: this.indexName,
|
|
189
|
-
seekKeys: this.seekKeys.map(key => key.toString()),
|
|
190
|
-
isRange: this.isRange,
|
|
191
|
-
providesOrdering: this.providesOrdering
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
getSeekKeys() {
|
|
195
|
-
return this.seekKeys;
|
|
196
|
-
}
|
|
197
|
-
getChildren() {
|
|
198
|
-
return [this.source, ...this.seekKeys];
|
|
199
|
-
}
|
|
200
|
-
withChildren(newChildren) {
|
|
201
|
-
const expectedLength = 1 + this.seekKeys.length;
|
|
202
|
-
if (newChildren.length !== expectedLength) {
|
|
203
|
-
throw new Error(`IndexSeekNode expects ${expectedLength} children, got ${newChildren.length}`);
|
|
204
|
-
}
|
|
205
|
-
const [newSource, ...newSeekKeys] = newChildren;
|
|
206
|
-
// Type check - Physical access nodes specifically need a TableReferenceNode
|
|
207
|
-
if (!(newSource instanceof TableReferenceNode)) {
|
|
208
|
-
throw new Error('IndexSeekNode: first child must be a TableReferenceNode');
|
|
209
|
-
}
|
|
210
|
-
// Type check seek keys
|
|
211
|
-
for (const seekKey of newSeekKeys) {
|
|
212
|
-
if (!('expression' in seekKey)) {
|
|
213
|
-
throw new Error('IndexSeekNode: seek keys must be ScalarPlanNodes');
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
// Check if anything changed
|
|
217
|
-
const sourceChanged = newSource !== this.source;
|
|
218
|
-
const seekKeysChanged = newSeekKeys.some((key, i) => key !== this.seekKeys[i]);
|
|
219
|
-
if (!sourceChanged && !seekKeysChanged) {
|
|
220
|
-
return this;
|
|
221
|
-
}
|
|
222
|
-
// Create new instance
|
|
223
|
-
return new IndexSeekNode(this.scope, newSource, this.filterInfo, this.indexName, newSeekKeys, this.isRange, this.providesOrdering);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
//# sourceMappingURL=physical-access-nodes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"physical-access-nodes.js","sourceRoot":"","sources":["../../../../src/planner/nodes/physical-access-nodes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,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AAI,CAAC,CAAC,SAAS,YAAY,kBAAkB,CAAC,EAAE,CAAC;YAChD,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;QAC5E,CAAC;QAED,uBAAuB;QACvB,KAAK,MAAM,OAAO,IAAI,WAAW,EAAE,CAAC;YACnC,IAAI,CAAC,CAAC,YAAY,IAAI,OAAO,CAAC,EAAE,CAAC;gBAChC,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;YACrE,CAAC;QACF,CAAC;QAED,4BAA4B;QAC5B,MAAM,aAAa,GAAG,SAAS,KAAK,IAAI,CAAC,MAAM,CAAC;QAChD,MAAM,eAAe,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;QAE/E,IAAI,CAAC,aAAa,IAAI,CAAC,eAAe,EAAE,CAAC;YACxC,OAAO,IAAI,CAAC;QACb,CAAC;QAED,sBAAsB;QACtB,OAAO,IAAI,aAAa,CACvB,IAAI,CAAC,KAAK,EACV,SAAS,EACT,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,SAAS,EACd,WAA+B,EAC/B,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,gBAAgB,CACrB,CAAC;IACH,CAAC;CACD"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { PlanNodeType } from './plan-node-type.js';
|
|
2
|
-
import { PlanNode, type UnaryRelationalNode, type PhysicalProperties, type Attribute } from './plan-node.js';
|
|
3
|
-
import { TableReferenceNode } from './reference.js';
|
|
4
|
-
import type { RelationType } from '../../common/datatype.js';
|
|
5
|
-
import type { Scope } from '../scopes/scope.js';
|
|
6
|
-
import type { FilterInfo } from '../../vtab/filter-info.js';
|
|
7
|
-
/**
|
|
8
|
-
* Represents a table scan operation (full or filtered).
|
|
9
|
-
* This is a physical node that accesses actual table data.
|
|
10
|
-
*/
|
|
11
|
-
export declare class TableScanNode extends PlanNode implements UnaryRelationalNode {
|
|
12
|
-
readonly source: TableReferenceNode;
|
|
13
|
-
readonly filterInfo: FilterInfo;
|
|
14
|
-
readonly nodeType = PlanNodeType.TableScan;
|
|
15
|
-
private outputType;
|
|
16
|
-
constructor(scope: Scope, source: TableReferenceNode, filterInfo: FilterInfo, estimatedCostOverride?: number);
|
|
17
|
-
getType(): RelationType;
|
|
18
|
-
getAttributes(): Attribute[];
|
|
19
|
-
getChildren(): readonly [TableReferenceNode];
|
|
20
|
-
getRelations(): readonly [TableReferenceNode];
|
|
21
|
-
withChildren(newChildren: readonly PlanNode[]): PlanNode;
|
|
22
|
-
get estimatedRows(): number | undefined;
|
|
23
|
-
computePhysical(): Partial<PhysicalProperties>;
|
|
24
|
-
toString(): string;
|
|
25
|
-
getLogicalAttributes(): Record<string, unknown>;
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=scan.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../../../../src/planner/nodes/scan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,KAAK,mBAAmB,EAAE,KAAK,kBAAkB,EAAE,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC7G,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAI5D;;;GAGG;AACH,qBAAa,aAAc,SAAQ,QAAS,YAAW,mBAAmB;aAOxD,MAAM,EAAE,kBAAkB;aAC1B,UAAU,EAAE,UAAU;IAPvC,SAAkB,QAAQ,0BAA0B;IAEpD,OAAO,CAAC,UAAU,CAAuB;gBAGxC,KAAK,EAAE,KAAK,EACI,MAAM,EAAE,kBAAkB,EAC1B,UAAU,EAAE,UAAU,EACtC,qBAAqB,CAAC,EAAE,MAAM;IAO/B,OAAO,IAAI,YAAY;IAIvB,aAAa,IAAI,SAAS,EAAE;IAK5B,WAAW,IAAI,SAAS,CAAC,kBAAkB,CAAC;IAI5C,YAAY,IAAI,SAAS,CAAC,kBAAkB,CAAC;IAI7C,YAAY,CAAC,WAAW,EAAE,SAAS,QAAQ,EAAE,GAAG,QAAQ;IAyBxD,IAAI,aAAa,IAAI,MAAM,GAAG,SAAS,CAEtC;IAEQ,eAAe,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAU9C,QAAQ,IAAI,MAAM;IAIlB,oBAAoB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAYxD"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { PlanNodeType } from './plan-node-type.js';
|
|
2
|
-
import { PlanNode } from './plan-node.js';
|
|
3
|
-
import { TableReferenceNode } from './reference.js';
|
|
4
|
-
import { Cached } from '../../util/cached.js';
|
|
5
|
-
import { quereusError } from '../../common/errors.js';
|
|
6
|
-
import { StatusCode } from '../../common/types.js';
|
|
7
|
-
/**
|
|
8
|
-
* Represents a table scan operation (full or filtered).
|
|
9
|
-
* This is a physical node that accesses actual table data.
|
|
10
|
-
*/
|
|
11
|
-
export class TableScanNode extends PlanNode {
|
|
12
|
-
source;
|
|
13
|
-
filterInfo;
|
|
14
|
-
nodeType = PlanNodeType.TableScan;
|
|
15
|
-
outputType;
|
|
16
|
-
constructor(scope, source, filterInfo, estimatedCostOverride) {
|
|
17
|
-
super(scope, estimatedCostOverride ?? filterInfo.indexInfoOutput.estimatedCost);
|
|
18
|
-
this.source = source;
|
|
19
|
-
this.filterInfo = filterInfo;
|
|
20
|
-
this.outputType = new Cached(() => this.source.getType());
|
|
21
|
-
}
|
|
22
|
-
getType() {
|
|
23
|
-
return this.outputType.value;
|
|
24
|
-
}
|
|
25
|
-
getAttributes() {
|
|
26
|
-
// Table scans produce the same attributes as their source table reference
|
|
27
|
-
return this.source.getAttributes();
|
|
28
|
-
}
|
|
29
|
-
getChildren() {
|
|
30
|
-
return [this.source];
|
|
31
|
-
}
|
|
32
|
-
getRelations() {
|
|
33
|
-
return [this.source];
|
|
34
|
-
}
|
|
35
|
-
withChildren(newChildren) {
|
|
36
|
-
if (newChildren.length !== 1) {
|
|
37
|
-
quereusError(`TableScanNode expects 1 child, got ${newChildren.length}`, StatusCode.INTERNAL);
|
|
38
|
-
}
|
|
39
|
-
const [newSource] = newChildren;
|
|
40
|
-
// Type check - TableScanNode specifically needs a TableReferenceNode
|
|
41
|
-
if (!(newSource instanceof TableReferenceNode)) {
|
|
42
|
-
quereusError('TableScanNode: child must be a TableReferenceNode', StatusCode.INTERNAL);
|
|
43
|
-
}
|
|
44
|
-
// Return same instance if nothing changed
|
|
45
|
-
if (newSource === this.source) {
|
|
46
|
-
return this;
|
|
47
|
-
}
|
|
48
|
-
// Create new instance preserving attributes (scan preserves table attributes)
|
|
49
|
-
return new TableScanNode(this.scope, newSource, this.filterInfo);
|
|
50
|
-
}
|
|
51
|
-
get estimatedRows() {
|
|
52
|
-
return Number(this.filterInfo.indexInfoOutput.estimatedRows);
|
|
53
|
-
}
|
|
54
|
-
computePhysical() {
|
|
55
|
-
const tableType = this.source.getType();
|
|
56
|
-
return {
|
|
57
|
-
estimatedRows: this.estimatedRows,
|
|
58
|
-
// Table scans preserve the logical keys from the table schema
|
|
59
|
-
uniqueKeys: tableType.keys.map(key => key.map(colRef => colRef.index)),
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
toString() {
|
|
63
|
-
return `SCAN ${this.source.tableSchema.name}`;
|
|
64
|
-
}
|
|
65
|
-
getLogicalAttributes() {
|
|
66
|
-
return {
|
|
67
|
-
table: this.source.tableSchema.name,
|
|
68
|
-
schema: this.source.tableSchema.schemaName,
|
|
69
|
-
filterInfo: {
|
|
70
|
-
usableIndex: this.filterInfo.indexInfoOutput.idxStr,
|
|
71
|
-
matchedClauses: this.filterInfo.indexInfoOutput.aConstraintUsage?.length || 0,
|
|
72
|
-
estimatedCost: this.filterInfo.indexInfoOutput.estimatedCost,
|
|
73
|
-
estimatedRows: this.filterInfo.indexInfoOutput.estimatedRows
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
//# sourceMappingURL=scan.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scan.js","sourceRoot":"","sources":["../../../../src/planner/nodes/scan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAqE,MAAM,gBAAgB,CAAC;AAC7G,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAGpD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD;;;GAGG;AACH,MAAM,OAAO,aAAc,SAAQ,QAAQ;IAOzB;IACA;IAPC,QAAQ,GAAG,YAAY,CAAC,SAAS,CAAC;IAE5C,UAAU,CAAuB;IAEzC,YACC,KAAY,EACI,MAA0B,EAC1B,UAAsB,EACtC,qBAA8B;QAE9B,KAAK,CAAC,KAAK,EAAE,qBAAqB,IAAI,UAAU,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;QAJhE,WAAM,GAAN,MAAM,CAAoB;QAC1B,eAAU,GAAV,UAAU,CAAY;QAKtC,IAAI,CAAC,UAAU,GAAG,IAAI,MAAM,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;IAC3D,CAAC;IAED,OAAO;QACN,OAAO,IAAI,CAAC,U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CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;SACtE,CAAC;IACH,CAAC;IAEQ,QAAQ;QAChB,OAAO,QAAQ,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;IAC/C,CAAC;IAEQ,oBAAoB;QAC5B,OAAO;YACN,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI;YACnC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,UAAU;YAC1C,UAAU,EAAE;gBACX,WAAW,EAAE,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,MAAM;gBACnD,cAAc,EAAE,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,gBAAgB,EAAE,MAAM,IAAI,CAAC;gBAC7E,aAAa,EAAE,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,aAAa;gBAC5D,aAAa,EAAE,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,aAAa;aAC5D;SACD,CAAC;IACH,CAAC;CACD"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { Scope } from '../scopes/scope.js';
|
|
2
|
-
import { PlanNode, type RelationalPlanNode, type Attribute } from './plan-node.js';
|
|
3
|
-
import { PlanNodeType } from './plan-node-type.js';
|
|
4
|
-
import type { TableReferenceNode } from './reference.js';
|
|
5
|
-
import type { RelationType } from '../../common/datatype.js';
|
|
6
|
-
/**
|
|
7
|
-
* Executes actual database updates after constraint validation.
|
|
8
|
-
* This node performs the actual vtab.xUpdate operations and yields the updated rows.
|
|
9
|
-
*/
|
|
10
|
-
export declare class UpdateExecutorNode extends PlanNode implements RelationalPlanNode {
|
|
11
|
-
readonly source: RelationalPlanNode;
|
|
12
|
-
readonly table: TableReferenceNode;
|
|
13
|
-
readonly nodeType = PlanNodeType.UpdateExecutor;
|
|
14
|
-
constructor(scope: Scope, source: RelationalPlanNode, table: TableReferenceNode);
|
|
15
|
-
getType(): RelationType;
|
|
16
|
-
getAttributes(): Attribute[];
|
|
17
|
-
getRelations(): readonly [RelationalPlanNode, TableReferenceNode];
|
|
18
|
-
getChildren(): readonly PlanNode[];
|
|
19
|
-
withChildren(newChildren: readonly PlanNode[]): PlanNode;
|
|
20
|
-
get estimatedRows(): number | undefined;
|
|
21
|
-
toString(): string;
|
|
22
|
-
getLogicalProperties(): Record<string, unknown>;
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=update-executor-node.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-executor-node.d.ts","sourceRoot":"","sources":["../../../../src/planner/nodes/update-executor-node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,KAAK,kBAAkB,EAAE,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,QAAS,YAAW,kBAAkB;aAK1D,MAAM,EAAE,kBAAkB;aAC1B,KAAK,EAAE,kBAAkB;IAL3C,SAAkB,QAAQ,+BAA+B;gBAGvD,KAAK,EAAE,KAAK,EACI,MAAM,EAAE,kBAAkB,EAC1B,KAAK,EAAE,kBAAkB;IAK3C,OAAO,IAAI,YAAY;IAIvB,aAAa,IAAI,SAAS,EAAE;IAI5B,YAAY,IAAI,SAAS,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;IAIjE,WAAW,IAAI,SAAS,QAAQ,EAAE;IAIlC,YAAY,CAAC,WAAW,EAAE,SAAS,QAAQ,EAAE,GAAG,QAAQ;IAyBxD,IAAI,aAAa,IAAI,MAAM,GAAG,SAAS,CAEtC;IAEQ,QAAQ,IAAI,MAAM;IAIlB,oBAAoB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAMzD"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { PlanNode } from './plan-node.js';
|
|
2
|
-
import { PlanNodeType } from './plan-node-type.js';
|
|
3
|
-
/**
|
|
4
|
-
* Executes actual database updates after constraint validation.
|
|
5
|
-
* This node performs the actual vtab.xUpdate operations and yields the updated rows.
|
|
6
|
-
*/
|
|
7
|
-
export class UpdateExecutorNode extends PlanNode {
|
|
8
|
-
source;
|
|
9
|
-
table;
|
|
10
|
-
nodeType = PlanNodeType.UpdateExecutor;
|
|
11
|
-
constructor(scope, source, table) {
|
|
12
|
-
super(scope);
|
|
13
|
-
this.source = source;
|
|
14
|
-
this.table = table;
|
|
15
|
-
}
|
|
16
|
-
getType() {
|
|
17
|
-
return this.source.getType();
|
|
18
|
-
}
|
|
19
|
-
getAttributes() {
|
|
20
|
-
return this.source.getAttributes();
|
|
21
|
-
}
|
|
22
|
-
getRelations() {
|
|
23
|
-
return [this.source, this.table];
|
|
24
|
-
}
|
|
25
|
-
getChildren() {
|
|
26
|
-
return [this.source];
|
|
27
|
-
}
|
|
28
|
-
withChildren(newChildren) {
|
|
29
|
-
if (newChildren.length !== 1) {
|
|
30
|
-
throw new Error(`UpdateExecutorNode expects 1 child, got ${newChildren.length}`);
|
|
31
|
-
}
|
|
32
|
-
const [newSource] = newChildren;
|
|
33
|
-
// Type check
|
|
34
|
-
if (!('getAttributes' in newSource) || typeof newSource.getAttributes !== 'function') {
|
|
35
|
-
throw new Error('UpdateExecutorNode: child must be a RelationalPlanNode');
|
|
36
|
-
}
|
|
37
|
-
// Return same instance if nothing changed
|
|
38
|
-
if (newSource === this.source) {
|
|
39
|
-
return this;
|
|
40
|
-
}
|
|
41
|
-
// Create new instance
|
|
42
|
-
return new UpdateExecutorNode(this.scope, newSource, this.table);
|
|
43
|
-
}
|
|
44
|
-
get estimatedRows() {
|
|
45
|
-
return this.source.estimatedRows;
|
|
46
|
-
}
|
|
47
|
-
toString() {
|
|
48
|
-
return `EXECUTE UPDATE ${this.table.tableSchema.name}`;
|
|
49
|
-
}
|
|
50
|
-
getLogicalProperties() {
|
|
51
|
-
return {
|
|
52
|
-
table: this.table.tableSchema.name,
|
|
53
|
-
schema: this.table.tableSchema.schemaName,
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
//# sourceMappingURL=update-executor-node.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-executor-node.js","sourceRoot":"","sources":["../../../../src/planner/nodes/update-executor-node.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAA2C,MAAM,gBAAgB,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAInD;;;GAGG;AACH,MAAM,OAAO,kBAAmB,SAAQ,QAAQ;IAK5B;IACA;IALA,QAAQ,GAAG,YAAY,CAAC,cAAc,CAAC;IAEzD,YACE,KAAY,EACI,MAA0B,EAC1B,KAAyB;QAEzC,KAAK,CAAC,KAAK,CAAC,CAAC;QAHG,WAAM,GAAN,MAAM,CAAoB;QAC1B,UAAK,GAAL,KAAK,CAAoB;IAG3C,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;IAC/B,CAAC;IAED,aAAa;QACX,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC;IACrC,CAAC;IAED,YAAY;QACV,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;IAED,WAAW;QACT,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACvB,CAAC;IAED,YAAY,CAAC,WAAgC;QAC3C,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CAAC,2CAA2C,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC;QACnF,CAAC;QAED,MAAM,CAAC,SAAS,CAAC,GAAG,WAAW,CAAC;QAEhC,aAAa;QACb,IAAI,CAAC,CAAC,eAAe,IAAI,SAAS,CAAC,IAAI,OAAQ,SAAiB,CAAC,aAAa,KAAK,UAAU,EAAE,CAAC;YAC9F,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;QAC5E,CAAC;QAED,0CAA0C;QAC1C,IAAI,SAAS,KAAK,IAAI,CAAC,MAAM,EAAE,CAAC;YAC9B,OAAO,IAAI,CAAC;QACd,CAAC;QAED,sBAAsB;QACtB,OAAO,IAAI,kBAAkB,CAC3B,IAAI,CAAC,KAAK,EACV,SAA+B,EAC/B,IAAI,CAAC,KAAK,CACX,CAAC;IACJ,CAAC;IAED,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC;IACnC,CAAC;IAEQ,QAAQ;QACf,OAAO,kBAAkB,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;IACzD,CAAC;IAEQ,oBAAoB;QAC3B,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI;YAClC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,UAAU;SAC1C,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Physical property utilities for the Titan optimizer
|
|
3
|
-
* Provides helpers for handling ordering, unique keys, and property propagation
|
|
4
|
-
*/
|
|
5
|
-
import type { PhysicalProperties } from './nodes/plan-node.js';
|
|
6
|
-
/**
|
|
7
|
-
* Ordering specification for a column
|
|
8
|
-
*/
|
|
9
|
-
export interface Ordering {
|
|
10
|
-
/** Column index */
|
|
11
|
-
column: number;
|
|
12
|
-
/** True for descending order */
|
|
13
|
-
desc: boolean;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Join type for property combination
|
|
17
|
-
*/
|
|
18
|
-
export type JoinType = 'inner' | 'left' | 'right' | 'full' | 'cross';
|
|
19
|
-
/**
|
|
20
|
-
* Merge ordering requirements between parent and child
|
|
21
|
-
* Returns undefined if orderings are incompatible
|
|
22
|
-
*/
|
|
23
|
-
export declare function mergeOrderings(parent: Ordering[] | undefined, child: Ordering[] | undefined): Ordering[] | undefined;
|
|
24
|
-
/**
|
|
25
|
-
* Combine unique keys from left and right sides of a join
|
|
26
|
-
*/
|
|
27
|
-
export declare function combineUniqueKeys(left: number[][], right: number[][], joinType: JoinType, leftColumnOffset?: number, rightColumnOffset?: number): number[][];
|
|
28
|
-
/**
|
|
29
|
-
* Propagate constant flag from children to parent
|
|
30
|
-
*/
|
|
31
|
-
export declare function propagateConstantFlag(children: PhysicalProperties[]): boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Estimate result rows for common operations
|
|
34
|
-
*/
|
|
35
|
-
export declare function estimateResultRows(operation: 'filter' | 'aggregate' | 'join' | 'distinct' | 'limit', ...params: any[]): number;
|
|
36
|
-
//# sourceMappingURL=physical-utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"physical-utils.d.ts","sourceRoot":"","sources":["../../../src/planner/physical-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE/D;;GAEG;AACH,MAAM,WAAW,QAAQ;IACxB,mBAAmB;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,gCAAgC;IAChC,IAAI,EAAE,OAAO,CAAC;CACd;AAED;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;AAErE;;;GAGG;AACH,wBAAgB,cAAc,CAC7B,MAAM,EAAE,QAAQ,EAAE,GAAG,SAAS,EAC9B,KAAK,EAAE,QAAQ,EAAE,GAAG,SAAS,GAC3B,QAAQ,EAAE,GAAG,SAAS,CA6BxB;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAChC,IAAI,EAAE,MAAM,EAAE,EAAE,EAChB,KAAK,EAAE,MAAM,EAAE,EAAE,EACjB,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,GAAE,MAAU,EAC5B,iBAAiB,CAAC,EAAE,MAAM,GACxB,MAAM,EAAE,EAAE,CAkCZ;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAG7E;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CACjC,SAAS,EAAE,QAAQ,GAAG,WAAW,GAAG,MAAM,GAAG,UAAU,GAAG,OAAO,EACjE,GAAG,MAAM,EAAE,GAAG,EAAE,GACd,MAAM,CAgDR"}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Physical property utilities for the Titan optimizer
|
|
3
|
-
* Provides helpers for handling ordering, unique keys, and property propagation
|
|
4
|
-
*/
|
|
5
|
-
import { quereusError } from '../common/errors.js';
|
|
6
|
-
import { StatusCode } from '../common/types.js';
|
|
7
|
-
/**
|
|
8
|
-
* Merge ordering requirements between parent and child
|
|
9
|
-
* Returns undefined if orderings are incompatible
|
|
10
|
-
*/
|
|
11
|
-
export function mergeOrderings(parent, child) {
|
|
12
|
-
// If parent has no ordering requirements, use child's ordering
|
|
13
|
-
if (!parent || parent.length === 0) {
|
|
14
|
-
return child;
|
|
15
|
-
}
|
|
16
|
-
// If child provides no ordering, parent requirements cannot be satisfied
|
|
17
|
-
if (!child || child.length === 0) {
|
|
18
|
-
return undefined;
|
|
19
|
-
}
|
|
20
|
-
// Check if child ordering satisfies parent requirements
|
|
21
|
-
if (parent.length > child.length) {
|
|
22
|
-
return undefined; // Child provides fewer columns than parent needs
|
|
23
|
-
}
|
|
24
|
-
// Verify each parent requirement is satisfied by child
|
|
25
|
-
for (let i = 0; i < parent.length; i++) {
|
|
26
|
-
const parentOrder = parent[i];
|
|
27
|
-
const childOrder = child[i];
|
|
28
|
-
if (parentOrder.column !== childOrder.column ||
|
|
29
|
-
parentOrder.desc !== childOrder.desc) {
|
|
30
|
-
return undefined; // Ordering mismatch
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
// Parent requirements are satisfied, return child's full ordering
|
|
34
|
-
return child;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Combine unique keys from left and right sides of a join
|
|
38
|
-
*/
|
|
39
|
-
export function combineUniqueKeys(left, right, joinType, leftColumnOffset = 0, rightColumnOffset) {
|
|
40
|
-
const result = [];
|
|
41
|
-
// Calculate right column offset if not provided
|
|
42
|
-
if (rightColumnOffset === undefined) {
|
|
43
|
-
rightColumnOffset = leftColumnOffset + Math.max(...left.flat(), 0) + 1;
|
|
44
|
-
}
|
|
45
|
-
switch (joinType) {
|
|
46
|
-
case 'inner':
|
|
47
|
-
case 'cross':
|
|
48
|
-
// Inner join: unique keys from both sides remain unique
|
|
49
|
-
// Add left side keys (unchanged)
|
|
50
|
-
result.push(...left);
|
|
51
|
-
// Add right side keys (with column offset)
|
|
52
|
-
result.push(...right.map(key => key.map(col => col + rightColumnOffset)));
|
|
53
|
-
break;
|
|
54
|
-
case 'left':
|
|
55
|
-
// Left outer join: left side keys remain unique, right side keys may have nulls
|
|
56
|
-
result.push(...left);
|
|
57
|
-
break;
|
|
58
|
-
case 'right':
|
|
59
|
-
// Right outer join: right side keys remain unique, left side keys may have nulls
|
|
60
|
-
result.push(...right.map(key => key.map(col => col + rightColumnOffset)));
|
|
61
|
-
break;
|
|
62
|
-
case 'full':
|
|
63
|
-
// Full outer join: no keys remain unique due to potential nulls
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
66
|
-
return result;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Propagate constant flag from children to parent
|
|
70
|
-
*/
|
|
71
|
-
export function propagateConstantFlag(children) {
|
|
72
|
-
// A node is constant if all its children are constant
|
|
73
|
-
return children.length > 0 && children.every(child => child.constant === true);
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Estimate result rows for common operations
|
|
77
|
-
*/
|
|
78
|
-
export function estimateResultRows(operation, ...params) {
|
|
79
|
-
switch (operation) {
|
|
80
|
-
case 'filter': {
|
|
81
|
-
const [inputRows, selectivity = 0.3] = params;
|
|
82
|
-
return Math.max(1, Math.floor(inputRows * selectivity));
|
|
83
|
-
}
|
|
84
|
-
case 'aggregate': {
|
|
85
|
-
const [inputRows, groupByCount] = params;
|
|
86
|
-
if (groupByCount === 0) {
|
|
87
|
-
return 1; // Single aggregate result
|
|
88
|
-
}
|
|
89
|
-
// Estimate grouping factor
|
|
90
|
-
const groupingFactor = Math.min(0.8, Math.max(0.1, groupByCount * 0.2));
|
|
91
|
-
return Math.max(1, Math.floor(inputRows * groupingFactor));
|
|
92
|
-
}
|
|
93
|
-
case 'join': {
|
|
94
|
-
const [leftRows, rightRows, joinType = 'inner'] = params;
|
|
95
|
-
switch (joinType) {
|
|
96
|
-
case 'inner':
|
|
97
|
-
case 'cross':
|
|
98
|
-
return leftRows * rightRows;
|
|
99
|
-
case 'left':
|
|
100
|
-
return Math.max(leftRows, Math.floor(leftRows * rightRows * 0.1));
|
|
101
|
-
case 'right':
|
|
102
|
-
return Math.max(rightRows, Math.floor(leftRows * rightRows * 0.1));
|
|
103
|
-
case 'full':
|
|
104
|
-
return leftRows + rightRows;
|
|
105
|
-
default:
|
|
106
|
-
return Math.max(leftRows, rightRows);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
case 'distinct': {
|
|
110
|
-
const [inputRows] = params;
|
|
111
|
-
// Assume 70% unique rows
|
|
112
|
-
return Math.max(1, Math.floor(inputRows * 0.7));
|
|
113
|
-
}
|
|
114
|
-
case 'limit': {
|
|
115
|
-
const [inputRows, limitValue, offset = 0] = params;
|
|
116
|
-
return Math.min(inputRows, Math.max(0, limitValue - offset));
|
|
117
|
-
}
|
|
118
|
-
default:
|
|
119
|
-
quereusError(`Unknown operation: ${operation}`, StatusCode.INTERNAL);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
//# sourceMappingURL=physical-utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"physical-utils.js","sourceRoot":"","sources":["../../../src/planner/physical-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAkBhD;;;GAGG;AACH,MAAM,UAAU,cAAc,CAC7B,MAA8B,EAC9B,KAA6B;IAE7B,+DAA+D;IAC/D,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpC,OAAO,KAAK,CAAC;IACd,CAAC;IAED,yEAAyE;IACzE,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAClC,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,wDAAwD;IACxD,IAAI,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;QAClC,OAAO,SAAS,CAAC,CAAC,iDAAiD;IACpE,CAAC;IAED,uDAAuD;IACvD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACxC,MAAM,WAAW,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QAC9B,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QAE5B,IAAI,WAAW,CAAC,MAAM,KAAK,UAAU,CAAC,MAAM;YAC3C,WAAW,CAAC,IAAI,KAAK,UAAU,CAAC,IAAI,EAAE,CAAC;YACvC,OAAO,SAAS,CAAC,CAAC,oBAAoB;QACvC,CAAC;IACF,CAAC;IAED,kEAAkE;IAClE,OA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AAK,CAAC,QAAQ,GAAG,SAAS,GAAG,GAAG,CAAC,CAAC,CAAC;gBACnE,KAAK,OAAO;oBACX,OAAO,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,SAAS,GAAG,GAAG,CAAC,CAAC,CAAC;gBACpE,KAAK,MAAM;oBACV,OAAO,QAAQ,GAAG,SAAS,CAAC;gBAC7B;oBACC,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;YACvC,CAAC;QACF,CAAC;QAED,KAAK,UAAU,CAAC,CAAC,CAAC;YACjB,MAAM,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC;YAC3B,yBAAyB;YACzB,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,CAAC;QACjD,CAAC;QAED,KAAK,OAAO,CAAC,CAAC,CAAC;YACd,MAAM,CAAC,SAAS,EAAE,UAAU,EAAE,MAAM,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC;YACnD,OAAO,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC,CAAC,CAAC;QAC9D,CAAC;QAED;YACC,YAAY,CAAC,sBAAsB,SAAS,EAAE,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IACvE,CAAC;AACF,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Rule: Filter Optimization
|
|
3
|
-
*
|
|
4
|
-
* Transforms: FilterNode → FilterNode (optimized)
|
|
5
|
-
* Conditions: When filter node's source needs optimization
|
|
6
|
-
* Benefits: Ensures filter nodes have optimized sources and proper physical properties
|
|
7
|
-
*/
|
|
8
|
-
import type { PlanNode } from '../../nodes/plan-node.js';
|
|
9
|
-
import type { OptContext } from '../../framework/context.js';
|
|
10
|
-
export declare function ruleFilterOptimization(node: PlanNode, context: OptContext): PlanNode | null;
|
|
11
|
-
//# sourceMappingURL=rule-filter-optimization.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rule-filter-optimization.d.ts","sourceRoot":"","sources":["../../../../../src/planner/rules/physical/rule-filter-optimization.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAsB,MAAM,0BAA0B,CAAC;AAC7E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAM7D,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,GAAG,QAAQ,GAAG,IAAI,CA4C3F"}
|