[ 
https://issues.apache.org/jira/browse/CALCITE-7264?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Thomas Rebele updated CALCITE-7264:
-----------------------------------
    Summary: New API for determining if the evaluation of a RexNode may throw  
(was: New API for determining if an operator may throw)

> New API for determining if the evaluation of a RexNode may throw
> ----------------------------------------------------------------
>
>                 Key: CALCITE-7264
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7264
>             Project: Calcite
>          Issue Type: New Feature
>            Reporter: Thomas Rebele
>            Priority: Major
>
> The SQL standard defines that 1/0 throws an exception. Calcite follows the 
> standard here. However, some projects that use Calcite (e.g., Hive) define 
> the result of 1/0 as NULL. This may lead to different results in RexSimplify: 
> E.g., IS NULL(1/0) would throw for the SQL standard semantics, but would 
> return TRUE for the Hive semantics.
> RexSimplify handles this with a concept called "safe" defined in 
> [RexSimplify#isSafeExpression|https://github.com/apache/calcite/blob/34989b0ed7793cedf713c2f159de6247a730458c/core/src/main/java/org/apache/calcite/rex/RexSimplify.java#L1631].
>  The safe operators are defined in 
> [RexSimplify.SafeRexVisitor|https://github.com/apache/calcite/blob/34989b0ed7793cedf713c2f159de6247a730458c/core/src/main/java/org/apache/calcite/rex/RexSimplify.java#L1490].
>  The goal of this ticket is to make the behavior configurable. The API would 
> need to provide a method that accepts at least RexCall nodes. Maybe a more 
> general approach is favorable, e.g., {{{}isSafeExpression(RexNode r){}}}.
> This ticket aims to provide a refinement of 
> {{{}org.apache.calcite.sql.SqlOperator#isSafeOperator{}}}, which only takes 
> the operator but not the arguments into account. To be discussed whether the 
> new API replaces or supplements {{{}SqlOperator#isSafeOperator{}}}.
> The safeness information would be useful for other parts of the code as well, 
> e.g., CALCITE-5315.
> See the related discussions:
>  * 
> https://issues.apache.org/jira/browse/CALCITE-7145?focusedCommentId=18016030#comment-18016030
>  * [http://lists.apache.org/thread/cp7h28k1yfxv421q12y1wopbwgrzdzrx]



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

Reply via email to