From 036989735f383049b5df3abb78e15067afba7acc Mon Sep 17 00:00:00 2001 From: Matt Faltyn Date: Thu, 23 Jul 2026 23:25:46 +0200 Subject: [PATCH 1/2] fix(python): handle missing manifest partition summaries --- bindings/python/src/manifest.rs | 37 +++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/bindings/python/src/manifest.rs b/bindings/python/src/manifest.rs index 6c042475b6..202e1e9515 100644 --- a/bindings/python/src/manifest.rs +++ b/bindings/python/src/manifest.rs @@ -148,8 +148,8 @@ impl PyManifestFile { fn partitions(&self) -> Vec { self.inner .partitions - .clone() - .unwrap() + .as_deref() + .unwrap_or_default() .iter() .map(|s| PyFieldSummary { inner: s.clone() }) .collect() @@ -238,3 +238,36 @@ pub fn register_module(py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> .getattr("modules")? .set_item("pyiceberg_core.manifest", this) } + +#[cfg(test)] +mod tests { + use iceberg::spec::ManifestContentType; + + use super::*; + + #[test] + fn test_manifest_partitions_without_summaries() { + let manifest_file = PyManifestFile { + inner: ManifestFile { + manifest_path: "memory://manifest.avro".to_string(), + manifest_length: 1, + partition_spec_id: 0, + content: ManifestContentType::Data, + sequence_number: 0, + min_sequence_number: 0, + added_snapshot_id: 1, + added_files_count: Some(1), + existing_files_count: Some(0), + deleted_files_count: Some(0), + added_rows_count: Some(1), + existing_rows_count: Some(0), + deleted_rows_count: Some(0), + partitions: None, + key_metadata: None, + first_row_id: None, + }, + }; + + assert!(manifest_file.partitions().is_empty()); + } +} From 8d991a2d27a87094c1387933e56e845d97601813 Mon Sep 17 00:00:00 2001 From: Matt Faltyn Date: Wed, 26 Aug 2026 08:47:41 +0200 Subject: [PATCH 2/2] fix(python): preserve optional partition summaries --- bindings/python/src/manifest.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/bindings/python/src/manifest.rs b/bindings/python/src/manifest.rs index 202e1e9515..41f9612c90 100644 --- a/bindings/python/src/manifest.rs +++ b/bindings/python/src/manifest.rs @@ -145,14 +145,13 @@ impl PyManifestFile { } #[getter] - fn partitions(&self) -> Vec { - self.inner - .partitions - .as_deref() - .unwrap_or_default() - .iter() - .map(|s| PyFieldSummary { inner: s.clone() }) - .collect() + fn partitions(&self) -> Option> { + self.inner.partitions.as_ref().map(|partitions| { + partitions + .iter() + .map(|s| PyFieldSummary { inner: s.clone() }) + .collect() + }) } #[getter] @@ -268,6 +267,6 @@ mod tests { }, }; - assert!(manifest_file.partitions().is_empty()); + assert!(manifest_file.partitions().is_none()); } }