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

   ### Apache Iceberg Rust version
   
   0.10.0 and current `main` at `4532da80f3930cdbda1cf2effe05b50165da9875`.
   
   ### Describe the bug
   
   The Python `PyManifestFile.partitions` getter unconditionally unwraps
   `ManifestFile.partitions`:
   
   
https://github.com/apache/iceberg-rust/blob/4532da80f3930cdbda1cf2effe05b50165da9875/bindings/python/src/manifest.rs#L147-L155
   
   The core field is legitimately optional:
   
   
https://github.com/apache/iceberg-rust/blob/4532da80f3930cdbda1cf2effe05b50165da9875/crates/iceberg/src/spec/manifest_list/manifest_file.rs#L94-L100
   
   Existing core tests construct valid manifest-list entries with
   `partitions: None`, serialize them as `"partitions": null`, and verify that
   V1-to-V2 projection preserves `None`:
   
   
https://github.com/apache/iceberg-rust/blob/4532da80f3930cdbda1cf2effe05b50165da9875/crates/iceberg/src/spec/manifest_list/_serde.rs#L496-L521
   
   
https://github.com/apache/iceberg-rust/blob/4532da80f3930cdbda1cf2effe05b50165da9875/crates/iceberg/src/spec/manifest_list/_serde.rs#L627-L676
   
   As a result, parsing such a manifest list succeeds, but accessing the Python
   entry's `.partitions` property raises a Rust/PyO3 panic.
   
   ### To reproduce
   
   Add a focused unit test in `bindings/python/src/manifest.rs` that constructs
   `PyManifestFile` around a valid `ManifestFile` with `partitions: None`, then
   calls `partitions()`.
   
   Run:
   
   ```shell
   cargo +nightly-2026-03-05 test -p pyiceberg_core_rust 
test_unpartitioned_manifest_partitions -- --nocapture
   ```
   
   Observed consistently across two runs:
   
   ```text
   panicked at bindings/python/src/manifest.rs:152:14:
   called `Option::unwrap()` on a `None` value
   ```
   
   A control using `partitions: Some(vec![])` passes.
   
   ### Expected behavior
   
   The list-returning Python getter should return an empty list when partition
   summaries are absent, rather than panic.
   
   ### Suggested fix
   
   Use `unwrap_or_default()` (or equivalent optional iteration) and add a
   regression test for `partitions: None`. Existing `Some` behavior should 
remain
   unchanged.
   
   ### Willingness to contribute
   
   I would be willing to contribute a fix for this bug with guidance from the
   Iceberg community.
   


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