Class RelCollationImpl

All Implemented Interfaces:
Comparable<RelMultipleTrait>, RelMultipleTrait, RelTrait, RelCollation

public class RelCollationImpl extends Object implements RelCollation
Simple implementation of RelCollation.
  • Field Details

  • Constructor Details

    • RelCollationImpl

      protected RelCollationImpl(<RelFieldCollation> fieldCollations)
  • Method Details

    • of

      @Deprecated public static RelCollation of(RelFieldCollation... fieldCollations)
    • of

      @Deprecated public static RelCollation of(List<RelFieldCollation> fieldCollations)
    • getTraitDef

      public RelTraitDef getTraitDef()
      Description copied from interface: RelTrait
      Returns the RelTraitDef that defines this RelTrait.
      Specified by:
      getTraitDef in interface RelTrait
      the RelTraitDef that defines this RelTrait
    • getFieldCollations

      public List<RelFieldCollation> getFieldCollations()
      Description copied from interface: RelCollation
      Returns the ordinals and directions of the columns in this ordering.
      Specified by:
      getFieldCollations in interface RelCollation
    • hashCode

      public int hashCode()
      Description copied from interface: RelTrait
      Specified by:
      hashCode in interface RelTrait
      hashCode in class Object
    • equals

      public boolean equals(@Nullable Object obj)
      Description copied from interface: RelTrait
      Specified by:
      equals in interface RelTrait
      equals in class Object
    • isTop

      public boolean isTop()
      Description copied from interface: RelMultipleTrait
      Returns whether this trait is satisfied by every instance of the trait (including itself).
      Specified by:
      isTop in interface RelMultipleTrait
    • compareTo

      public int compareTo(RelMultipleTrait o)
      Specified by:
      compareTo in interface Comparable<RelMultipleTrait>
    • 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.

      Specified by:
      register in interface RelTrait
      planner - Planner
    • apply

      public RelCollationImpl apply(Mappings.TargetMapping mapping)
      Applies mapping to a given collation.

      If mapping destroys the collation prefix, this method returns an empty collation. Examples of applying mappings to collation [0, 1]:

      • mapping(0, 1) => [0, 1]
      • mapping(1, 0) => [1, 0]
      • mapping(0) => [0]
      • mapping(1) => []
      • mapping(2, 0) => [1]
      • mapping(2, 1, 0) => [2, 1]
      • mapping(2, 1) => []
      Specified by:
      apply in interface RelTrait
      mapping - Mapping
      Collation with applied mapping.
    • 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 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.

      Specified by:
      satisfies in interface RelTrait
      trait - Given trait
      Whether this trait subsumes a given trait
    • toString

      public String toString()
      Returns a string representation of this collation, suitably terse given that it will appear in plan traces. Examples: "[]", "[2]", "[0 DESC, 1]", "[0 DESC, 1 ASC NULLS LAST]".
      Specified by:
      toString in interface RelTrait
      toString in class Object
    • createSingleton

      @Deprecated public static List<RelCollation> createSingleton(int fieldIndex)
    • isValid

      @Deprecated public static boolean isValid(RelDataType rowType, List<RelCollation> collationList, boolean fail)
    • equal

      @Deprecated public static boolean equal(List<RelCollation> collationList1, List<RelCollation> collationList2)
    • ordinals

      @Deprecated public static List<Integer> ordinals(RelCollation collation)