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

Zoltan Haindrich commented on CALCITE-2731:
-------------------------------------------

[~julianhyde] I've taken a quick look - by running the so far failed ones; I 
think there is only one more issue which is most probably a Hive side problem 
with types...I will let you know when I know more

> RexProgramBuilder makes unsafe simplifications to CASE expressions
> ------------------------------------------------------------------
>
>                 Key: CALCITE-2731
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2731
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Zoltan Haindrich
>            Assignee: Zoltan Haindrich
>            Priority: Major
>             Fix For: 1.18.0
>
>
> In CALCITE-1413 we were cautious to not simplify 
> {code}
> CASE a=0 THEN 0 ELSE 1/a END
> {code}
> and it seemed good; however: {{RexProgramBuilder}} is also invokes simplify - 
> but the protection at that point is not able to work, because it sees only 
> references:
> {code}
> CASE $1 THEN $2 ELSE $3 END
> {code}
> testcase for conditions.iq:
> {code}
> with ax(s) as (values (1),(0))
> select case when s=0 then false else 100/s > 0 end from ax;
> !ok
> {code}
> resulting exception:
> {code}
> java.lang.AssertionError: Files differ: 
> /home/kirk/projects/calcite/core/target/test-classes/sql/surefire/sql/conditions.iq
>  /home/kirk/projects/calcite/core/target/test-classes/sql/conditions.iq
> 277a278,326
> > Error while executing command OkCommand [sql: with ax(s) as (values (1),(0))
> > select case when s=0 then false else 100/s > 0 end from ax]
> > java.lang.ArithmeticException: / by zero
> >     at Baz$1$1.current(Unknown Source)
> >     at 
> > org.apache.calcite.linq4j.Linq4j$EnumeratorIterator.next(Linq4j.java:683)
> >     at 
> > org.apache.calcite.avatica.util.IteratorCursor.next(IteratorCursor.java:46)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to