You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2023/01/17 03:31:01 UTC

[GitHub] [doris] Gabriel39 commented on a diff in pull request #15663: [Improvement](topn) order by key topn query optimization

Gabriel39 commented on code in PR #15663:
URL: https://github.com/apache/doris/pull/15663#discussion_r1071696041


##########
be/src/vec/olap/vcollect_iterator.h:
##########
@@ -72,6 +72,26 @@ class VCollectIterator {
     }
 
 private:
+    // next for topn query
+    Status topn_next(Block* block);

Review Comment:
   _topn_next



##########
be/src/vec/olap/vcollect_iterator.h:
##########
@@ -72,6 +72,26 @@ class VCollectIterator {
     }
 
 private:
+    // next for topn query
+    Status topn_next(Block* block);
+
+    class BlockRowposComparator {

Review Comment:
   BlockRowPosComparator



##########
be/src/vec/olap/vcollect_iterator.cpp:
##########
@@ -185,13 +195,170 @@ Status VCollectIterator::next(IteratorRowRef* ref) {
 }
 
 Status VCollectIterator::next(Block* block) {
+    if (_topn_limit > 0) {
+        return topn_next(block);
+    }
+
     if (LIKELY(_inner_iter)) {
         return _inner_iter->next(block);
     } else {
         return Status::Error<END_OF_FILE>();
     }
 }
 
+Status VCollectIterator::topn_next(Block* block) {
+    if (_topn_eof) {
+        return Status::Error<END_OF_FILE>();
+    }
+
+    auto cloneBlock = block->clone_without_columns();

Review Comment:
   clone_block



-- 
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@doris.apache.org

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


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