public abstract class RelOptRuleCall extends Object
RelOptRuleCall is an invocation of a RelOptRule with a
set of relational expressions as arguments.| Modifier and Type | Field and Description |
|---|---|
int |
id |
protected static org.slf4j.Logger |
LOGGER |
protected Map<RelNode,List<RelNode>> |
nodeInputs |
protected RelOptRuleOperand |
operand0 |
RelNode[] |
rels |
RelOptRule |
rule |
| Modifier | Constructor and Description |
|---|---|
protected |
RelOptRuleCall(RelOptPlanner planner,
RelOptRuleOperand operand,
RelNode[] rels,
Map<RelNode,List<RelNode>> nodeInputs) |
protected |
RelOptRuleCall(RelOptPlanner planner,
RelOptRuleOperand operand,
RelNode[] rels,
Map<RelNode,List<RelNode>> nodeInputs,
@Nullable List<RelNode> parents)
Creates a RelOptRuleCall.
|
| Modifier and Type | Method and Description |
|---|---|
RelBuilder |
builder()
Creates a
RelBuilder to be used by
code within the call. |
@Nullable List<RelNode> |
getChildRels(RelNode rel)
Returns the children of a given relational expression node matched in a
rule.
|
RelMetadataQuery |
getMetadataQuery()
Returns the current RelMetadataQuery
to be used for instance by
RelOptRule.onMatch(RelOptRuleCall). |
RelOptRuleOperand |
getOperand0()
Returns the root operand matched by this rule.
|
@Nullable List<RelNode> |
getParents()
Returns a list of parents of the first relational expression.
|
RelOptPlanner |
getPlanner()
Returns the planner.
|
List<RelNode> |
getRelList()
Returns a list of matched relational expressions.
|
RelNode[] |
getRels()
Deprecated.
Use
getRelList() or rel(int) |
RelOptRule |
getRule()
Returns the invoked planner rule.
|
boolean |
isRuleExcluded()
Determines whether the rule is excluded by any root node hint.
|
<T extends RelNode> |
rel(int ordinal)
Retrieves the
ordinalth matched relational expression. |
protected void |
setChildRels(RelNode rel,
List<RelNode> inputs)
Assigns the input relational expressions of a given relational expression,
as seen by this particular call.
|
void |
transformTo(RelNode rel)
Registers that a rule has produced an equivalent relational expression,
but no other equivalences.
|
void |
transformTo(RelNode rel,
Map<RelNode,RelNode> equiv)
Registers that a rule has produced an equivalent relational expression,
with specified equivalences.
|
abstract void |
transformTo(RelNode rel,
Map<RelNode,RelNode> equiv,
RelHintsPropagator handler)
Registers that a rule has produced an equivalent relational expression.
|
void |
transformTo(RelNode rel,
RelHintsPropagator handler)
Registers that a rule has produced an equivalent relational expression,
but no other equivalences.
|
protected static final org.slf4j.Logger LOGGER
public final int id
protected final RelOptRuleOperand operand0
public final RelOptRule rule
public final RelNode[] rels
protected RelOptRuleCall(RelOptPlanner planner, RelOptRuleOperand operand, RelNode[] rels, Map<RelNode,List<RelNode>> nodeInputs, @Nullable List<RelNode> parents)
planner - Planneroperand - Root operandrels - Array of relational expressions which matched each
operandnodeInputs - For each node which matched with
matchAnyChildren=true, a list of the node's
inputsparents - list of parent RelNodes corresponding to the first
relational expression in the array argument, if known;
otherwise, nullprotected RelOptRuleCall(RelOptPlanner planner, RelOptRuleOperand operand, RelNode[] rels, Map<RelNode,List<RelNode>> nodeInputs)
public RelOptRuleOperand getOperand0()
public RelOptRule getRule()
@Deprecated public RelNode[] getRels()
getRelList() or rel(int)public List<RelNode> getRelList()
rel(int)public <T extends RelNode> T rel(int ordinal)
ordinalth matched relational expression. This
corresponds to the ordinalth operand of the rule.T - Typeordinal - Ordinalpublic @Nullable List<RelNode> getChildRels(RelNode rel)
If the policy of the operand which caused the match is not
RelOptRuleOperandChildPolicy.ANY,
the children will have their
own operands and therefore be easily available in the array returned by
the getRelList() method, so this method returns null.
This method is for
RelOptRuleOperandChildPolicy.ANY,
which is generally used when a node can have a variable number of
children, and hence where the matched children are not retrievable by any
other means.
Warning: it produces wrong result for unordered(...) case.
rel - Relational expressionprotected void setChildRels(RelNode rel, List<RelNode> inputs)
any.public RelOptPlanner getPlanner()
public boolean isRuleExcluded()
public RelMetadataQuery getMetadataQuery()
RelOptRule.onMatch(RelOptRuleCall).public @Nullable List<RelNode> getParents()
public abstract void transformTo(RelNode rel, Map<RelNode,RelNode> equiv, RelHintsPropagator handler)
Called by the rule whenever it finds a match. The implementation of
this method guarantees that the original relational expression (that is,
this.rels[0]) has its traits propagated to the new
relational expression (rel) and its unregistered children.
Any trait not specifically set in the RelTraitSet returned by
rel.getTraits() will be copied from
this.rels[0].getTraitSet().
The hints of the root relational expression of
the rule call(this.rels[0])
are copied to the new relational expression(rel)
with specified handler handler.
rel - Relational expression equivalent to the root relational
expression of the rule call, call.rels(0)equiv - Map of other equivalenceshandler - Handler to customize the relational expression that registers
into the planner, the first parameter is the root relational expression
and the second parameter is the new relational expressionpublic void transformTo(RelNode rel, Map<RelNode,RelNode> equiv)
The hints are copied with filter strategies from
the root relational expression of the rule call(this.rels[0])
to the new relational expression(rel).
rel - Relational expression equivalent to the root relational
expression of the rule call, call.rels(0)equiv - Map of other equivalencespublic final void transformTo(RelNode rel)
The hints are copied with filter strategies from
the root relational expression of the rule call(this.rels[0])
to the new relational expression(rel).
rel - Relational expression equivalent to the root relational
expression of the rule call, call.rels(0)public final void transformTo(RelNode rel, RelHintsPropagator handler)
The hints of the root relational expression of
the rule call(this.rels[0])
are copied to the new relational expression(rel)
with specified handler handler.
rel - Relational expression equivalent to the root relational
expression of the rule call, call.rels(0)handler - Handler to customize the relational expression that registers
into the planner, the first parameter is the root relational expression
and the second parameter is the new relational expressionpublic RelBuilder builder()
RelBuilder to be used by
code within the call. The RelOptRule.relBuilderFactory argument contains policies
such as what implementation of Filter to create.Copyright © 2012-2022 Apache Software Foundation. All Rights Reserved.