neilconway opened a new pull request, #22068:
URL: https://github.com/apache/datafusion/pull/22068

   ## Which issue does this PR close?
   
   - Closes #22067.
   
   ## Rationale for this change
   
   In the grouping code, `accumulate_multiple` and `accumulate_indices` take a 
`BooleanArray` parameter, which has the result of the aggregate's `FILTER` 
clause (if any). Both functions only consider the value bits of the array, not 
the NULL bitmap, which means they consider `NULL` filter results to be 
effectively true, not false.
   
   ## What changes are included in this PR?
   
   * Fix NULL handling in `accumulate_multiple` and `accumulate_indices`.
   * Along the way, basically rewrite `accumulate_multiple` to be more readable 
and make use of `NullBuffer::union_many`
   * Optimize `filter_to_nulls` to avoid constructing an unnecessary 
intermediate `NullBuffer`
   * Introduce a new helper, `filter_to_validity`
   * Add unit tests for NULL handling in `accumulate_multiple` and 
`accumulate_indices`
   * Add SLT tests with SQL repros for both code paths
   
   ## Are these changes tested?
   
   Yes, with new tests added.
   
   ## Are there any user-facing changes?
   
   This changes query behavior for the affected (buggy) queries.
   
   This PR also changes the signature of `filter_to_nulls`, which is 
technically a public API.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to