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


##########
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:
   It won't be much harder to use BigInteger here, so why not build the perfect 
solution?



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