karubian opened a new issue, #3636:
URL: https://github.com/apache/iceberg-rust/issues/3636

   ### Apache Iceberg Rust version
   
   v0.11.0
   
   ### Describe the bug
   
   Iceberg Java and PyIceberg don't write the `schema-id` key in manifest 
metadata. The schema id is only inside the `schema` JSON. 
`ManifestMetadata::parse` treats a missing key as 0, so `schema_id()` returns 0 
for every manifest those writers produce, while `schema().schema_id()` has the 
real id.
   
   - iceberg-rust: 
https://github.com/apache/iceberg-rust/blob/59946648ef56dcd5b70d46cc7ef90b25a00ed9fb/crates/iceberg/src/spec/manifest/metadata.rs#L54-L62
   - Java: 
https://github.com/apache/iceberg/blob/b56b4bf9d6f3f4547fd3773e8fd78239869fad4b/core/src/main/java/org/apache/iceberg/ManifestWriter.java#L474-L478
   - PyIceberg: 
https://github.com/apache/iceberg-python/blob/e3564a54c10960307147377c578680276865ed18/pyiceberg/manifest.py#L1161-L1169
   
   ### To Reproduce
   
   ```rust
   use std::collections::HashMap;
   
   use iceberg::spec::ManifestMetadata;
   
   let meta = HashMap::from([
       ("schema".to_string(), 
br#"{"type":"struct","schema-id":3,"fields":[]}"#.to_vec()),
       ("partition-spec".to_string(), b"[]".to_vec()),
       ("partition-spec-id".to_string(), b"0".to_vec()),
       ("format-version".to_string(), b"2".to_vec()),
       ("content".to_string(), b"data".to_vec()),
   ]);
   let metadata = ManifestMetadata::parse(&meta).unwrap();
   assert_eq!(metadata.schema().schema_id(), 3);
   assert_eq!(metadata.schema_id(), 0);
   ```
   
   ### Expected behavior
   
   When the key is missing, `schema_id()` returns the id of the parsed 
`schema`. A present key still wins.
   
   ### Willingness to contribute
   
   I can contribute a fix for this bug independently
   


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