Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-1695

Not all RexUtil.simplifyXxx code paths carry the provided executor

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.12.0
    • None
    • None

    Description

      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:

      	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)
      

      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.

      Attachments

        Issue Links

          Activity

            People

              rusanu Remus Rusanu
              rusanu Remus Rusanu
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: