Package org.apache.iceberg
Class SortOrder
- java.lang.Object
-
- org.apache.iceberg.SortOrder
-
- All Implemented Interfaces:
java.io.Serializable
public class SortOrder extends java.lang.Object implements java.io.SerializableA sort order that defines how data and delete files should be ordered in a table.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSortOrder.BuilderA builder used to create validsort orders.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SortOrder.BuilderbuilderFor(Schema schema)Creates a newsort order builderfor the givenSchema.static voidcheckCompatibility(SortOrder sortOrder, Schema schema)booleanequals(java.lang.Object other)java.util.List<SortField>fields()Returns the list ofsort fieldsfor this sort orderinthashCode()booleanisSorted()Returns true if the sort order is sortedbooleanisUnsorted()Returns true if the sort order is unsortedintorderId()Returns the ID of this sort orderbooleansameOrder(SortOrder anotherSortOrder)Checks whether this order is equivalent to another order while ignoring the order id.booleansatisfies(SortOrder anotherSortOrder)Checks whether this order satisfies another order.Schemaschema()Returns theSchemafor this sort orderjava.lang.StringtoString()static SortOrderunsorted()Returns a sort order for unsorted tables.
-
-
-
Method Detail
-
orderId
public int orderId()
Returns the ID of this sort order
-
fields
public java.util.List<SortField> fields()
Returns the list ofsort fieldsfor this sort order
-
isSorted
public boolean isSorted()
Returns true if the sort order is sorted
-
isUnsorted
public boolean isUnsorted()
Returns true if the sort order is unsorted
-
satisfies
public boolean satisfies(SortOrder anotherSortOrder)
Checks whether this order satisfies another order.- Parameters:
anotherSortOrder- a different sort order- Returns:
- true if this order satisfies the given order
-
sameOrder
public boolean sameOrder(SortOrder anotherSortOrder)
Checks whether this order is equivalent to another order while ignoring the order id.- Parameters:
anotherSortOrder- a different sort order- Returns:
- true if this order is equivalent to the given order
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
unsorted
public static SortOrder unsorted()
Returns a sort order for unsorted tables.- Returns:
- an unsorted order
-
builderFor
public static SortOrder.Builder builderFor(Schema schema)
Creates a newsort order builderfor the givenSchema.- Parameters:
schema- a schema- Returns:
- a sort order builder for the given schema
-
-