Python ManifestFile.partitions panics when partition summaries are absent
- Dominant language
- Rust
- Stars
- 1.4k
- Forks
- 567
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 93
Description
### 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.
Contributor guide
Research direction
Start in bindings/python/src/manifest.rs at the PyManifestFile.partitions getter, then review the optional field in crates/iceberg/src/spec/manifest_list/manifest_file.rs and the existing serialization tests. Run the focused test command from the issue after adding the regression coverage. Done means a ManifestFile with partitions: None can be accessed through Python without a panic and returns an empty list, while existing Some behavior remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, rust
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 75/100