chunweilei commented on a change in pull request #1818: [CALCITE-3809] 
RexSimplify simplifies nondeterministic function incorrectly
URL: https://github.com/apache/calcite/pull/1818#discussion_r382343140
 
 

 ##########
 File path: core/src/main/java/org/apache/calcite/rex/RexAnalyzer.java
 ##########
 @@ -128,6 +128,10 @@ public RexAnalyzer(RexNode e, RelOptPredicateList 
predicates) {
     }
 
     @Override public Void visitCall(RexCall call) {
+      if (!call.getOperator().isDeterministic()) {
+        ++unsupportedCount;
 
 Review comment:
   Actually RexInterpreter supports a few functions[1]. 
   ```
   java.lang.IllegalArgumentException: unbound: NDC()
        at org.apache.calcite.rex.RexInterpreter.unbound(RexInterpreter.java:71)
        at 
org.apache.calcite.rex.RexInterpreter.visitCall(RexInterpreter.java:203)
        at 
org.apache.calcite.rex.RexInterpreter.visitCall(RexInterpreter.java:47)
        at org.apache.calcite.rex.RexCall.accept(RexCall.java:288)
        at 
org.apache.calcite.rex.RexInterpreter.visitCall(RexInterpreter.java:129)
        at 
org.apache.calcite.rex.RexInterpreter.visitCall(RexInterpreter.java:47)
        at org.apache.calcite.rex.RexCall.accept(RexCall.java:288)
        at 
org.apache.calcite.rex.RexInterpreter.evaluate(RexInterpreter.java:63)
        at org.apache.calcite.rex.RexSimplify.verify(RexSimplify.java:1796)
        at 
org.apache.calcite.rex.RexSimplify.simplifyUnknownAs(RexSimplify.java:233)
        at 
org.apache.calcite.rex.RexProgramTestBase.checkSimplify3_(RexProgramTestBase.java:127)
        at 
org.apache.calcite.rex.RexProgramTestBase.checkSimplifyUnchanged(RexProgramTestBase.java:92)
        at 
org.apache.calcite.rex.RexProgramTest.testSimplifyNonDeterministicFunction(RexProgramTest.java:2569)
   ```
   
   [1] 
https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/rex/RexInterpreter.java#L126-L204

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to