You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2022/02/19 01:11:17 UTC

[GitHub] [pinot] Jackie-Jiang commented on a change in pull request #8228: Early terminate orderby when columns already sorted

Jackie-Jiang commented on a change in pull request #8228:
URL: https://github.com/apache/pinot/pull/8228#discussion_r810422360



##########
File path: pinot-core/src/main/java/org/apache/pinot/core/operator/query/SelectionOrderByOperator.java
##########
@@ -117,6 +119,30 @@ public String toExplainString() {
     return stringBuilder.append(')').toString();
   }
 
+  private void pruneOrderByColumns() {
+    // Order by col1, col2 limit k will take all the n matching rows
+    // and add it to a priority queue of size k.
+    // This is nlogk operation which can be quite expensive for a large n.
+    // This function, prunes out any order by clause that matches columns sorting order.
+    // In the above example, if the docs are already sorted by col1, col2 then there is no need for any
+    // sorting at all (only limit is needed). When only col1 is sorted, then we need to use only col2 for ordering.

Review comment:
       I don't follow the logic here. Say col1 is sorted, col2 is not. If we apply this logic, will the final result only order on col2?




-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org