linzch3 opened a new pull request, #3625:
URL: https://github.com/apache/iceberg-rust/pull/3625

   ## Which issue does this PR close?
   
   - Closes #3371.
   
   ## What changes are included in this PR?
   
   `ManifestEntryV1::snapshot_id` is now an `Option<i64>`, so 
`Manifest::parse_avro` reads a V1 entry whose `snapshot_id` is null as `None` 
instead of failing with `invalid type: unit value, expected i64`. 
`ManifestEntry::inherit_data` then fills it in from the manifest list's 
`added_snapshot_id`, the same way it already does for V2.
   
   This matches Iceberg Java, which declares `snapshot_id` optional in 
`ManifestEntry`/`V1Metadata` and writes null for v1 tables with 
`compatibility.snapshot-id-inheritance.enabled=true`.
   
   To keep the change to the read side only:
   - V1 entries are still written with a required `long` `snapshot_id` (a 
`None` still writes `0`, as before).
   - The field must still be present when reading; only a null value is 
accepted. `test_parse_v1_manifest_without_each_field` still lists `snapshot_id` 
as required and passes unchanged.
   
   On the spec question raised in the issue: the spec marks the field required 
in v1, so this only makes the reader more lenient with files Java already 
writes and reads. It doesn't change what iceberg-rust writes.
   
   ## Are these changes tested?
   
   Yes. `test_parse_v1_manifest_with_null_snapshot_id` writes a V1 manifest 
with Java's `["null", "long"]` `snapshot_id` and checks that a value reads as 
`Some(7)` and a null reads as `None`. It fails without the fix.
   
   Ran locally: `cargo test -p iceberg --lib` (2105 passed), `cargo clippy -p 
iceberg --all-targets -- -D warnings`, `cargo fmt --all -- --check`.
   
   ## AI Disclosure
   
   This change was prepared with an AI coding assistant (Grok Bot); the tests 
above were run locally. Area of uncertainty: whether the project wants to 
accept these files before the spec question is settled on the dev list. If not, 
I'm happy to hold this PR until it is.
   


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