Class RelCollations

java.lang.Object
org.apache.calcite.rel.RelCollations

public class RelCollations extends Object
Utilities concerning RelCollation and RelFieldCollation.
  • Field Details

    • EMPTY

      public static final RelCollation EMPTY
      A collation indicating that a relation is not sorted. Ordering by no columns.
    • PRESERVE

      @Deprecated public static final RelCollation PRESERVE
      Deprecated.
      A collation that cannot be replicated by applying a sort. The only implementation choice is to apply operations that preserve order.
  • Method Details

    • of

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

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

      public static RelCollation of(int fieldIndex)
      Creates a collation containing one field.
    • of

      public static RelCollation of(ImmutableIntList keys)
      Creates a collation containing multiple fields.
    • createSingleton

      public static List<RelCollation> createSingleton(int fieldIndex)
      Creates a list containing one collation containing one field.
    • isValid

      public static boolean isValid(RelDataType rowType, List<RelCollation> collationList, boolean fail)
      Checks that a collection of collations is valid.
      Parameters:
      rowType - Row type of the relational expression
      collationList - List of collations
      fail - Whether to fail if invalid
      Returns:
      Whether valid
    • equal

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

      public static List<Integer> ordinals(RelCollation collation)
      Returns the indexes of the field collations in a given collation.
    • ordinals

      public static List<Integer> ordinals(List<RelFieldCollation> fieldCollations)
      Returns the indexes of the fields in a list of field collations.
    • contains

      public static boolean contains(RelCollation collation, Iterable<Integer> keys)
      Returns whether a collation indicates that the collection is sorted on a given list of keys.
      Parameters:
      collation - Collation
      keys - List of keys
      Returns:
      Whether the collection is sorted on the given keys
    • contains

      public static boolean contains(List<RelCollation> collations, ImmutableIntList keys)
      Returns whether one of a list of collations indicates that the collection is sorted on the given list of keys.
    • containsOrderless

      public static boolean containsOrderless(RelCollation collation, List<Integer> keys)
      Returns whether a collation contains a given list of keys regardless the order.
      Parameters:
      collation - Collation
      keys - List of keys
      Returns:
      Whether the collection contains the given keys
    • containsOrderless

      public static boolean containsOrderless(List<Integer> keys, RelCollation collation)
      Returns whether a collation is contained by a given list of keys regardless ordering.
      Parameters:
      keys - List of keys
      collation - Collation
      Returns:
      Whether the collection contains the given keys
    • collationsContainKeysOrderless

      public static boolean collationsContainKeysOrderless(List<RelCollation> collations, List<Integer> keys)
      Returns whether one of a list of collations contains the given list of keys regardless the order.
    • keysContainCollationsOrderless

      public static boolean keysContainCollationsOrderless(List<Integer> keys, List<RelCollation> collations)
      Returns whether one of a list of collations is contained by the given list of keys regardless the order.
    • shift

      public static RelCollation shift(RelCollation collation, int offset)
    • permute

      public static RelCollation permute(RelCollation collation, Map<Integer,Integer> mapping)
      Creates a copy of this collation that changes the ordinals of input fields.
    • permute

      public static RelCollation permute(RelCollation collation, Mappings.TargetMapping mapping)
      Creates a copy of this collation that changes the ordinals of input fields.