Skip to content

[AURON #2521] Fix NULL predicate handling in aggregate filters - #2522

Open
lyne7-sc wants to merge 2 commits into
apache:masterfrom
lyne7-sc:fix/agg-filter-null-predicate
Open

[AURON #2521] Fix NULL predicate handling in aggregate filters#2522
lyne7-sc wants to merge 2 commits into
apache:masterfrom
lyne7-sc:fix/agg-filter-null-predicate

Conversation

@lyne7-sc

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes #2521

Rationale for this change

Aggregate FILTER may include NULL predicates when their underlying boolean value bits are true. For example, FILTER (WHERE NOT flag) can produce incorrect SUM and COUNT results for nullable flag columns.

What changes are included in this PR?

  • Check predicate validity when selecting rows for aggregation.
  • Add Spark SQL regression coverage for global and grouped SUM/COUNT, including a group with only NULL predicates.

Are there any user-facing changes?

Aggregate filters exclude NULL predicates, matching Spark.

How was this patch tested?

Added end-to-end tests comparing native SUM/COUNT with Spark for nullable filters, with and without GROUP BY.

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

  • Yes
  • No

If yes, include: Generated-by: Openai codex gpt-6-astra

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

// Single accumulator for all rows in this group.
IdxSelection::Single(idx) => {
for i in batch_start_idx..batch_end_idx {
if filter_array.value(i) {

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.

Caused by #2289

cc @yew1eb

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.

Aggregate FILTER may include rows with NULL predicates

3 participants