Skip to content

Snapshot summary totals appear to be calculated incorrectly when previous totals don't exist #2576

Closed

Description

@dannycjones

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

Activity

  1. added
    bug
    on Jun 3, 2026
  2. dannycjones commented on Jun 3, 2026

    @dannycjones
    ContributorAuthor

    @CTTY does this sound like a real bug? I am happy to make this change if so (and I'd like to include in #2527).

  3. added a commit that references this issue on Jun 10, 2026
    9394028
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions