Describe the bug
Type coercion doesn't seem to handle NULL in a CASE branch when used inside of an aggregate.
To Reproduce
In Datafusion CLI:
> CREATE TABLE example(data double precision);
0 row(s) fetched.
Elapsed 0.005 seconds.
> SELECT sum(CASE WHEN data is NULL THEN NULL ELSE data + 1 END) FROM example;
Error during planning: Execution error: User-defined coercion failed with Execution("Sum not supported for Null") No function matches the given name and argument types 'sum(Null)'. You might need to add explicit type casts.
Candidate functions:
sum(UserDefined)
Expected behavior
NULL type should coerce to the ELSE branch type.
Additional context
No response