c-thiel opened a new pull request, #3693:
URL: https://github.com/apache/iceberg-rust/pull/3693

   ## Which issue does this PR close?
   
   None yet - do we need one?
   
   ## What changes are included in this PR?
   
   `TableMetadataV1` had no `refs` field. Reading format-version 1 metadata 
dropped every branch and tag and kept only a `main` branch built from 
`current-snapshot-id`. Writing it left `refs` out.
   
   Iceberg Java reads and writes `refs` for every format version 
(`TableMetadataParser`, since apache/iceberg#4260), and Spark creates tags and 
branches on v1 tables. The spec lists `refs` from v2 on, but does not forbid it 
in v1, and says there is always a `main` branch pointing to 
`current-snapshot-id`.
   
   - v1 metadata now reads and writes `refs` the same way v2 and v3 do.
   - If `refs` is missing, `try_normalize` still builds `main` from 
`current-snapshot-id`.
   - v1 refs are now validated like v2 and v3 refs: every ref must point to an 
existing snapshot, and `main` must match `current-snapshot-id`. Java applies 
the same checks.
   
   ## Are these changes tested?
   
   Yes, with unit tests in `spec::table_metadata`:
   
   - `test_table_metadata_v1_refs_round_trip` reads v1 metadata written by 
Spark 3.5.6 with Iceberg 1.9.2 after creating a tag and a branch (paths 
rewritten). It checks all three refs, checks that the `refs` this crate writes 
equal the `refs` Java wrote, and reads the written metadata back.
   - `test_table_metadata_v1_without_refs_has_main_branch` removes `refs` from 
the same file and checks that `main` comes from `current-snapshot-id` and is 
written back.
   
   ## AI Disclosure
   
   Supported by Claude Code. Reviewed and checked by me.
   


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