Skip to content

[AURON #2453] Fix filtered aggregation for groups with no matching rows - #2454

Open
lyne7-sc wants to merge 2 commits into
apache:masterfrom
lyne7-sc:fix/filter-aggregate-accumulator-init
Open

[AURON #2453] Fix filtered aggregation for groups with no matching rows#2454
lyne7-sc wants to merge 2 commits into
apache:masterfrom
lyne7-sc:fix/filter-aggregate-accumulator-init

Conversation

@lyne7-sc

@lyne7-sc lyne7-sc commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes #2453

Rationale for this change

A grouped aggregate may have no rows matching its FILTER clause. In this case, the group exists but its accumulator may not be initialized, causing an index-out-of-bounds error while producing the result.

What changes are included in this PR?

  • Ensure accumulator slots are initialized for all discovered groups before applying aggregate filters.
  • Add regression coverage for filtered SUM and COUNT.

Are there any user-facing changes?

Yes, bug fix only.

How was this patch tested?

Yes, added regression tests for filtered SUM and COUNT.

Was this patch authored or co-authored using generative AI tooling?

  • Yes
  • No

If yes, include: Generated-by: gpt-5

ASF guidance: https://www.apache.org/legal/generative-tooling.html

@slfan1989 slfan1989 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. The fix ensures that every discovered group has initialized accumulator slots before aggregate filters are applied, preserving the correct empty-input state for filtered aggregates. The regression coverage for both SUM and COUNT looks good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Filtered aggregation fails when a group has no matching rows

2 participants