Class: JoinIndices
Defined in: packages/core/src/optimizer/rules/join-indices.ts:29
Finds join conditions that match an existing index and replaces them with plan.ProjectionConcat and plan.Selection operators, that could be further optimized by the IndexScans rule.
Implements
Constructors
Constructor
new JoinIndices(
db):JoinIndices
Defined in: packages/core/src/optimizer/rules/join-indices.ts:41
Parameters
| Parameter | Type | Description |
|---|---|---|
db | DortDBAsFriend | Internal database interface. |
Returns
JoinIndices
Properties
db
protecteddb:DortDBAsFriend
Defined in: packages/core/src/optimizer/rules/join-indices.ts:43
Internal database interface.
operator
operator: typeof
Join=plan.Join
Defined in: packages/core/src/optimizer/rules/join-indices.ts:33
The operator this rule starts matching at.
Implementation of
renameCheckerVmap
protectedrenameCheckerVmap:Record<string,AttributeRenameChecker>
Defined in: packages/core/src/optimizer/rules/join-indices.ts:39
Per-language attribute-rename-checker visitor instances.
renamerVmap
protectedrenamerVmap:Record<string,AttributeRenamer>
Defined in: packages/core/src/optimizer/rules/join-indices.ts:37
Per-language attribute-renamer visitor instances.
tdepsVmap
protectedtdepsVmap:Record<string,TransitiveDependencies>
Defined in: packages/core/src/optimizer/rules/join-indices.ts:35
Per-language transitive-dependency visitor instances.
Methods
findValidAttrs()
protectedfindValidAttrs(projections):IdSet
Defined in: packages/core/src/optimizer/rules/join-indices.ts:158
Filters out computed attributes from projections.
Parameters
| Parameter | Type |
|---|---|
projections | Projection[] |
Returns
getExprCandidates()
protectedgetExprCandidates(conditions,schema): [number,number][]
Defined in: packages/core/src/optimizer/rules/join-indices.ts:176
Get expressions to match against the index.
Parameters
| Parameter | Type | Description |
|---|---|---|
conditions | Calculation[] | conditions to check |
schema | IdSet | schema of the side which we are checking against |
Returns
[number, number][]
array of pairs [condition index, condition original FnCall argument index]
match()
match(
node):PatternRuleMatchResult<JoinIndicesBindings>
Defined in: packages/core/src/optimizer/rules/join-indices.ts:52
Matches the given plan operator against this rule.
Parameters
| Parameter | Type | Description |
|---|---|---|
node | Join | The plan operator to match. |
Returns
PatternRuleMatchResult<JoinIndicesBindings>
Implementation of
matchIndex()
protectedmatchIndex(index,candidates,conditions,renameMap):number[]
Defined in: packages/core/src/optimizer/rules/join-indices.ts:121
Returns the matched candidate indices if index can satisfy any of them, handling OR alternatives; null otherwise.
Parameters
| Parameter | Type |
|---|---|
index | Index |
candidates | [number, number][] |
conditions | Calculation[] |
renameMap | RenameMap |
Returns
number[]
prepareRenameMap()
protectedprepareRenameMap(projections):RenameMap
Defined in: packages/core/src/optimizer/rules/join-indices.ts:107
Composes the inverse rename maps of all chained projections into a single map, or returns null if there are none.
Parameters
| Parameter | Type |
|---|---|
projections | Projection[] |
Returns
transform()
transform(
node,bindings):PlanOperator
Defined in: packages/core/src/optimizer/rules/join-indices.ts:238
Transforms the given plan operator using the provided bindings.
Parameters
| Parameter | Type | Description |
|---|---|---|
node | Join | The plan operator to transform. |
bindings | JoinIndicesBindings | The bindings to use for the transformation. |
Returns
Implementation of
traverseSide()
protectedtraverseSide(node):object
Defined in: packages/core/src/optimizer/rules/join-indices.ts:200
Walks down one side of a join through projections/selections/order-by to find the underlying source; returns null if the side is not index-eligible.
Parameters
| Parameter | Type |
|---|---|
node | PlanOperator |
Returns
projections
projections:
Projection[]
Projection operators encountered while descending, in top-down order.
source
source:
TupleSource|ItemSource
The underlying tuple or item source at the bottom of the chain.