Skip to main content

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

ParameterTypeDescription
dbDortDBAsFriendInternal 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

ParameterType
...argsany[]

Returns

TupleOperatorWithSource


db

protected db: 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

PatternRule.operator


renameCheckerVmap

protected renameCheckerVmap: Record<string, AttributeRenameChecker>

Defined in: packages/core/src/optimizer/rules/selection-pushdown.ts:76

Per-language attribute-rename-checker visitor instances.


renamerVmap

protected renamerVmap: 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

ParameterType
...argsany[]

Returns

BranchedOperator


tdepsVmap

protected tdepsVmap: Record<string, TransitiveDependencies>

Defined in: packages/core/src/optimizer/rules/selection-pushdown.ts:72

Per-language transitive-dependency visitor instances.

Methods

checkProjection()

protected checkProjection(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

ParameterType
sSelection
pProjection
toRenameContainer?Set<Selection>

Returns

boolean


cloneSelection()

protected cloneSelection(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

ParameterType
sSelection

Returns

Selection


getSelectionDeps()

protected getSelectionDeps(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

ParameterType
sSelection

Returns

IdSet


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

ParameterTypeDescription
nodeSelectionThe plan operator to match.

Returns

PatternRuleMatchResult<PushdownSelectionsBindings>

Implementation of

PatternRule.match


matchGroupBy()

protected matchGroupBy(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

ParameterType
bindingsPushdownSelectionsBindings

Returns

PatternRuleMatchResult<PushdownSelectionsBindings>


matchJoins()

protected matchJoins(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

ParameterType
bindingsPushdownSelectionsBindings

Returns

PatternRuleMatchResult<PushdownSelectionsBindings>


matchProjection()

protected matchProjection(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

ParameterType
bindingsPushdownSelectionsBindings

Returns

PatternRuleMatchResult<PushdownSelectionsBindings>


matchProjectionConcat()

protected matchProjectionConcat(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

ParameterType
bindingsPushdownSelectionsBindings

Returns

PatternRuleMatchResult<PushdownSelectionsBindings>


matchSetOp()

protected matchSetOp(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

ParameterType
bindingsPushdownSelectionsBindings

Returns

PatternRuleMatchResult<PushdownSelectionsBindings>


pushSelectionsUnder()

protected pushSelectionsUnder<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

ParameterType
selectionsSelection[]
keyKey
sourceOp

Returns

void


tranformSetOp()

protected tranformSetOp(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

ParameterType
sourceBranchedOperator<PlanTupleOperator>
selectionsSelection[]

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

ParameterTypeDescription
nodeSelectionThe plan operator to transform.
bindingsPushdownSelectionsBindingsThe bindings to use for the transformation.

Returns

PlanOperator

Implementation of

PatternRule.transform


transformBasic()

protected transformBasic(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

ParameterType
sourceTupleOperatorWithSource
firstSelection
lastSelection

Returns

TupleOperatorWithSource


transformGroupBy()

protected transformGroupBy(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

ParameterType
sourceGroupBy
selectionsSelection[]

Returns

Selection | GroupBy


transformJoin()

protected transformJoin(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

ParameterType
sourceCartesianProduct
selectionsSelection[]

Returns

Selection | CartesianProduct


transformProjection()

protected transformProjection(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

ParameterType
sourceProjection
selectionsSelection[]

Returns

Projection | Selection


transformProjectionConcat()

protected transformProjectionConcat(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

ParameterType
sourceProjectionConcat
selectionsSelection[]

Returns

Selection | ProjectionConcat