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



##########
File path: core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java
##########
@@ -824,10 +824,11 @@ protected void convertOrder(
       List<SqlNode> orderExprList,
       SqlNode offset,
       SqlNode fetch) {
-    if (!bb.top
+    boolean keepSort = config.isKeepSortInSubQuery() || bb.top;
+    if (!keepSort

Review comment:
       Can we abstract the common logic `config.isKeepSortInSubQuery() || 
bb.top` into a method there ?
   ```java
   /**
   * 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;
   }
   ```




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