tv42 opened a new issue, #8910:
URL: https://github.com/apache/arrow-datafusion/issues/8910

   ### Describe the bug
   
   Datafusion evaluates `COALESCE(a, b, c)` expressions even past the first 
non-NULL value, and bubbles up runtime errors from them.
   
   This is wrong because the COALESCE could be explicitly protecting against 
e.g. the divide-by-zero case, and differs from other sql engines.
   
   
   ### To Reproduce
   
   ```console
   ❯ SELECT COALESCE(1, 2/0);
   Optimizer rule 'simplify_expressions' failed
   caused by
   Arrow error: Divide by zero error
   ```
   
   ### Expected behavior
   
   `COALESCE` to return the first non-NULL value, not bubble up errors from the 
rest.
   
   Compare to SQLite:
   
   ```console
   sqlite> SELECT COALESCE(1, 2/0);
   1
   ```
   
   Compare to Postgres:
   
   ```console
   postgres=# SELECT COALESCE(1, 2/0);
    coalesce
   ----------
           1
   (1 row)
   ```
   
   ### 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to