Class RelOptRuleOperand

java.lang.Object
org.apache.calcite.plan.RelOptRuleOperand
Direct Known Subclasses:
RelOptRule.ConverterRelOptRuleOperand

public class RelOptRuleOperand extends Object
Operand that determines whether a RelOptRule 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 is null: Join(Filter (), Any) means that, to match the rule, Filter must have no operands.

  • Field Details

    • solveOrder

      public int @MonotonicNonNull [] solveOrder
    • ordinalInParent

      public int ordinalInParent
    • ordinalInRule

      public int ordinalInRule
    • trait

      public final @Nullable RelTrait trait
    • childPolicy

      public final RelOptRuleOperandChildPolicy childPolicy
      Whether child operands can be matched in any order.
  • Constructor Details

  • Method Details

    • getParent

      public @Nullable RelOptRuleOperand getParent()
      Returns the parent operand.
      Returns:
      parent operand
    • setParent

      public void setParent(@Nullable 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(@UnknownInitialization RelOptRule rule)
      Sets the rule this operand belongs to.
      Parameters:
      rule - containing rule
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(@Nullable Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      FOR DEBUG ONLY.

      To facilitate IDE shows the operand description in the debugger, returns the root operand description, but highlight current operand's matched class with '*' in the description.

      e.g. The following are examples of rule operand description for the operands that match with LogicalFilter.

      • SemiJoinRule:project: Project(Join(*RelNode*, Aggregate))
      • ProjectFilterTransposeRule: LogicalProject(*LogicalFilter*)
      • FilterProjectTransposeRule: *Filter*(Project)
      • ReduceExpressionsRule(Filter): *LogicalFilter*
      • PruneEmptyJoin(right): Join(*RelNode*, Values)
      Overrides:
      toString in class Object
      See Also:
      • describeIt(RelOptRuleOperand)
    • getMatchedClass

      public Class<? extends RelNode> getMatchedClass()
      Returns relational expression class matched by this operand.
    • getChildOperands

      public 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.