iwanttobepowerful commented on code in PR #4633:
URL: https://github.com/apache/calcite/pull/4633#discussion_r2625387863


##########
core/src/main/java/org/apache/calcite/sql2rel/RelDecorrelator.java:
##########
@@ -1045,29 +1037,31 @@ private static void shiftMapping(Map<Integer, Integer> 
mapping, int startIndex,
   }
 
   protected @Nullable Frame decorrelateFetchOneSort(Sort sort, final Frame 
frame) {
-    Frame aggFrame = decorrelateSortAsAggregate(sort, frame);
-    if (aggFrame != null) {
-      return aggFrame;
+    if (sort.offset == null
+        && sort.fetch != null
+        && RexLiteral.intValue(sort.fetch) == 0) {

Review Comment:
   The purpose of this if check is to skip the subsequent optimization process.



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