|
24 | 24 | #include <vector> |
25 | 25 |
|
26 | 26 | #include "iceberg/expression/term.h" |
| 27 | +#include "iceberg/result.h" |
27 | 28 | #include "iceberg/sort_order.h" |
28 | 29 | #include "iceberg/table_metadata.h" |
29 | 30 | #include "iceberg/transaction.h" |
@@ -52,24 +53,22 @@ UpdateSortOrder& UpdateSortOrder::AddSortField(const std::shared_ptr<Term>& term |
52 | 53 | ICEBERG_BUILDER_CHECK(term->is_unbound(), "Term must be unbound"); |
53 | 54 |
|
54 | 55 | ICEBERG_BUILDER_ASSIGN_OR_RETURN(auto schema, transaction_->current().Schema()); |
55 | | - |
56 | | - int32_t source_id; |
57 | | - std::shared_ptr<Transform> transform; |
58 | | - |
59 | 56 | if (term->kind() == Term::Kind::kReference) { |
60 | 57 | // kReference is treated as identity transform |
61 | 58 | auto named_ref = internal::checked_pointer_cast<NamedReference>(term); |
62 | 59 | ICEBERG_BUILDER_ASSIGN_OR_RETURN(auto bound_ref, |
63 | 60 | named_ref->Bind(*schema, case_sensitive_)); |
64 | 61 | sort_fields_.emplace_back(bound_ref->field_id(), Transform::Identity(), direction, |
65 | 62 | null_order); |
66 | | - } else { |
67 | | - // kTransform - use the specified transform |
| 63 | + } else if (term->kind() == Term::Kind::kTransform) { |
68 | 64 | auto unbound_transform = internal::checked_pointer_cast<UnboundTransform>(term); |
69 | 65 | ICEBERG_BUILDER_ASSIGN_OR_RETURN(auto bound_term, |
70 | 66 | unbound_transform->Bind(*schema, case_sensitive_)); |
71 | 67 | sort_fields_.emplace_back(bound_term->reference()->field_id(), |
72 | 68 | unbound_transform->transform(), direction, null_order); |
| 69 | + } else { |
| 70 | + return AddError(ErrorKind::kNotSupported, "Not supported unbound term: {}", |
| 71 | + static_cast<int>(term->kind())); |
73 | 72 | } |
74 | 73 |
|
75 | 74 | return *this; |
|
0 commit comments