public abstract class RelOptRuleCall
extends java.lang.Object
RelOptRuleCall
is an invocation of a RelOptRule
with a
set of relational expression
s as arguments.Modifier and Type | Field and Description |
---|---|
int |
id |
protected static org.slf4j.Logger |
LOGGER |
private static int |
nextId
Generator for
id values. |
protected java.util.Map<RelNode,java.util.List<RelNode>> |
nodeInputs |
protected RelOptRuleOperand |
operand0 |
private java.util.List<RelNode> |
parents |
private RelOptPlanner |
planner |
RelNode[] |
rels |
RelOptRule |
rule |
Modifier | Constructor and Description |
---|---|
protected |
RelOptRuleCall(RelOptPlanner planner,
RelOptRuleOperand operand,
RelNode[] rels,
java.util.Map<RelNode,java.util.List<RelNode>> nodeInputs) |
protected |
RelOptRuleCall(RelOptPlanner planner,
RelOptRuleOperand operand,
RelNode[] rels,
java.util.Map<RelNode,java.util.List<RelNode>> nodeInputs,
java.util.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. |
java.util.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.
|
java.util.List<RelNode> |
getParents() |
RelOptPlanner |
getPlanner()
Returns the planner.
|
java.util.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.
|
<T extends RelNode> |
rel(int ordinal)
Retrieves the
ordinal th matched relational expression. |
protected void |
setChildRels(RelNode rel,
java.util.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.
|
abstract void |
transformTo(RelNode rel,
java.util.Map<RelNode,RelNode> equiv)
Registers that a rule has produced an equivalent relational expression.
|
protected static final org.slf4j.Logger LOGGER
private static int nextId
id
values.public final int id
protected final RelOptRuleOperand operand0
public final RelOptRule rule
public final RelNode[] rels
private final RelOptPlanner planner
private final java.util.List<RelNode> parents
protected RelOptRuleCall(RelOptPlanner planner, RelOptRuleOperand operand, RelNode[] rels, java.util.Map<RelNode,java.util.List<RelNode>> nodeInputs, java.util.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, java.util.Map<RelNode,java.util.List<RelNode>> nodeInputs)
public RelOptRuleOperand getOperand0()
public RelOptRule getRule()
@Deprecated public RelNode[] getRels()
getRelList()
or rel(int)
public java.util.List<RelNode> getRelList()
rel(int)
public <T extends RelNode> T rel(int ordinal)
ordinal
th matched relational expression. This
corresponds to the ordinal
th operand of the rule.T
- Typeordinal
- Ordinalpublic java.util.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, java.util.List<RelNode> inputs)
RelOptRule.any()
.public RelOptPlanner getPlanner()
public RelMetadataQuery getMetadataQuery()
RelOptRule.onMatch(RelOptRuleCall)
.public java.util.List<RelNode> getParents()
public abstract void transformTo(RelNode rel, java.util.Map<RelNode,RelNode> equiv)
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()
.
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)
rel
- Relational expression equivalent to the root relational
expression of the rule call, call.rels(0)
public 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–2019 The Apache Software Foundation. All rights reserved.