public interface RelTrait
CallingConvention.JAVA is a trait
of the ConventionTraitDef trait definition.
If all instances of RelTrait for a particular RelTraitDef are defined in
an enum and no new RelTraits can be introduced at runtime, you need
not override hashCode() and equals(Object). If, however,
new RelTrait instances are generated at runtime (e.g. based on state external
to the planner), you must implement hashCode() and
equals(Object) for proper canonization
of your RelTrait objects.
| Modifier and Type | Method and Description |
|---|---|
default <T extends RelTrait> |
apply(Mappings.TargetMapping mapping)
Applies a mapping to this trait.
|
boolean |
equals(@Nullable Object o)
|
RelTraitDef |
getTraitDef()
Returns the RelTraitDef that defines this RelTrait.
|
int |
hashCode()
|
default boolean |
isDefault()
Returns whether this trait is the default trait value.
|
void |
register(RelOptPlanner planner)
Registers a trait instance with the planner.
|
boolean |
satisfies(RelTrait trait)
Returns whether this trait satisfies a given trait.
|
String |
toString()
Returns a succinct name for this trait.
|
RelTraitDef getTraitDef()
boolean satisfies(RelTrait trait)
A trait satisfies another if it is the same or stricter. For example,
ORDER BY x, y satisfies ORDER BY x.
A trait's satisfies relation must be a partial order (reflexive,
anti-symmetric, transitive). Many traits cannot be "loosened"; their
satisfies 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.
trait - Given traitString toString()
void register(RelOptPlanner planner)
This is an opportunity to add rules that relate to that trait. However, typical implementations will do nothing.
planner - Plannerdefault <T extends RelTrait> T apply(Mappings.TargetMapping mapping)
Some traits may be changed if the columns order is changed by a mapping
of the Project operator.
For example, if relation SELECT a, b ORDER BY a, b is sorted by
columns [0, 1], then the project SELECT b, a over this relation
will be sorted by columns [1, 0]. In the same time project SELECT b
will not be sorted at all because it doesn't contain the collation
prefix and this method will return an empty collation.
Other traits are independent from the columns remapping. For example
Convention or RelDistributions.SINGLETON.
mapping - Mappingdefault boolean isDefault()
Copyright © 2012-2022 Apache Software Foundation. All Rights Reserved.