28#include <unordered_set>
45 static constexpr int32_t kUnsortedOrderId = 0;
46 static constexpr int32_t kInitialSortOrderId = 1;
49 static const std::shared_ptr<SortOrder>&
Unsorted();
55 std::span<const SortField>
fields()
const;
74 return lhs.Equals(rhs);
88 std::vector<SortField> fields);
96 std::vector<SortField> fields);
98 static std::unordered_set<std::string_view> OrderPreservingSortedColumns(
106 SortOrder(int32_t order_id, std::vector<SortField> fields);
109 bool Equals(
const SortOrder& other)
const;
112 std::vector<SortField> fields_;
A schema for a Table.
Definition schema.h:51
A sort order for a table.
Definition sort_order.h:43
bool SameOrder(const SortOrder &other) const
Checks whether this order is equivalent to another order while ignoring the order id.
static Result< std::unique_ptr< SortOrder > > Make(int32_t sort_id, std::vector< SortField > fields)
Create a SortOrder without binding to a schema.
std::span< const SortField > fields() const
Get the list of sort fields.
int32_t order_id() const
Get the sort order id.
std::string ToString() const override
Get a user-readable string representation.
bool is_sorted() const
Returns true if the sort order is sorted.
Definition sort_order.h:58
bool Satisfies(const SortOrder &other) const
Checks whether this order satisfies another order.
Status Validate(const Schema &schema) const
Validates the sort order against a schema.
static const std::shared_ptr< SortOrder > & Unsorted()
Get an unsorted sort order singleton.
static Result< std::unique_ptr< SortOrder > > Make(const Schema &schema, int32_t sort_id, std::vector< SortField > fields)
Create a SortOrder.
bool is_unsorted() const
Returns true if the sort order is unsorted A SortOrder is unsorted if it has no sort fields.
Definition sort_order.h:62
Define symbol visibility macros for core Iceberg APIs.
Core Apache Iceberg C++ APIs.
Definition arrow_io_util.h:33
std::expected< T, E > Result
Result alias.
Definition result.h:88