30#include "iceberg/iceberg_export.h"
31#include "iceberg/result.h"
45ICEBERG_EXPORT
constexpr std::string_view ToString(
SortDirection direction) {
47 case SortDirection::kAscending:
49 case SortDirection::kDescending:
57 std::string_view str) {
58 if (str ==
"asc")
return SortDirection::kAscending;
59 if (str ==
"desc")
return SortDirection::kDescending;
60 return InvalidArgument(
"Invalid SortDirection string: {}", str);
70ICEBERG_EXPORT
constexpr std::string_view ToString(
NullOrder null_order) {
72 case NullOrder::kFirst:
74 case NullOrder::kLast:
82 if (str ==
"nulls-first")
return NullOrder::kFirst;
83 if (str ==
"nulls-last")
return NullOrder::kLast;
84 return InvalidArgument(
"Invalid NullOrder string: {}", str);
95 SortField(int32_t source_id, std::shared_ptr<Transform> transform,
99 int32_t source_id()
const;
102 const std::shared_ptr<Transform>& transform()
const;
111 bool Satisfies(
const SortField& other)
const;
113 std::string ToString()
const override;
119 return lhs.Equals(rhs);
124 [[nodiscard]]
bool Equals(
const SortField& other)
const;
127 std::shared_ptr<Transform> transform_;
a field with its transform.
Definition sort_field.h:88
ICEBERG_EXPORT constexpr Result< NullOrder > NullOrderFromString(std::string_view str)
Get the relative null order from name.
Definition sort_field.h:81
SortDirection
Sort direction in a partition, either ascending or descending.
Definition sort_field.h:38
ICEBERG_EXPORT constexpr Result< SortDirection > SortDirectionFromString(std::string_view str)
Get the relative sort direction from name.
Definition sort_field.h:56
NullOrder
Definition sort_field.h:63
@ kFirst
Nulls are sorted first.
@ kLast
Nulls are sorted last.