Class SortOrder

java.lang.Object
org.apache.iceberg.SortOrder
All Implemented Interfaces:
Serializable

public class SortOrder extends Object implements Serializable
A sort order that defines how data and delete files should be ordered in a table.
See Also:
  • Method Details

    • schema

      public Schema schema()
      Returns the Schema for this sort order
    • orderId

      public int orderId()
      Returns the ID of this sort order
    • fields

      public List<SortField> fields()
      Returns the list of sort fields for 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
    • toUnbound

      public UnboundSortOrder toUnbound()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class 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 new sort order builder for the given Schema.
      Parameters:
      schema - a schema
      Returns:
      a sort order builder for the given schema
    • checkCompatibility

      public static void checkCompatibility(SortOrder sortOrder, Schema schema)