chunweilei commented on a change in pull request #1355: [CALCITE-3228] Error 
while applying rule ProjectScanRule: interpreter
URL: https://github.com/apache/calcite/pull/1355#discussion_r313223026
 
 

 ##########
 File path: core/src/main/java/org/apache/calcite/rel/core/Project.java
 ##########
 @@ -282,7 +282,12 @@ public RelWriter explainTerms(RelWriter pw) {
       if (!(exp.e instanceof RexInputRef)) {
         return null;
       }
-      mapping.set(((RexInputRef) exp.e).getIndex(), exp.i);
+
+      int source = ((RexInputRef) exp.e).getIndex();
+      if (mapping.getTargetOpt(source) != -1) {
+        return null;
 
 Review comment:
   It will throw exception wrongly without this change under some conditions . 
I will add a test case to cover it.

----------------------------------------------------------------
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