Mihai Budiu created CALCITE-7937:
------------------------------------
Summary: Some optimizations may unsafely move predicates that can
crash
Key: CALCITE-7937
URL: https://issues.apache.org/jira/browse/CALCITE-7937
Project: Calcite
Issue Type: Bug
Components: core
Affects Versions: 1.42.0
Reporter: Mihai Budiu
Optimizations such as FilterIntoJoinRule and JoinConditionPushRule can move
predicates which are unsafe to evaluate, e.g. 10 / a.x > 1 before a join. This
predicate may never be evaluated in its original position if the join never
matches, but may cause a crash evaluated over a join input.
{code}
select e."empid"
from "hr"."emps" as e
join "hr"."depts" as d on e."deptno" = d."deptno"
where 10 / (e."empid" - 200) > 0;
+-------+
| empid |
+-------+
+-------+
(0 rows)
{code}
Instead of producing this result the test fails with:
{code}
Caused by: java.lang.ArithmeticException: / by zero
{code}
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)