c-thiel commented on code in PR #3693:
URL: https://github.com/apache/iceberg-rust/pull/3693#discussion_r4578349552


##########
crates/iceberg/src/spec/table_metadata.rs:
##########
@@ -1284,18 +1286,8 @@ pub(super) mod _serde {
                 default_sort_order_id: value
                     .default_sort_order_id
                     .unwrap_or(SortOrder::UNSORTED_ORDER_ID),
-                refs: if let Some(snapshot_id) = current_snapshot_id {
-                    HashMap::from_iter(vec![(MAIN_BRANCH.to_string(), 
SnapshotReference {
-                        snapshot_id,
-                        retention: SnapshotRetention::Branch {
-                            min_snapshots_to_keep: None,
-                            max_snapshot_age_ms: None,
-                            max_ref_age_ms: None,
-                        },
-                    })])
-                } else {
-                    HashMap::new()
-                },
+                // `try_normalize` adds `main` from `current-snapshot-id` if 
it is missing.
+                refs: value.refs.unwrap_or_default(),

Review Comment:
   I'd keep this PR to v1 and leave this behavior as it is for all format 
versions. The spec says "There is always a `main` branch reference pointing to 
the `current-snapshot-id` even if the `refs` map is null", and the `main` we 
add always matches `current-snapshot-id`, so Java reads the result the same 
way. I can open a separate issue for parity with Java's parser?
   



-- 
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]

Reply via email to