Class RelCollationImpl

java.lang.Object
org.apache.calcite.rel.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(com.google.common.collect.ImmutableList<RelFieldCollation> fieldCollations)
  • Method Details

    • of

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

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

      public RelTraitDef getTraitDef()
      Description copied from interface: RelTrait
      Returns the RelTraitDef that defines this RelTrait.
      Specified by:
      getTraitDef in interface RelTrait
      Returns:
      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
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(@Nullable Object obj)
      Description copied from interface: RelTrait
      Specified by:
      equals in interface RelTrait
      Overrides:
      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
      Parameters:
      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
      Parameters:
      mapping - Mapping
      Returns:
      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
      Parameters:
      trait - Given trait
      Returns:
      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
      Overrides:
      toString in class Object
    • createSingleton

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

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

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

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