Describe the bug
Aggregate and window aggregate FILTER clauses currently fail with an internal error for FILTER (WHERE NULL).
To Reproduce
Aggregate:
SELECT count(*) FILTER (WHERE NULL);
Output:
Internal error: Cannot create filter_array from non-boolean predicates.
Window aggregate:
SELECT count(*) FILTER (WHERE NULL) OVER ()
FROM (VALUES (1)) AS t(x);
Output:
Internal error: could not cast array of type Null to BooleanArray.
Expected behavior
The equivalent queries with a boolean-typed NULL predicate already work:
SELECT count(*) FILTER (WHERE CAST(NULL AS BOOLEAN));
SELECT sum(1) FILTER (WHERE CAST(NULL AS BOOLEAN));
Untyped NULL predicates in FILTER clauses should behave consistently rather than producing an internal error.
Environment
- DataFusion 53.1.0
- Reproduced in
datafusion-cli
Describe the bug
Aggregate and window aggregate FILTER clauses currently fail with an internal error for FILTER (WHERE NULL).
To Reproduce
Aggregate:
Output:
Window aggregate:
Output:
Expected behavior
The equivalent queries with a boolean-typed
NULLpredicate already work:Untyped
NULLpredicates inFILTERclauses should behave consistently rather than producing an internal error.Environment
datafusion-cli