You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "mattfaltyn (via GitHub)" <gi...@apache.org> on 2026/07/23 19:56:10 UTC

[I] Python ManifestFile.partitions panics when partition summaries are absent [iceberg-rust]

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: issues-unsubscribe@iceberg.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] Python ManifestFile.partitions panics when partition summaries are absent [iceberg-rust]

Posted by "kevinjqliu (via GitHub)" <gi...@apache.org>.
kevinjqliu commented on issue #2883:
URL: https://github.com/apache/iceberg-rust/issues/2883#issuecomment-5876411066

   thanks for the detailed writeup and repro @mattfaltyn, and sorry I didn't see this before merging #3241.
   
   One change from the expected behavior above: `partitions` now returns `None` rather than `[]` when summaries are absent. `[]` would mean the partition spec has no fields, while `None` means the summaries just weren't written, so we kept them distinct. This matches `Option<Vec<FieldSummary>>` in the core crate and `list[PartitionFieldSummary] | None` in PyIceberg.
   
   Appreciate the report. I'll link this to #3241, it'll be closed once #3241 merges 🙏


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] Python ManifestFile.partitions panics when partition summaries are absent [iceberg-rust]

Posted by "kevinjqliu (via GitHub)" <gi...@apache.org>.
kevinjqliu closed issue #2883: Python ManifestFile.partitions panics when partition summaries are absent
URL: https://github.com/apache/iceberg-rust/issues/2883


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org