### Describe the bug Aggregate and window aggregate FILTER clauses currently fail with an internal error for FILTER (WHERE NULL). ### To Reproduce Aggregate: ```sql SELECT count(*) FILTER (WHERE NULL); ``` Output: ```text Internal error: Cannot create filter_array from non-boolean predicates. ``` Window aggregate: ```sql SELECT count(*) FILTER (WHERE NULL) OVER () FROM (VALUES (1)) AS t(x); ``` Output: ```text Internal error: could not cast array of type Null to BooleanArray. ``` ### Expected behavior The equivalent queries with a boolean-typed `NULL` predicate already work: ```sql SELECT count(*) FILTER (WHERE CAST(NULL AS BOOLEAN)); ``` ```text 0 ``` ```sql SELECT sum(1) FILTER (WHERE CAST(NULL AS BOOLEAN)); ``` ```text NULL ``` Untyped `NULL` predicates in `FILTER` clauses should behave consistently rather than producing an internal error. ### Environment * DataFusion 53.1.0 * Reproduced in `datafusion-cli`
Activity
mkleen commentedon Jun 5, 2026
take
pchintar commentedon Jun 5, 2026
hi @mkleen thnx for showing interest on my issue, so I already worked on the fix for this issue and opened the PR for it just now.
fix: Coerce aggregate FILTER predicates to boolean (apache#22774)