Class MutableRel

java.lang.Object
org.apache.calcite.rel.mutable.MutableRel
Direct Known Subclasses:
Holder, MutableAggregate, MutableCalc, MutableCollect, MutableCorrelate, MutableExchange, MutableFilter, MutableJoin, MutableMatch, MutableProject, MutableSample, MutableScan, MutableSetOp, MutableSort, MutableTableFunctionScan, MutableTableModify, MutableUncollect, MutableValues, MutableWindow

public abstract class MutableRel extends Object
Mutable equivalent of RelNode.

Each node has mutable state, and keeps track of its parent and position within parent. It doesn't make sense to canonize MutableRels, otherwise one node could end up with multiple parents. It follows that #hashCode and #equals are less efficient than their RelNode counterparts. But, you don't need to copy a MutableRel in order to change it. For this reason, you should use MutableRel for short-lived operations, and transcribe back to RelNode when you are done.

  • Field Details

    • STRING_EQUIVALENCE

      protected static final com.google.common.base.Equivalence<Object> STRING_EQUIVALENCE
      Equivalence that compares objects by their Object.toString() method.
    • PAIRWISE_STRING_EQUIVALENCE

      protected static final com.google.common.base.Equivalence<List<?>> PAIRWISE_STRING_EQUIVALENCE
      Equivalence that compares Listss by the Object.toString() of their elements.
    • cluster

      public final RelOptCluster cluster
    • rowType

      public final RelDataType rowType
    • type

      protected final org.apache.calcite.rel.mutable.MutableRelType type
    • parent

      protected @Nullable MutableRel parent
    • ordinalInParent

      protected int ordinalInParent
  • Constructor Details

    • MutableRel

      protected MutableRel(RelOptCluster cluster, RelDataType rowType, org.apache.calcite.rel.mutable.MutableRelType type)
  • Method Details

    • getParent

      public @Nullable MutableRel getParent()
    • setInput

      public abstract void setInput(int ordinalInParent, MutableRel input)
    • getInputs

      public abstract List<MutableRel> getInputs()
    • clone

      public abstract MutableRel clone()
      Overrides:
      clone in class Object
    • childrenAccept

      public abstract void childrenAccept(MutableRelVisitor visitor)
    • replaceInParent

      public @Nullable MutableRel replaceInParent(MutableRel child)
      Replaces this MutableRel in its parent with another node at the same position.

      Before the method, child must be an orphan (have null parent) and after this method, this MutableRel is an orphan.

      Returns:
      The parent
    • digest

      public abstract StringBuilder digest(StringBuilder buf)
    • deep

      public final String deep()
    • toString

      public final String toString()
      Overrides:
      toString in class Object