Package org.apache.calcite.rel
Class RelCollations
- java.lang.Object
-
- org.apache.calcite.rel.RelCollations
-
public class RelCollations extends java.lang.Object
Utilities concerningRelCollation
andRelFieldCollation
.
-
-
Field Summary
Fields Modifier and Type Field Description static RelCollation
EMPTY
A collation indicating that a relation is not sorted.static RelCollation
PRESERVE
Deprecated.
-
Constructor Summary
Constructors Modifier Constructor Description private
RelCollations()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
contains(java.util.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, java.lang.Iterable<java.lang.Integer> keys)
Returns whether a collation indicates that the collection is sorted on a given list of keys.private static boolean
contains(RelCollation collation, java.util.List<java.lang.Integer> keys)
static java.util.List<RelCollation>
createSingleton(int fieldIndex)
Creates a list containing one collation containing one field.static boolean
equal(java.util.List<RelCollation> collationList1, java.util.List<RelCollation> collationList2)
static boolean
isValid(RelDataType rowType, java.util.List<RelCollation> collationList, boolean fail)
Checks that a collection of collations is valid.static RelCollation
of(int fieldIndex)
Creates a collation containing one field.static RelCollation
of(java.util.List<RelFieldCollation> fieldCollations)
static RelCollation
of(RelFieldCollation... fieldCollations)
static java.util.List<java.lang.Integer>
ordinals(java.util.List<RelFieldCollation> fieldCollations)
Returns the indexes of the fields in a list of field collations.static java.util.List<java.lang.Integer>
ordinals(RelCollation collation)
Returns the indexes of the field collations in a given collation.static RelCollation
permute(RelCollation collation, java.util.Map<java.lang.Integer,java.lang.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 Detail
-
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 Detail
-
of
public static RelCollation of(RelFieldCollation... fieldCollations)
-
of
public static RelCollation of(java.util.List<RelFieldCollation> fieldCollations)
-
of
public static RelCollation of(int fieldIndex)
Creates a collation containing one field.
-
createSingleton
public static java.util.List<RelCollation> createSingleton(int fieldIndex)
Creates a list containing one collation containing one field.
-
isValid
public static boolean isValid(RelDataType rowType, java.util.List<RelCollation> collationList, boolean fail)
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
public static boolean equal(java.util.List<RelCollation> collationList1, java.util.List<RelCollation> collationList2)
-
ordinals
public static java.util.List<java.lang.Integer> ordinals(RelCollation collation)
Returns the indexes of the field collations in a given collation.
-
ordinals
public static java.util.List<java.lang.Integer> ordinals(java.util.List<RelFieldCollation> fieldCollations)
Returns the indexes of the fields in a list of field collations.
-
contains
public static boolean contains(RelCollation collation, java.lang.Iterable<java.lang.Integer> keys)
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
private static boolean contains(RelCollation collation, java.util.List<java.lang.Integer> keys)
-
contains
public static boolean contains(java.util.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.
-
shift
public static RelCollation shift(RelCollation collation, int offset)
-
permute
public static RelCollation permute(RelCollation collation, java.util.Map<java.lang.Integer,java.lang.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.
-
-