[ 
https://issues.apache.org/jira/browse/CALCITE-7145?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18035418#comment-18035418
 ] 

Julian Hyde commented on CALCITE-7145:
--------------------------------------

If someone really wants to simplify "1 / 0" (using the unsafe divide operator) 
then I wouldn't object if they simplified it to "throw DivideByZero".

Similarly, you could simplify "(x / y) IS NULL" (again, unsafe divide) to "x IS 
NULL OR y IS NULL OR ((x / y); FALSE)" where ";" is a (new) sequence operator 
that evaluates all operands, aborts if any one of them throws, and returns the 
result of the last operand.

> RexSimplify should not simplify IS NULL(10/0)
> ---------------------------------------------
>
>                 Key: CALCITE-7145
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7145
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Thomas Rebele
>            Assignee: Thomas Rebele
>            Priority: Major
>              Labels: pull-request-available
>
> RexSimplify incorrectly simplifies {{IS NULL(10/0)}} to false and {{IS NOT 
> NULL(10,0)}} to true
> In other DBMS it's either the inverse (sqlite, MySQL, MariaDB), or they throw 
> an exception in both cases (Oracle, Postgres). The behavior was also 
> mentioned in a comment on CALCITE-3368.
> Is it right that throwing an exception during query execution is the expected 
> behavior according to the SQL standard?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to