-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
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
❯ 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:
sqlite> SELECT COALESCE(1, 2/0);
1
Compare to Postgres:
postgres=# SELECT COALESCE(1, 2/0);
coalesce
----------
1
(1 row)
Additional context
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working