You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like related to the simplify_expressions rule because the simplify_expressions rule does the ConstEvaluator, result in 42/0 evaluated, get Divide by zero error.
This is a similar problem to what #8814 describes. maybe we should not do ConstEvaluator for short-circuited operators.
I also do some test in datafusion-cli v34
DataFusion CLI v34.0.0
❯ SELECT CASE 1 WHEN 2 THEN 42/0 END;
Optimizer rule 'simplify_expressions' failed
caused by
Arrow error: Divide by zero error
❯ select 4/0;
Optimizer rule 'simplify_expressions' failed
caused by
Arrow error: Divide by zero error
❯ select 1 > 4 and 5/0 > 2;
Optimizer rule 'simplify_expressions' failed
caused by
Arrow error: Divide by zero error
Describe the bug
Datafusion evaluates
CASE ... WHEN ... THEN
expressions even for non-true branches, and bubbles up runtime errors from them.This is wrong because the
CASE
could be explicitly protecting against the divide-by-zero case, and differs from other sql engines.To Reproduce
Expected behavior
I expected the
CASE
to evaluate toNULL
, as none of itsWHEN
branches were true and it did not have anELSE
.Compare to SQLite:
Compare to Postgres:
Additional context
No response
The text was updated successfully, but these errors were encountered: