Skip to content

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

Merged
slfan1989 merged 2 commits into
apache:masterfrom
lyne7-sc:fix/filter-aggregate-accumulator-init
Aug 9, 2026
Merged

[AURON #2453] Fix filtered aggregation for groups with no matching rows#2454
slfan1989 merged 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.

@slfan1989
slfan1989 merged commit 14d17f7 into apache:master Aug 9, 2026
123 checks passed
@slfan1989

Copy link
Copy Markdown
Contributor

@lyne7-sc Thanks for the contribution! Merged into the master.

@lyne7-sc

lyne7-sc commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for your review, @slfan1989

@lyne7-sc
lyne7-sc deleted the fix/filter-aggregate-accumulator-init branch August 9, 2026 11:58
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