rubenada commented on a change in pull request #1941:
URL: https://github.com/apache/calcite/pull/1941#discussion_r420621049



##########
File path: core/src/main/java/org/apache/calcite/rel/rules/SortRemoveRule.java
##########
@@ -63,5 +80,30 @@ public SortRemoveRule(RelBuilderFactory relBuilderFactory) {
         .getTrait(RelCollationTraitDef.INSTANCE);
     final RelTraitSet traits = 
sort.getInput().getTraitSet().replace(collation);
     call.transformTo(convert(sort.getInput(), traits));
+    return true;
+  }
+
+  // Sort is removed if all of following conditions are met
+  // 1. If input's max row count is less than or equal to 1
+  // 2. If fetch is greater than 0

Review comment:
       It seems that the method description does not match its logic (point 2 
should read "If fetch is not 0").
   I have the impression that the method could be simplified as:
   ```
   if (inputMaxRowCount != null && inputMaxRowCount <= 1 && fetch != 0 && 
offset < 1)
     return true;
   return false;
   ```




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

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


Reply via email to