suibianwanwank commented on code in PR #4338:
URL: https://github.com/apache/calcite/pull/4338#discussion_r2062834399


##########
core/src/main/java/org/apache/calcite/rel/rules/SortJoinTransposeRule.java:
##########
@@ -116,13 +121,26 @@ public SortJoinTransposeRule(Class<? extends Sort> 
sortClass,
               mq, join.getLeft(), joinInfo.leftSet())) {
         return false;
       }
+      if (alreadyPushedThrough(join.getRight())) {
+        return false;
+      }
     } else {
       return false;
     }
 
     return true;
   }
 
+  // Returns true if the sort has already been pushed through

Review Comment:
   I haven't studied the original logic of this rule in detail, but frankly 
speaking, such approaches usually can't fundamentally prevent StackOverflow. 
Assuming there's a rule called SortFilterTranspose, the Sort node would be 
pushed under Filter again after application, creating an infinite loop of 
applying this same rule.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to