Package org.apache.calcite.rel.mutable
Class MutableRel
- java.lang.Object
-
- org.apache.calcite.rel.mutable.MutableRel
-
- Direct Known Subclasses:
MutableBiRel
,MutableLeafRel
,MutableMultiRel
,MutableSingleRel
public abstract class MutableRel extends java.lang.Object
Mutable equivalent ofRelNode
.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 theirRelNode
counterparts. But, you don't need to copy aMutableRel
in order to change it. For this reason, you should useMutableRel
for short-lived operations, and transcribe back toRelNode
when you are done.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
MutableRel.MutableRelDumper
Implementation of MutableVisitor that dumps the details of a MutableRel tree.
-
Field Summary
Fields Modifier and Type Field Description RelOptCluster
cluster
protected int
ordinalInParent
protected static com.google.common.base.Equivalence<java.util.List<?>>
PAIRWISE_STRING_EQUIVALENCE
Equivalence that comparesLists
s by theObject.toString()
of their elements.protected MutableRel
parent
RelDataType
rowType
protected static com.google.common.base.Equivalence<java.lang.Object>
STRING_EQUIVALENCE
Equivalence that compares objects by theirObject.toString()
method.protected MutableRelType
type
-
Constructor Summary
Constructors Modifier Constructor Description protected
MutableRel(RelOptCluster cluster, RelDataType rowType, MutableRelType type)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
childrenAccept(MutableRelVisitor visitor)
abstract MutableRel
clone()
java.lang.String
deep()
abstract java.lang.StringBuilder
digest(java.lang.StringBuilder buf)
abstract java.util.List<MutableRel>
getInputs()
MutableRel
getParent()
MutableRel
replaceInParent(MutableRel child)
Replaces thisMutableRel
in its parent with another node at the same position.abstract void
setInput(int ordinalInParent, MutableRel input)
java.lang.String
toString()
-
-
-
Field Detail
-
STRING_EQUIVALENCE
protected static final com.google.common.base.Equivalence<java.lang.Object> STRING_EQUIVALENCE
Equivalence that compares objects by theirObject.toString()
method.
-
PAIRWISE_STRING_EQUIVALENCE
protected static final com.google.common.base.Equivalence<java.util.List<?>> PAIRWISE_STRING_EQUIVALENCE
Equivalence that comparesLists
s by theObject.toString()
of their elements.
-
cluster
public final RelOptCluster cluster
-
rowType
public final RelDataType rowType
-
type
protected final MutableRelType type
-
parent
protected MutableRel parent
-
ordinalInParent
protected int ordinalInParent
-
-
Constructor Detail
-
MutableRel
protected MutableRel(RelOptCluster cluster, RelDataType rowType, MutableRelType type)
-
-
Method Detail
-
getParent
public MutableRel getParent()
-
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 classjava.lang.Object
-
childrenAccept
public abstract void childrenAccept(MutableRelVisitor visitor)
-
replaceInParent
public MutableRel replaceInParent(MutableRel child)
Replaces thisMutableRel
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, thisMutableRel
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 classjava.lang.Object
-
-