juntaozhang commented on code in PR #4344:
URL: https://github.com/apache/calcite/pull/4344#discussion_r2065085559


##########
core/src/main/java/org/apache/calcite/rel/rules/SortJoinTransposeRule.java:
##########
@@ -79,13 +80,18 @@ public SortJoinTransposeRule(Class<? extends Sort> 
sortClass,
     final JoinInfo joinInfo =
         JoinInfo.createWithStrictEquality(join.getLeft(), join.getRight(), 
join.getCondition());
 
-    // 1) If join is not a left or right outer, we bail out
-    // 2) If sort is not a trivial order-by, and if there is
+    // 1) If the fetch of sort is dynamic parameter, we bail out
+    // 2) If join is not a left or right outer, we bail out
+    // 3) If sort is not a trivial order-by, and if there is
     // any sort column that is not part of the input where the
     // sort is pushed, we bail out
-    // 3) If sort has an offset, and if the non-preserved side
+    // 4) If sort has an offset, and if the non-preserved side
     // of the join is not count-preserving against the join
     // condition, we bail out
+    if (sort.fetch instanceof RexDynamicParam) {

Review Comment:
   > in general, I wonder how many rules are ok when queries contain dynamic 
parameters. but I don't know if this is the place to answer this question.
   
   Thanks for your review. I have no idea.
   FYI: [CALCITE-6647 SortUnionTransposeRule should not push SORT past a UNION 
when SORT's fetch is 
DynamicParam](https://issues.apache.org/jira/browse/CALCITE-6647) .
   This [PR](https://github.com/apache/calcite/pull/4338) is guaranteed that 
the push througth operation not loop.
   
   
   



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