pchintar opened a new pull request, #22774: URL: https://github.com/apache/datafusion/pull/22774
## Which issue does this PR close? - Closes #22773 . ## Rationale for this change Aggregate and window aggregate `FILTER` clauses currently fail with an internal error when the filter condition is `NULL`, even though the equivalent boolean-typed expression (e.g. `CAST(NULL AS BOOLEAN)`) works correctly. This occurs because `FILTER` predicates are not being coerced to `BOOLEAN` during type coercion. ## What changes are included in this PR? * Coerce aggregate `FILTER` predicates to `BOOLEAN` during type coercion. * Apply the same coercion to window aggregate `FILTER` predicates. * Add SQL logic tests covering `FILTER (WHERE NULL)` for both aggregate and window aggregate functions. ## Are these changes tested? Yes. Added SQL logic tests covering: * `COUNT(*) FILTER (WHERE NULL)` * `COUNT(1) FILTER (WHERE NULL)` * `SUM(1) FILTER (WHERE NULL)` * `AVG(1) FILTER (WHERE NULL)` * Window aggregate variants using `FILTER (WHERE NULL)` ## Are there any user-facing changes? Yes. Queries using `FILTER (WHERE NULL)` no longer fail with an internal error and now return the expected results. Also, no changes were made to any public APIs -- 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]
