Apache Iceberg Rust version
None
Describe the bug
When calculating totals, we initialize the previous as 0 if not set. Given these summaries are optional, we may incorrectly calculate the totals where files exist but don't have total summaries set.
|
let previous_total = previous_summary.map_or(0, |previous_summary| { |
|
previous_summary |
|
.additional_properties |
|
.get(total_property) |
|
.map_or(0, |value| value.parse::<u64>().unwrap()) |
|
}); |
To Reproduce
No response
Expected behavior
I expect that we should skip calculating the totals when we do not have a previous value to reference. This does mean some other process would need to calculate the totals outside of this commit in order to introduce totals to the snapshot summaries.
Willingness to contribute
I can contribute a fix for this bug independently
Apache Iceberg Rust version
None
Describe the bug
When calculating totals, we initialize the previous as 0 if not set. Given these summaries are optional, we may incorrectly calculate the totals where files exist but don't have total summaries set.
iceberg-rust/crates/iceberg/src/spec/snapshot_summary.rs
Lines 486 to 491 in 130ea0f
To Reproduce
No response
Expected behavior
I expect that we should skip calculating the totals when we do not have a previous value to reference. This does mean some other process would need to calculate the totals outside of this commit in order to introduce totals to the snapshot summaries.
Willingness to contribute
I can contribute a fix for this bug independently