Python ManifestFile.partitions panics when partition summaries are absent

Open Beginner friendly
#2,883 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
75/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
python, rust
Domain
api, backend

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.

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:

cargo +nightly-2026-03-05 test -p pyiceberg_core_rust test_unpartitioned_manifest_partitions -- --nocapture

Observed consistently across two runs:

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.

Dominant language
Rust
Stars
1.4k
Forks
574
Avg merge
1d 18h
Merged PRs (30d)
84

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/iceberg-rust

All issues in apache/iceberg-rust

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.