[
https://issues.apache.org/jira/browse/CALCITE-7937?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18144409#comment-18144409
]
Stamatis Zampetakis commented on CALCITE-7937:
----------------------------------------------
Yeap definitely a duplicate of CALCITE-5315 and as mentioned there the
optimization is so common and present in every major DBMS that is rather
unlikely worth fixing.
> 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
> Priority: Minor
>
> 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)