gianm commented on a change in pull request #8919: fix bug with sqlOuterLimit, 
use sqlOuterLimit in web console
URL: https://github.com/apache/incubator-druid/pull/8919#discussion_r349217646
 
 

 ##########
 File path: 
sql/src/main/java/org/apache/druid/sql/calcite/planner/DruidPlanner.java
 ##########
 @@ -261,6 +261,16 @@ private RelNode possiblyWrapRootWithOuterLimitFromContext(
       return root.rel;
     }
 
+    if (root.rel instanceof LogicalSort) {
+      LogicalSort outerSort = (LogicalSort) root.rel;
+      return LogicalSort.create(
+          outerSort.getInput(),
+          outerSort.collation,
+          makeBigIntLiteral(0),
 
 Review comment:
   This won't handle offsets properly, nor will it handle properly the case 
where the outer limit is higher than the inner limit. Check out 
`SortCollapseRule` for some logic that handles both of these cases. You might 
want to create a helper method and use it in both places.

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to