Interface RelTrait
-
- All Known Subinterfaces:
Convention
,RelCollation
,RelDistribution
,RelMultipleTrait
- All Known Implementing Classes:
BindableConvention
,Convention.Impl
,EnumerableConvention
,InterpretableConvention
,JdbcConvention
,RelCollationImpl
,RelCompositeTrait
,RelDistributions.RelDistributionImpl
public interface RelTrait
RelTrait represents the manifestation of a relational expression trait within a trait definition. For example, aCallingConvention.JAVA
is a trait of theConventionTraitDef
trait definition.Note about equals() and hashCode()
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 overridehashCode()
andequals(Object)
. If, however, new RelTrait instances are generated at runtime (e.g. based on state external to the planner), you must implementhashCode()
andequals(Object)
for propercanonization
of your RelTrait objects.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
RelTraitDef
getTraitDef()
Returns the RelTraitDef that defines this RelTrait.int
hashCode()
void
register(RelOptPlanner planner)
Registers a trait instance with the planner.boolean
satisfies(RelTrait trait)
Returns whether this trait satisfies a given trait.java.lang.String
toString()
Returns a succinct name for this trait.
-
-
-
Method Detail
-
getTraitDef
RelTraitDef getTraitDef()
Returns the RelTraitDef that defines this RelTrait.- Returns:
- the RelTraitDef that defines this RelTrait
-
hashCode
int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
satisfies
boolean satisfies(RelTrait trait)
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.- Parameters:
trait
- Given trait- Returns:
- Whether this trait subsumes a given trait
-
toString
java.lang.String toString()
Returns a succinct name for this trait. The planner may use this String to describe the trait.- Overrides:
toString
in classjava.lang.Object
-
register
void register(RelOptPlanner planner)
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.
- Parameters:
planner
- Planner
-
-