Class RelOptRuleCall
- Direct Known Subclasses:
HepRuleCall,VolcanoRuleCall
RelOptRuleCall is an invocation of a RelOptRule with a
set of relational expressions as arguments.-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal intprotected static final org.slf4j.Loggerprotected final RelOptRuleOperandfinal RelNode[]final RelOptRule -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedRelOptRuleCall(RelOptPlanner planner, RelOptRuleOperand operand, RelNode[] rels, Map<RelNode, List<RelNode>> nodeInputs) protectedRelOptRuleCall(RelOptPlanner planner, RelOptRuleOperand operand, RelNode[] rels, Map<RelNode, List<RelNode>> nodeInputs, @Nullable List<RelNode> parents) Creates a RelOptRuleCall. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Creates aRelBuilderto be used by code within the call.getChildRels(RelNode rel) Returns the children of a given relational expression node matched in a rule.Returns the current RelMetadataQuery to be used for instance byRelOptRule.onMatch(RelOptRuleCall).Returns the root operand matched by this rule.Returns a list of parents of the first relational expression.Returns the planner.Returns a list of matched relational expressions.RelNode[]getRels()Deprecated.getRule()Returns the invoked planner rule.booleanDetermines whether the rule is excluded by any root node hint.<T extends RelNode>
Trel(int ordinal) Retrieves theordinalth matched relational expression.protected voidsetChildRels(RelNode rel, List<RelNode> inputs) Assigns the input relational expressions of a given relational expression, as seen by this particular call.final voidtransformTo(RelNode rel) Registers that a rule has produced an equivalent relational expression, but no other equivalences.voidtransformTo(RelNode rel, Map<RelNode, RelNode> equiv) Registers that a rule has produced an equivalent relational expression, with specified equivalences.abstract voidtransformTo(RelNode rel, Map<RelNode, RelNode> equiv, RelHintsPropagator handler) Registers that a rule has produced an equivalent relational expression.final voidtransformTo(RelNode rel, RelHintsPropagator handler) Registers that a rule has produced an equivalent relational expression, but no other equivalences.
-
Field Details
-
LOGGER
protected static final org.slf4j.Logger LOGGER -
id
public final int id -
operand0
-
nodeInputs
-
rule
-
rels
-
-
Constructor Details
-
RelOptRuleCall
protected RelOptRuleCall(RelOptPlanner planner, RelOptRuleOperand operand, RelNode[] rels, Map<RelNode, List<RelNode>> nodeInputs, @Nullable List<RelNode> parents) Creates a RelOptRuleCall.- Parameters:
planner- Planneroperand- Root operandrels- Array of relational expressions which matched each operandnodeInputs- For each node which matched withmatchAnyChildren=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, null
-
RelOptRuleCall
protected RelOptRuleCall(RelOptPlanner planner, RelOptRuleOperand operand, RelNode[] rels, Map<RelNode, List<RelNode>> nodeInputs)
-
-
Method Details
-
getOperand0
Returns the root operand matched by this rule.- Returns:
- root operand
-
getRule
Returns the invoked planner rule.- Returns:
- planner rule
-
getRels
Deprecated.UsegetRelList()orrel(int)Returns a list of matched relational expressions.- Returns:
- matched relational expressions
-
getRelList
Returns a list of matched relational expressions.- Returns:
- matched relational expressions
- See Also:
-
rel
Retrieves theordinalth matched relational expression. This corresponds to theordinalth operand of the rule.- Type Parameters:
T- Type- Parameters:
ordinal- Ordinal- Returns:
- Relational expression
-
getChildRels
Returns the children of a given relational expression node matched in a rule.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 thegetRelList()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.- Parameters:
rel- Relational expression- Returns:
- Children of relational expression
-
setChildRels
Assigns the input relational expressions of a given relational expression, as seen by this particular call. Is only called when the operand isany. -
getPlanner
Returns the planner.- Returns:
- planner
-
isRuleExcluded
public boolean isRuleExcluded()Determines whether the rule is excluded by any root node hint.- Returns:
- true iff rule should be excluded
-
getMetadataQuery
Returns the current RelMetadataQuery to be used for instance byRelOptRule.onMatch(RelOptRuleCall). -
getParents
Returns a list of parents of the first relational expression. -
transformTo
public abstract void transformTo(RelNode rel, Map<RelNode, RelNode> equiv, RelHintsPropagator handler) Registers that a rule has produced an equivalent relational expression.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 byrel.getTraits()will be copied fromthis.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 handlerhandler.- Parameters:
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 expression
-
transformTo
Registers that a rule has produced an equivalent relational expression, with specified equivalences.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).- Parameters:
rel- Relational expression equivalent to the root relational expression of the rule call,call.rels(0)equiv- Map of other equivalences
-
transformTo
Registers that a rule has produced an equivalent relational expression, but no other equivalences.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).- Parameters:
rel- Relational expression equivalent to the root relational expression of the rule call,call.rels(0)
-
transformTo
Registers that a rule has produced an equivalent relational expression, but no other equivalences.The hints of the root relational expression of the rule call(
this.rels[0]) are copied to the new relational expression(rel) with specified handlerhandler.- Parameters:
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 expression
-
builder
Creates aRelBuilderto be used by code within the call. TheRelOptRule.relBuilderFactoryargument contains policies such as what implementation ofFilterto create.
-
getRelList()orrel(int)