Class SortOrderUtil

java.lang.Object
org.apache.iceberg.util.SortOrderUtil

public class SortOrderUtil extends Object
  • Method Details

    • buildSortOrder

      public static SortOrder buildSortOrder(Table table)
    • buildSortOrder

      public static SortOrder buildSortOrder(Table table, SortOrder sortOrder)
    • findTableSortOrder

      public static SortOrder findTableSortOrder(Table table, SortOrder userSuppliedSortOrder)
      Attempts to match a user-supplied SortOrder with an equivalent sort order from a Table.
      Parameters:
      table - the table to try and match the sort order against
      userSuppliedSortOrder - the user supplied sort order to try and match with a table sort order
      Returns:
      the matching SortOrder from the table (with the orderId set) or SortOrder.unsorted() if no match is found.
    • buildSortOrder

      public static SortOrder buildSortOrder(Schema schema, PartitionSpec spec, SortOrder sortOrder)
      Build a final sort order that satisfies the clustering required by the partition spec.

      The incoming sort order may or may not satisfy the clustering needed by the partition spec. This modifies the sort order so that it clusters by partition and still produces the same order within each partition.

      Parameters:
      schema - a schema
      spec - a partition spec
      sortOrder - a sort order
      Returns:
      the sort order with additional sort fields to satisfy the clustering required by the spec
    • orderPreservingSortedColumns

      public static Set<String> orderPreservingSortedColumns(SortOrder sortOrder)