Package org.apache.calcite.rel
Class RelCollationTraitDef
- java.lang.Object
-
- org.apache.calcite.plan.RelTraitDef<RelCollation>
-
- org.apache.calcite.rel.RelCollationTraitDef
-
public class RelCollationTraitDef extends RelTraitDef<RelCollation>
Definition of the ordering trait.Ordering is a physical property (i.e. a trait) because it can be changed without loss of information. The converter to do this is the
Sort
operator.Unlike other current traits, a
RelNode
can have more than one value of this trait simultaneously. For example,LogicalTableScan(table=TIME_BY_DAY)
might be sorted by{the_year, the_month, the_date}
and also by{time_id}
. We have to allow a RelNode to belong to more than one RelSubset (these RelSubsets are always in the same set).
-
-
Field Summary
Fields Modifier and Type Field Description static RelCollationTraitDef
INSTANCE
-
Constructor Summary
Constructors Modifier Constructor Description private
RelCollationTraitDef()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canConvert(RelOptPlanner planner, RelCollation fromTrait, RelCollation toTrait)
Tests whether the given RelTrait can be converted to another RelTrait.boolean
canConvert(RelOptPlanner planner, RelCollation fromTrait, RelCollation toTrait, RelNode fromRel)
Tests whether the given RelTrait can be converted to another RelTrait.RelNode
convert(RelOptPlanner planner, RelNode rel, RelCollation toCollation, boolean allowInfiniteCostConverters)
Converts the given RelNode to the given RelTrait.RelCollation
getDefault()
Returns the default member of this trait.java.lang.String
getSimpleName()
java.lang.Class<RelCollation>
getTraitClass()
boolean
multiple()
Whether a relational expression may possess more than one instance of this trait simultaneously.-
Methods inherited from class org.apache.calcite.plan.RelTraitDef
canonize, deregisterConverterRule, registerConverterRule
-
-
-
-
Field Detail
-
INSTANCE
public static final RelCollationTraitDef INSTANCE
-
-
Method Detail
-
getTraitClass
public java.lang.Class<RelCollation> getTraitClass()
- Specified by:
getTraitClass
in classRelTraitDef<RelCollation>
- Returns:
- the specific RelTrait type associated with this RelTraitDef.
-
getSimpleName
public java.lang.String getSimpleName()
- Specified by:
getSimpleName
in classRelTraitDef<RelCollation>
- Returns:
- a simple name for this RelTraitDef (for use in
RelNode.explain(org.apache.calcite.rel.RelWriter)
).
-
multiple
public boolean multiple()
Description copied from class:RelTraitDef
Whether a relational expression may possess more than one instance of this trait simultaneously.A subset has only one instance of a trait.
- Overrides:
multiple
in classRelTraitDef<RelCollation>
-
getDefault
public RelCollation getDefault()
Description copied from class:RelTraitDef
Returns the default member of this trait.- Specified by:
getDefault
in classRelTraitDef<RelCollation>
-
convert
public RelNode convert(RelOptPlanner planner, RelNode rel, RelCollation toCollation, boolean allowInfiniteCostConverters)
Description copied from class:RelTraitDef
Converts the given RelNode to the given RelTrait.- Specified by:
convert
in classRelTraitDef<RelCollation>
- Parameters:
planner
- the planner requesting the conversionrel
- RelNode to converttoCollation
- RelTrait to convert toallowInfiniteCostConverters
- flag indicating whether infinite cost converters are allowed- Returns:
- a converted RelNode or null if conversion is not possible
-
canConvert
public boolean canConvert(RelOptPlanner planner, RelCollation fromTrait, RelCollation toTrait)
Description copied from class:RelTraitDef
Tests whether the given RelTrait can be converted to another RelTrait.- Specified by:
canConvert
in classRelTraitDef<RelCollation>
- Parameters:
planner
- the planner requesting the conversion testfromTrait
- the RelTrait to convert fromtoTrait
- the RelTrait to convert to- Returns:
- true if fromTrait can be converted to toTrait
-
canConvert
public boolean canConvert(RelOptPlanner planner, RelCollation fromTrait, RelCollation toTrait, RelNode fromRel)
Description copied from class:RelTraitDef
Tests whether the given RelTrait can be converted to another RelTrait.- Overrides:
canConvert
in classRelTraitDef<RelCollation>
- Parameters:
planner
- the planner requesting the conversion testfromTrait
- the RelTrait to convert fromtoTrait
- the RelTrait to convert tofromRel
- the RelNode to convert from (with fromTrait)- Returns:
- true if fromTrait can be converted to toTrait
-
-