Package org.apache.calcite.plan
Class RelCompositeTrait<T extends RelMultipleTrait>
- java.lang.Object
-
- org.apache.calcite.plan.RelCompositeTrait<T>
-
- Type Parameters:
T
- Member trait
- All Implemented Interfaces:
RelTrait
class RelCompositeTrait<T extends RelMultipleTrait> extends java.lang.Object implements RelTrait
A trait that consists of a list of traits, all of the same type.It exists so that multiple traits of the same type (
RelTraitDef
) can be stored in the sameRelTraitSet
.
-
-
Field Summary
Fields Modifier and Type Field Description private RelTraitDef
traitDef
private T[]
traits
-
Constructor Summary
Constructors Modifier Constructor Description private
RelCompositeTrait(RelTraitDef traitDef, T[] traits)
Creates a RelCompositeTrait.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
RelTraitDef
getTraitDef()
Returns the RelTraitDef that defines this RelTrait.int
hashCode()
(package private) static <T extends RelMultipleTrait>
RelTraitof(RelTraitDef def, java.util.List<T> traitList)
Creates a RelCompositeTrait.void
register(RelOptPlanner planner)
Registers a trait instance with the planner.boolean
satisfies(RelTrait trait)
Returns whether this trait satisfies a given trait.int
size()
Returns the number of traits.java.lang.String
toString()
Returns a succinct name for this trait.T
trait(int i)
Returns thei
th trait.java.util.List<T>
traitList()
Returns an immutable list of the traits in this composite trait.
-
-
-
Field Detail
-
traitDef
private final RelTraitDef traitDef
-
traits
private final T extends RelMultipleTrait[] traits
-
-
Constructor Detail
-
RelCompositeTrait
private RelCompositeTrait(RelTraitDef traitDef, T[] traits)
Creates a RelCompositeTrait.
-
-
Method Detail
-
of
static <T extends RelMultipleTrait> RelTrait of(RelTraitDef def, java.util.List<T> traitList)
Creates a RelCompositeTrait. The constituent traits are canonized.
-
getTraitDef
public RelTraitDef getTraitDef()
Description copied from interface:RelTrait
Returns the RelTraitDef that defines this RelTrait.- Specified by:
getTraitDef
in interfaceRelTrait
- Returns:
- the RelTraitDef that defines this RelTrait
-
hashCode
public int hashCode()
Description copied from interface:RelTrait
-
equals
public boolean equals(java.lang.Object obj)
Description copied from interface:RelTrait
-
toString
public java.lang.String toString()
Description copied from interface:RelTrait
Returns a succinct name for this trait. The planner may use this String to describe the trait.
-
satisfies
public boolean satisfies(RelTrait trait)
Description copied from interface:RelTrait
Returns whether this trait satisfies a given trait.A trait satisfies another if it is the same or stricter. For example,
ORDER BY x, y
satisfiesORDER BY x
.A trait's
satisfies
relation must be a partial order (reflexive, anti-symmetric, transitive). Many traits cannot be "loosened"; theirsatisfies
is an equivalence relation, where only X satisfies X.If a trait has multiple values (see
RelCompositeTrait
) a collection (T0, T1, ...) satisfies T if any Ti satisfies T.
-
register
public void register(RelOptPlanner planner)
Description copied from interface:RelTrait
Registers a trait instance with the planner.This is an opportunity to add rules that relate to that trait. However, typical implementations will do nothing.
-
traitList
public java.util.List<T> traitList()
Returns an immutable list of the traits in this composite trait.
-
trait
public T trait(int i)
Returns thei
th trait.
-
size
public int size()
Returns the number of traits.
-
-