Class 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).

    • Constructor Detail

      • RelCollationTraitDef

        private RelCollationTraitDef()
    • Method Detail

      • 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 class RelTraitDef<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 class RelTraitDef<RelCollation>
        Parameters:
        planner - the planner requesting the conversion
        rel - RelNode to convert
        toCollation - RelTrait to convert to
        allowInfiniteCostConverters - 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 class RelTraitDef<RelCollation>
        Parameters:
        planner - the planner requesting the conversion test
        fromTrait - the RelTrait to convert from
        toTrait - 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 class RelTraitDef<RelCollation>
        Parameters:
        planner - the planner requesting the conversion test
        fromTrait - the RelTrait to convert from
        toTrait - the RelTrait to convert to
        fromRel - the RelNode to convert from (with fromTrait)
        Returns:
        true if fromTrait can be converted to toTrait