danny0405 commented on a change in pull request #2127:
URL: https://github.com/apache/calcite/pull/2127#discussion_r481947893



##########
File path: core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java
##########
@@ -5865,6 +5874,9 @@ public static ConfigBuilder configBuilder() {
      * the relational expressions. Default is
      * {@link HintStrategyTable#EMPTY}. */
     HintStrategyTable getHintStrategyTable();
+
+    /** control keep sort in sub-query. */
+    boolean isKeepSortInSubQuery();

Review comment:
       ```java
   /**
    * Returns whether to keep sort operator for a sub-query if the sort has no 
offset and fetch limit attributes. 
    * Because the remove does not change the semantics, and in many cases, this 
is a promotion.
    * 
    * <p> Default is true
   */
   ```
   
   I would suggest to rename it to `isRemoveSortInSubquery` if the default 
value for it is true.

##########
File path: core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java
##########
@@ -865,6 +865,15 @@ protected void convertOrder(
     }
   }
 
+  /**
+   * Returns whether we should keep the sort for the subsequent query 
conversion.
+   *
+   * @param topQuery Whether the query is in the top level.
+   */
+  boolean keepSortInSubQuery(boolean topQuery) {
+    return config.isKeepSortInSubQuery() || topQuery;

Review comment:
       Is there any special reason we made this function `protected` scope ?




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