Class RelOptRuleOperand
- java.lang.Object
-
- org.apache.calcite.plan.RelOptRuleOperand
-
- Direct Known Subclasses:
RelOptRule.ConverterRelOptRuleOperand
public class RelOptRuleOperand extends java.lang.Object
Operand that determines whether aRelOptRule
can be applied to a particular expression.For example, the rule to pull a filter up from the left side of a join takes operands:
Join(Filter, Any)
.Note that
children
means different things if it is empty or it isnull
:Join(Filter (), Any)
means that, to match the rule,Filter
must have no operands.
-
-
Field Summary
Fields Modifier and Type Field Description RelOptRuleOperandChildPolicy
childPolicy
Whether child operands can be matched in any order.private com.google.common.collect.ImmutableList<RelOptRuleOperand>
children
private java.lang.Class<? extends RelNode>
clazz
int
ordinalInParent
int
ordinalInRule
private RelOptRuleOperand
parent
private java.util.function.Predicate<RelNode>
predicate
private RelOptRule
rule
int[]
solveOrder
private RelTrait
trait
-
Constructor Summary
Constructors Modifier Constructor Description (package private)
RelOptRuleOperand(java.lang.Class<R> clazz, RelTrait trait, java.util.function.Predicate<? super R> predicate, RelOptRuleOperandChildPolicy childPolicy, com.google.common.collect.ImmutableList<RelOptRuleOperand> children)
Private constructor.protected
RelOptRuleOperand(java.lang.Class<R> clazz, RelTrait trait, java.util.function.Predicate<? super R> predicate, RelOptRuleOperandChildren children)
Deprecated.UseRelOptRule.operand(Class, RelOptRuleOperandChildren)
or one of its overloaded methods.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
java.util.List<RelOptRuleOperand>
getChildOperands()
Returns the child operands.java.lang.Class<? extends RelNode>
getMatchedClass()
RelOptRuleOperand
getParent()
Returns the parent operand.RelOptRule
getRule()
Returns the rule this operand belongs to.int
hashCode()
boolean
matches(RelNode rel)
Returns whether a relational expression matches this operand.void
setParent(RelOptRuleOperand parent)
Sets the parent operand.void
setRule(RelOptRule rule)
Sets the rule this operand belongs to
-
-
-
Field Detail
-
parent
private RelOptRuleOperand parent
-
rule
private RelOptRule rule
-
predicate
private final java.util.function.Predicate<RelNode> predicate
-
solveOrder
public int[] solveOrder
-
ordinalInParent
public int ordinalInParent
-
ordinalInRule
public int ordinalInRule
-
trait
private final RelTrait trait
-
clazz
private final java.lang.Class<? extends RelNode> clazz
-
children
private final com.google.common.collect.ImmutableList<RelOptRuleOperand> children
-
childPolicy
public final RelOptRuleOperandChildPolicy childPolicy
Whether child operands can be matched in any order.
-
-
Constructor Detail
-
RelOptRuleOperand
@Deprecated protected RelOptRuleOperand(java.lang.Class<R> clazz, RelTrait trait, java.util.function.Predicate<? super R> predicate, RelOptRuleOperandChildren children)
Deprecated.UseRelOptRule.operand(Class, RelOptRuleOperandChildren)
or one of its overloaded methods.Creates an operand.The
childOperands
argument is often populated by calling one of the following methods:RelOptRule.some(org.apache.calcite.plan.RelOptRuleOperand, org.apache.calcite.plan.RelOptRuleOperand...)
,RelOptRule.none()
,RelOptRule.any()
,RelOptRule.unordered(org.apache.calcite.plan.RelOptRuleOperand, org.apache.calcite.plan.RelOptRuleOperand...)
, SeeRelOptRuleOperandChildren
for more details.- Parameters:
clazz
- Class of relational expression to match (must not be null)trait
- Trait to match, or null to match any traitpredicate
- Predicate to apply to relational expressionchildren
- Child operands
-
RelOptRuleOperand
RelOptRuleOperand(java.lang.Class<R> clazz, RelTrait trait, java.util.function.Predicate<? super R> predicate, RelOptRuleOperandChildPolicy childPolicy, com.google.common.collect.ImmutableList<RelOptRuleOperand> children)
Private constructor.Do not call from outside package, and do not create a sub-class.
The other constructor is deprecated; when it is removed, make fields
parent
,ordinalInParent
andsolveOrder
final, and add constructor parameters for them. See [CALCITE-1166] Disallow sub-classes of RelOptRuleOperand.
-
-
Method Detail
-
getParent
public RelOptRuleOperand getParent()
Returns the parent operand.- Returns:
- parent operand
-
setParent
public void setParent(RelOptRuleOperand parent)
Sets the parent operand.- Parameters:
parent
- Parent operand
-
getRule
public RelOptRule getRule()
Returns the rule this operand belongs to.- Returns:
- containing rule
-
setRule
public void setRule(RelOptRule rule)
Sets the rule this operand belongs to- Parameters:
rule
- containing rule
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
getMatchedClass
public java.lang.Class<? extends RelNode> getMatchedClass()
- Returns:
- relational expression class matched by this operand
-
getChildOperands
public java.util.List<RelOptRuleOperand> getChildOperands()
Returns the child operands.- Returns:
- child operands
-
matches
public boolean matches(RelNode rel)
Returns whether a relational expression matches this operand. It must be of the right class and trait.
-
-