Package org.apache.calcite.rel
Class RelCollations
java.lang.Object
org.apache.calcite.rel.RelCollations
Utilities concerning
RelCollation
and RelFieldCollation
.-
Field Summary
Modifier and TypeFieldDescriptionstatic final RelCollation
A collation indicating that a relation is not sorted.static final RelCollation
Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionstatic 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.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.static boolean
contains
(RelCollation collation, Iterable<Integer> keys) Returns whether a collation indicates that the collection is sorted on a given list of keys.static boolean
containsOrderless
(List<Integer> keys, RelCollation collation) Returns whether a collation is contained by a given list of keys regardless ordering.static boolean
containsOrderless
(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 boolean
equal
(List<RelCollation> collationList1, List<RelCollation> collationList2) static boolean
isValid
(RelDataType rowType, List<RelCollation> collationList, boolean fail) Checks that a collection of collations is valid.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.static RelCollation
of
(int fieldIndex) Creates a collation containing one field.static RelCollation
of
(List<RelFieldCollation> fieldCollations) static RelCollation
of
(RelFieldCollation... fieldCollations) static RelCollation
of
(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 RelCollation
permute
(RelCollation collation, Map<Integer, Integer> mapping) Creates a copy of this collation that changes the ordinals of input fields.static RelCollation
permute
(RelCollation collation, Mappings.TargetMapping mapping) Creates a copy of this collation that changes the ordinals of input fields.static RelCollation
shift
(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.
-