Class MutableRel

  • Direct Known Subclasses:
    MutableBiRel, MutableLeafRel, MutableMultiRel, MutableSingleRel

    public abstract class MutableRel
    extends java.lang.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 Detail

      • STRING_EQUIVALENCE

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

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

        protected int ordinalInParent
    • Method Detail

      • setInput

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

        public abstract java.util.List<MutableRel> getInputs()
      • clone

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

        public abstract void childrenAccept​(MutableRelVisitor visitor)
      • replaceInParent

        public 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 java.lang.StringBuilder digest​(java.lang.StringBuilder buf)
      • deep

        public final java.lang.String deep()
      • toString

        public final java.lang.String toString()
        Overrides:
        toString in class java.lang.Object