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


##########
core/src/main/java/org/apache/calcite/sql2rel/RelDecorrelator.java:
##########
@@ -574,16 +575,30 @@ protected RexNode removeCorrelationExpr(
     }
 
     if (isCorVarDefined && (rel.fetch != null || rel.offset != null)) {
-      if (rel.fetch != null
-          && rel.offset == null
-          && RexLiteral.intValue(rel.fetch) == 1) {
-        return decorrelateFetchOneSort(rel, frame);
-      }
-      // Can not decorrelate if the sort has per-correlate-key attributes like
-      // offset or fetch limit, because these attributes scope would change to
-      // global after decorrelation. They should take effect within the scope
-      // of the correlation key actually.
-      return null;
+      if (rel.offset == null
+          && rel.fetch != null
+          && RexLiteral.longValue(rel.fetch) == 0) {

Review Comment:
   Okay, I will submit the modifications later. Thank you for your review.
   At that time, I referred to 
https://github.com/apache/calcite/blob/dd1cd8693e965b5ad0d54b4e3b09f9ebc23ffaed/core/src/main/java/org/apache/calcite/rel/rules/PruneEmptyRules.java#L503
   @mihaibudiu @xiedeyantu 



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