Class: PushdownSelections
Defined in: packages/core/src/optimizer/rules/selection-pushdown.ts:54
Pushes down selection predicates through the query plan, so that they can be applied as early as possible.
Implements
Constructors
Constructor
new PushdownSelections(
db):PushdownSelections
Defined in: packages/core/src/optimizer/rules/selection-pushdown.ts:78
Parameters
| Parameter | Type | Description |
|---|---|---|
db | DortDBAsFriend | Internal database interface. |
Returns
PushdownSelections
Properties
alwaysSwap
alwaysSwap: (...
args) =>TupleOperatorWithSource[]
Defined in: packages/core/src/optimizer/rules/selection-pushdown.ts:62
Operator classes whose selection can always be pushed below them (e.g. OrderBy, Distinct).
Parameters
| Parameter | Type |
|---|---|
...args | any[] |
Returns
db
protecteddb:DortDBAsFriend
Defined in: packages/core/src/optimizer/rules/selection-pushdown.ts:80
Internal database interface.
operator
operator: typeof
Selection=Selection
Defined in: packages/core/src/optimizer/rules/selection-pushdown.ts:58
The operator this rule starts matching at.
Implementation of
renameCheckerVmap
protectedrenameCheckerVmap:Record<string,AttributeRenameChecker>
Defined in: packages/core/src/optimizer/rules/selection-pushdown.ts:76
Per-language attribute-rename-checker visitor instances.
renamerVmap
protectedrenamerVmap:Record<string,AttributeRenamer>
Defined in: packages/core/src/optimizer/rules/selection-pushdown.ts:74
Per-language attribute-renamer visitor instances.
setOps
setOps: (...
args) =>BranchedOperator[]
Defined in: packages/core/src/optimizer/rules/selection-pushdown.ts:68
Set-operation operator classes through which selections are duplicated to both branches.
Parameters
| Parameter | Type |
|---|---|
...args | any[] |
Returns
tdepsVmap
protectedtdepsVmap:Record<string,TransitiveDependencies>
Defined in: packages/core/src/optimizer/rules/selection-pushdown.ts:72
Per-language transitive-dependency visitor instances.
Methods
checkProjection()
protectedcheckProjection(s,p,toRenameContainer?):boolean
Defined in: packages/core/src/optimizer/rules/selection-pushdown.ts:558
Returns true if selection s can be pushed through projection p; adds s to toRenameContainer when a rename is also needed.
Parameters
| Parameter | Type |
|---|---|
s | Selection |
p | Projection |
toRenameContainer? | Set<Selection> |
Returns
boolean
cloneSelection()
protectedcloneSelection(s):Selection
Defined in: packages/core/src/optimizer/rules/selection-pushdown.ts:550
Returns a shallow clone of s with its own schema copy.
Parameters
| Parameter | Type |
|---|---|
s | Selection |
Returns
getSelectionDeps()
protectedgetSelectionDeps(s):IdSet
Defined in: packages/core/src/optimizer/rules/selection-pushdown.ts:212
Returns the set of identifiers that the selection's condition transitively depends on.
Parameters
| Parameter | Type |
|---|---|
s | Selection |
Returns
match()
match(
node):PatternRuleMatchResult<PushdownSelectionsBindings>
Defined in: packages/core/src/optimizer/rules/selection-pushdown.ts:90
Matches the given plan operator against this rule.
Parameters
| Parameter | Type | Description |
|---|---|---|
node | Selection | The plan operator to match. |
Returns
PatternRuleMatchResult<PushdownSelectionsBindings>
Implementation of
matchGroupBy()
protectedmatchGroupBy(bindings):PatternRuleMatchResult<PushdownSelectionsBindings>
Defined in: packages/core/src/optimizer/rules/selection-pushdown.ts:132
Returns match bindings when at least one selection depends only on group-by keys.
Parameters
| Parameter | Type |
|---|---|
bindings | PushdownSelectionsBindings |
Returns
PatternRuleMatchResult<PushdownSelectionsBindings>
matchJoins()
protectedmatchJoins(bindings):PatternRuleMatchResult<PushdownSelectionsBindings>
Defined in: packages/core/src/optimizer/rules/selection-pushdown.ts:147
Returns match bindings when at least one selection can be pushed to one side of a join.
Parameters
| Parameter | Type |
|---|---|
bindings | PushdownSelectionsBindings |
Returns
PatternRuleMatchResult<PushdownSelectionsBindings>
matchProjection()
protectedmatchProjection(bindings):PatternRuleMatchResult<PushdownSelectionsBindings>
Defined in: packages/core/src/optimizer/rules/selection-pushdown.ts:179
Returns match bindings when at least one selection can be pushed through the projection.
Parameters
| Parameter | Type |
|---|---|
bindings | PushdownSelectionsBindings |
Returns
PatternRuleMatchResult<PushdownSelectionsBindings>
matchProjectionConcat()
protectedmatchProjectionConcat(bindings):PatternRuleMatchResult<PushdownSelectionsBindings>
Defined in: packages/core/src/optimizer/rules/selection-pushdown.ts:163
Returns match bindings when at least one selection can be pushed into the source or mapping branch of a projection concat.
Parameters
| Parameter | Type |
|---|---|
bindings | PushdownSelectionsBindings |
Returns
PatternRuleMatchResult<PushdownSelectionsBindings>
matchSetOp()
protectedmatchSetOp(bindings):PatternRuleMatchResult<PushdownSelectionsBindings>
Defined in: packages/core/src/optimizer/rules/selection-pushdown.ts:191
Returns match bindings when at least one selection can be pushed through a set operation.
Parameters
| Parameter | Type |
|---|---|
bindings | PushdownSelectionsBindings |
Returns
PatternRuleMatchResult<PushdownSelectionsBindings>
pushSelectionsUnder()
protectedpushSelectionsUnder<Key,Op>(selections,key,source):void
Defined in: packages/core/src/optimizer/rules/selection-pushdown.ts:582
Rewires selections so they sit between source and source[key], updating parent references and schemas.
Type Parameters
| Type Parameter |
|---|
Key extends string |
Op extends PlanTupleOperator & Record<Key, PlanTupleOperator> |
Parameters
| Parameter | Type |
|---|---|
selections | Selection[] |
key | Key |
source | Op |
Returns
void
tranformSetOp()
protectedtranformSetOp(source,selections):Selection|BranchedOperator<PlanTupleOperator>
Defined in: packages/core/src/optimizer/rules/selection-pushdown.ts:328
Duplicates the selection stack into both branches of the set operation.
Parameters
| Parameter | Type |
|---|---|
source | BranchedOperator<PlanTupleOperator> |
selections | Selection[] |
Returns
Selection | BranchedOperator<PlanTupleOperator>
transform()
transform(
node,bindings):PlanOperator
Defined in: packages/core/src/optimizer/rules/selection-pushdown.ts:216
Transforms the given plan operator using the provided bindings.
Parameters
| Parameter | Type | Description |
|---|---|---|
node | Selection | The plan operator to transform. |
bindings | PushdownSelectionsBindings | The bindings to use for the transformation. |
Returns
Implementation of
transformBasic()
protectedtransformBasic(source,first,last):TupleOperatorWithSource
Defined in: packages/core/src/optimizer/rules/selection-pushdown.ts:254
Moves the selection stack below source, which is an operator that simply wraps a single child.
Parameters
| Parameter | Type |
|---|---|
source | TupleOperatorWithSource |
first | Selection |
last | Selection |
Returns
transformGroupBy()
protectedtransformGroupBy(source,selections):Selection|GroupBy
Defined in: packages/core/src/optimizer/rules/selection-pushdown.ts:267
Partitions selections into those that can be pushed below source and those that must stay above it.
Parameters
| Parameter | Type |
|---|---|
source | GroupBy |
selections | Selection[] |
Returns
transformJoin()
protectedtransformJoin(source,selections):Selection|CartesianProduct
Defined in: packages/core/src/optimizer/rules/selection-pushdown.ts:459
Routes each selection to the left branch, right branch, or leaves it above the join.
Parameters
| Parameter | Type |
|---|---|
source | CartesianProduct |
selections | Selection[] |
Returns
transformProjection()
protectedtransformProjection(source,selections):Projection|Selection
Defined in: packages/core/src/optimizer/rules/selection-pushdown.ts:410
Pushes selections that can pass through source below it, renaming their conditions as needed.
Parameters
| Parameter | Type |
|---|---|
source | Projection |
selections | Selection[] |
Returns
transformProjectionConcat()
protectedtransformProjectionConcat(source,selections):Selection|ProjectionConcat
Defined in: packages/core/src/optimizer/rules/selection-pushdown.ts:506
Pushes selections into the source or mapping branch of a projection concat where possible.
Parameters
| Parameter | Type |
|---|---|
source | ProjectionConcat |
selections | Selection[] |