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

Julian Hyde commented on CALCITE-1695:
--------------------------------------

[~rusanu], Please review my alternate fix in 
https://github.com/julianhyde/calcite/commit/f4f70b51abf47a0ac0048dd4ef6aaa4fcda2a695.
 As long as you use a RexSimplify you are guaranteed to use the executor of 
your choice. RexBuilder is immutable again, so we don't have to worry about 
threading.

> Not all RexUtil.simplifyXxx code paths carry the provided executor
> ------------------------------------------------------------------
>
>                 Key: CALCITE-1695
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1695
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Remus Rusanu
>            Assignee: Remus Rusanu
>             Fix For: 1.12.0
>
>
> CALCITE-1653 resolved some of the issues encountered with different semantics 
> in Hive executor vs. Calcite default executor. When investigating a 
> workaround for CALCITE-1690 I found that there are other code paths that can 
> this the same issue, eg:
> {noformat}
>       at org.apache.calcite.rex.RexBuilder.makeLiteral(RexBuilder.java:1239)
>       at org.apache.calcite.rex.RexBuilder.makeLiteral(RexBuilder.java:1236)
>       at org.apache.calcite.rex.RexExecutable.reduce(RexExecutable.java:86)
>       at 
> org.apache.calcite.rex.RexExecutorImpl.reduce(RexExecutorImpl.java:128)
>       at org.apache.calcite.rex.RexUtil.simplifyCast(RexUtil.java:2450)
>       at org.apache.calcite.rex.RexUtil.simplify(RexUtil.java:1633)
>       at org.apache.calcite.rex.RexUtil.simplify(RexUtil.java:1587)
>       at org.apache.calcite.rex.RexUtil.simplifyList(RexUtil.java:1747)
>       at org.apache.calcite.rex.RexUtil.simplifyComparison(RexUtil.java:1658)
>       at org.apache.calcite.rex.RexUtil.simplify(RexUtil.java:1648)
>       at 
> org.apache.calcite.rex.RexUtil$ExprSimplifier.visitCall(RexUtil.java:3051)
>       at 
> org.apache.calcite.rex.RexUtil$ExprSimplifier.visitCall(RexUtil.java:3016)
>       at org.apache.calcite.rex.RexCall.accept(RexCall.java:104)
>       at org.apache.calcite.rex.RexShuttle.apply(RexShuttle.java:279)
>       at 
> org.apache.calcite.rel.rules.ReduceExpressionsRule.reduceExpressions(ReduceExpressionsRule.java:473)
> {noformat}
> Int he stack above neither {{RexUtil.simplifyComparison}} nor 
> {{RexUtil.simplifyList}} accept an executor, and thus the executor info 
> present at the {{RexUtil.simplify:1648}} frame is lost and the default 
> {{EXECUTOR}} is used instead. The result is incorrect for Hive.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to