Package org.apache.calcite.rel
Class RelCollations
java.lang.Object
org.apache.calcite.rel.RelCollations
Utilities concerning
RelCollation
and RelFieldCollation.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final RelCollationA collation indicating that a relation is not sorted.static final RelCollationDeprecated. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancollationsContainKeysOrderless(List<RelCollation> collations, List<Integer> keys) Returns whether one of a list of collations contains the given list of keys regardless the order.static booleancontains(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.static booleancontains(RelCollation collation, Iterable<Integer> keys) Returns whether a collation indicates that the collection is sorted on a given list of keys.static booleancontainsOrderless(List<Integer> keys, RelCollation collation) Returns whether a collation is contained by a given list of keys regardless ordering.static booleancontainsOrderless(RelCollation collation, List<Integer> keys) Returns whether a collation contains a given list of keys regardless the order.static List<RelCollation>createSingleton(int fieldIndex) Creates a list containing one collation containing one field.static booleanequal(List<RelCollation> collationList1, List<RelCollation> collationList2) static booleanisValid(RelDataType rowType, List<RelCollation> collationList, boolean fail) Checks that a collection of collations is valid.static booleankeysContainCollationsOrderless(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.static RelCollationof(int fieldIndex) Creates a collation containing one field.static RelCollationof(List<RelFieldCollation> fieldCollations) static RelCollationof(RelFieldCollation... fieldCollations) static RelCollationof(ImmutableIntList keys) Creates a collation containing multiple fields.ordinals(List<RelFieldCollation> fieldCollations) Returns the indexes of the fields in a list of field collations.ordinals(RelCollation collation) Returns the indexes of the field collations in a given collation.static RelCollationpermute(RelCollation collation, Map<Integer, Integer> mapping) Creates a copy of this collation that changes the ordinals of input fields.static RelCollationpermute(RelCollation collation, Mappings.TargetMapping mapping) Creates a copy of this collation that changes the ordinals of input fields.static RelCollationshift(RelCollation collation, int offset)
-
Field Details
-
EMPTY
A collation indicating that a relation is not sorted. Ordering by no columns. -
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
-
of
-
of
Creates a collation containing one field. -
of
Creates a collation containing multiple fields. -
createSingleton
Creates a list containing one collation containing one field. -
isValid
Checks that a collection of collations is valid.- Parameters:
rowType- Row type of the relational expressioncollationList- List of collationsfail- Whether to fail if invalid- Returns:
- Whether valid
-
equal
-
ordinals
Returns the indexes of the field collations in a given collation. -
ordinals
Returns the indexes of the fields in a list of field collations. -
contains
Returns whether a collation indicates that the collection is sorted on a given list of keys.- Parameters:
collation- Collationkeys- List of keys- Returns:
- Whether the collection is sorted on the given keys
-
contains
Returns whether one of a list of collations indicates that the collection is sorted on the given list of keys. -
containsOrderless
Returns whether a collation contains a given list of keys regardless the order.- Parameters:
collation- Collationkeys- List of keys- Returns:
- Whether the collection contains the given keys
-
containsOrderless
Returns whether a collation is contained by a given list of keys regardless ordering.- Parameters:
keys- List of keyscollation- 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
-
permute
Creates a copy of this collation that changes the ordinals of input fields. -
permute
Creates a copy of this collation that changes the ordinals of input fields.
-