erratic-pattern opened a new issue, #11258:
URL: https://github.com/apache/datafusion/issues/11258

   ### 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_


-- 
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: github-unsubscr...@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to