aditya-subrahmanyan commented on code in PR #1978:
URL: https://github.com/apache/iceberg-rust/pull/1978#discussion_r2658484320
##########
crates/iceberg/src/spec/table_metadata.rs:
##########
@@ -506,6 +506,19 @@ impl TableMetadata {
/// If the default sort order is unsorted but the sort order is not
present, add it
fn try_normalize_sort_order(&mut self) -> Result<()> {
+ // Validate that sort order ID 0 (reserved for unsorted) has no fields
+ if let Some(sort_order) =
self.sort_order_by_id(SortOrder::UNSORTED_ORDER_ID)
+ && !sort_order.fields.is_empty()
+ {
+ return Err(Error::new(
Review Comment:
It looks like we don't allow non-empty `fields` for reserved sort order ID:
https://github.com/apache/iceberg/blob/main/api/src/main/java/org/apache/iceberg/SortOrder.java#L269
IMO it feels safer to just report an error to the client that there's
something "fishy" about their metadata. What do you think?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]