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 2022/07/08 07:22:34 UTC

[GitHub] [doris] xiaokang opened a new pull request, #10694: Key topn opt2

xiaokang opened a new pull request, #10694:
URL: https://github.com/apache/doris/pull/10694

   # Proposed changes
   
   Issue Number: close #10646
   
   ## Problem Summary:
   
   Describe the overview of changes.
   
   BE part for https://github.com/apache/doris/issues/10646. The FE part is https://github.com/apache/doris/pull/10647.
   
   There is a common query pattern to find latest time serials data.
    eg. SELECT * from t_log WHERE t>t1 AND t<t2 ORDER BY t DESC LIMIT 100
   
   If the ORDER BY columns is the prefix of the sort key of table, it can
   be greatly optimized to read much fewer data instead of read all data
   between t1 and t2.
   
   By leveraging the same order of ORDER BY columns and sort key of table,
   just read the LIMIT N rows for each related segment and merge N rows.
   
   1. set read_orderby_key to true for read_params and _reader_context
      if olap_scan_node's sort info is set.
   2. set read_orderby_key_reverse to true for read_params and _reader_context
      if is_asc_order is false.
   3. rowset reader force merge read segments if read_orderby_key is true.
   4. block reader and tablet reader force merge read rowsets if read_orderby_key is true.
   
   5. for ORDER BY DESC, read and compare in reverse order
   5.1 segment iterator read backward using a new BackwardBitmapRangeIterator and
       reverse the result block before return to caller.
   5.2 VCollectIterator::LevelIteratorComparator, VMergeIteratorContext return
       opposite result for _is_reverse order in its compare function.
   
   
   ## Checklist(Required)
   
   1. Does it affect the original behavior: (No)
   2. Has unit tests been added: (No)
   3. Has document been added or modified: (No Need)
   4. Does it need to update dependencies: (No)
   5. Are there any changes that cannot be rolled back: (No)
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
   


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


[GitHub] [doris] xiaokang commented on a diff in pull request #10694: optimize topn query if order by columns is prefix of sort keys of table

Posted by GitBox <gi...@apache.org>.
xiaokang commented on code in PR #10694:
URL: https://github.com/apache/doris/pull/10694#discussion_r931691730


##########
be/src/olap/rowset/beta_rowset_reader.cpp:
##########
@@ -111,9 +112,10 @@ Status BetaRowsetReader::init(RowsetReaderContext* read_context) {
     RowwiseIterator* final_iterator;
     if (config::enable_storage_vectorization && read_context->is_vec) {
         if (read_context->need_ordered_result &&

Review Comment:
   removed read_context->read_orderby_key and optimized the new_merge_iterator/new_union_iterator as we discussed.



##########
be/src/vec/olap/vcollect_iterator.cpp:
##########
@@ -145,7 +150,7 @@ bool VCollectIterator::LevelIteratorComparator::operator()(LevelIterator* lhs, L
     bool lower = (cmp_res != 0) ? (cmp_res < 0) : (lhs->version() < rhs->version());
     lower ? lhs->set_same(true) : rhs->set_same(true);
 
-    return lower;
+    return UNLIKELY(_is_reverse) ? !lower : lower;

Review Comment:
   fixed



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


[GitHub] [doris] HappenLee commented on a diff in pull request #10694: optimize topn query if order by columns is prefix of sort keys of table

Posted by GitBox <gi...@apache.org>.
HappenLee commented on code in PR #10694:
URL: https://github.com/apache/doris/pull/10694#discussion_r929522152


##########
be/src/olap/rowset/segment_v2/segment_iterator.cpp:
##########
@@ -104,6 +107,43 @@ class SegmentIterator::BitmapRangeIterator {
     bool _eof = false;
 };
 
+// A backward range iterator for roaring bitmap. Output ranges use closed-open form, like [from, to).
+// Example:
+//   input bitmap:  [0 1 4 5 6 7 10 15 16 17 18 19]
+//   output ranges: , [15,20), [10,11), [4,8), [0,2) (when max_range_size=10)
+//   output ranges: [18,20), [15,18), [10,11), [4,8), [0,2) (when max_range_size=3)

Review Comment:
   rethink the logic?



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


[GitHub] [doris] xiaokang commented on a diff in pull request #10694: optimize topn query if order by columns is prefix of sort keys of table

Posted by GitBox <gi...@apache.org>.
xiaokang commented on code in PR #10694:
URL: https://github.com/apache/doris/pull/10694#discussion_r931692645


##########
be/src/olap/rowset/segment_v2/segment_iterator.cpp:
##########
@@ -104,6 +107,43 @@ class SegmentIterator::BitmapRangeIterator {
     bool _eof = false;
 };
 
+// A backward range iterator for roaring bitmap. Output ranges use closed-open form, like [from, to).
+// Example:
+//   input bitmap:  [0 1 4 5 6 7 10 15 16 17 18 19]
+//   output ranges: , [15,20), [10,11), [4,8), [0,2) (when max_range_size=10)
+//   output ranges: [18,20), [15,18), [10,11), [4,8), [0,2) (when max_range_size=3)

Review Comment:
   changed the example



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


[GitHub] [doris] xiaokang commented on a diff in pull request #10694: optimize topn query if order by columns is prefix of sort keys of table

Posted by GitBox <gi...@apache.org>.
xiaokang commented on code in PR #10694:
URL: https://github.com/apache/doris/pull/10694#discussion_r931690785


##########
be/src/vec/olap/vcollect_iterator.h:
##########
@@ -102,12 +102,14 @@ class VCollectIterator {
     // if row cursors equal, compare data version.
     class LevelIteratorComparator {
     public:
-        LevelIteratorComparator(int sequence = -1) : _sequence(sequence) {}
+        LevelIteratorComparator(int sequence, bool is_reverse) :
+            _sequence(sequence), _is_reverse(is_reverse) {}
 
         bool operator()(LevelIterator* lhs, LevelIterator* rhs);
 
     private:
         int _sequence;
+        bool _is_reverse = false;

Review Comment:
   added comment



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


[GitHub] [doris] HappenLee commented on a diff in pull request #10694: optimize topn query if order by columns is prefix of sort keys of table

Posted by GitBox <gi...@apache.org>.
HappenLee commented on code in PR #10694:
URL: https://github.com/apache/doris/pull/10694#discussion_r929506877


##########
be/src/vec/olap/vcollect_iterator.cpp:
##########
@@ -145,7 +150,7 @@ bool VCollectIterator::LevelIteratorComparator::operator()(LevelIterator* lhs, L
     bool lower = (cmp_res != 0) ? (cmp_res < 0) : (lhs->version() < rhs->version());
     lower ? lhs->set_same(true) : rhs->set_same(true);
 
-    return lower;
+    return UNLIKELY(_is_reverse) ? !lower : lower;

Review Comment:
   do not need reverse in key equals case



##########
be/src/olap/rowset/beta_rowset_reader.cpp:
##########
@@ -111,9 +112,10 @@ Status BetaRowsetReader::init(RowsetReaderContext* read_context) {
     RowwiseIterator* final_iterator;
     if (config::enable_storage_vectorization && read_context->is_vec) {
         if (read_context->need_ordered_result &&

Review Comment:
   Rethink the `read_orderby_key` and `need_ordered_result`, seems we only need one



##########
be/src/vec/olap/vcollect_iterator.cpp:
##########
@@ -34,14 +34,19 @@ VCollectIterator::~VCollectIterator() {}
         }                                                                               \
     } while (false)
 
-void VCollectIterator::init(TabletReader* reader) {
+void VCollectIterator::init(TabletReader* reader, bool force_merge, bool is_reverse) {
     _reader = reader;
     // when aggregate is enabled or key_type is DUP_KEYS, we don't merge
     // multiple data to aggregate for better performance
     if (_reader->_reader_type == READER_QUERY &&
         (_reader->_direct_mode || _reader->_tablet->keys_type() == KeysType::DUP_KEYS)) {
         _merge = false;
     }
+
+    if (force_merge) {
+        _merge = true;
+    }

Review Comment:
   _merge = force_merge



##########
be/src/vec/olap/vgeneric_iterators.cpp:
##########
@@ -177,7 +178,7 @@ class VMergeIteratorContext {
         if (_is_unique) {
             result ? this->set_skip(true) : rhs.set_skip(true);
         }
-        return result;
+        return UNLIKELY(_is_reverse) ? !result : result;

Review Comment:
   do not need reverse in key equals case



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


[GitHub] [doris] xiaokang commented on a diff in pull request #10694: optimize topn query if order by columns is prefix of sort keys of table

Posted by GitBox <gi...@apache.org>.
xiaokang commented on code in PR #10694:
URL: https://github.com/apache/doris/pull/10694#discussion_r931691229


##########
be/src/olap/reader.cpp:
##########
@@ -197,11 +197,17 @@ Status TabletReader::_capture_rs_readers(const ReaderParams& read_params,
             // it's ok for rowset to return unordered result
             need_ordered_result = false;
         }
+
+        if (read_params.read_orderby_key) {
+            need_ordered_result = true;

Review Comment:
   I meant to emphasize read_orderby_key



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


[GitHub] [doris] xiaokang commented on a diff in pull request #10694: optimize topn query if order by columns is prefix of sort keys of table

Posted by GitBox <gi...@apache.org>.
xiaokang commented on code in PR #10694:
URL: https://github.com/apache/doris/pull/10694#discussion_r937402867


##########
be/src/olap/rowset/segment_v2/segment_iterator.cpp:
##########
@@ -915,7 +959,8 @@ Status SegmentIterator::_read_columns_by_index(uint32_t nrows_read_limit, uint32
         } else {
             nrows_read += rows_to_read;
         }
-    } while (nrows_read < nrows_read_limit);
+        // if _opts.read_orderby_key_reverse is true, only read one range for fast reverse purpose

Review Comment:
   OK. It's related to the code 'reverse block row order' at the end of SegmentIterator::next_batch.
   
   If we read more than one range in reverse order here, such as range10 with rows 9000~10000 and range9 with rows 8000~9000, the block will contain non-continous ordered rows 9000~10000,8000~9000. Then the reverse block at the end of next_batch will get rows 9000~8000,10000~9000. It's not totally in reversed order.



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


[GitHub] [doris] xiaokang commented on a diff in pull request #10694: optimize topn query if order by columns is prefix of sort keys of table

Posted by GitBox <gi...@apache.org>.
xiaokang commented on code in PR #10694:
URL: https://github.com/apache/doris/pull/10694#discussion_r936697486


##########
be/src/olap/reader.cpp:
##########
@@ -197,11 +197,17 @@ Status TabletReader::_capture_rs_readers(const ReaderParams& read_params,
             // it's ok for rowset to return unordered result
             need_ordered_result = false;
         }
+
+        if (read_params.read_orderby_key) {
+            need_ordered_result = true;

Review Comment:
   btw, for normal query on UNIQUE_KEYS, need_ordered_result is true but read_params.read_orderby_key is false.



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


[GitHub] [doris] github-actions[bot] commented on pull request #10694: optimize topn query if order by columns is prefix of sort keys of table

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #10694:
URL: https://github.com/apache/doris/pull/10694#issuecomment-1204839192

   PR approved by anyone and no changes requested.


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


[GitHub] [doris] xiaokang commented on pull request #10694: optimize topn query if order by columns is prefix of sort keys of table

Posted by GitBox <gi...@apache.org>.
xiaokang commented on PR #10694:
URL: https://github.com/apache/doris/pull/10694#issuecomment-1194928145

   we test in a log matching senario, runtime of the following SQL drops significantly from **1.8s to 0.1s** 
   
   `SELECT * FROM log_table WHERE timestamp > t1 ORDER BY timestamp DESC LIMIT 100` 


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


[GitHub] [doris] jackwener commented on a diff in pull request #10694: optimize topn query if order by columns is prefix of sort keys of table

Posted by GitBox <gi...@apache.org>.
jackwener commented on code in PR #10694:
URL: https://github.com/apache/doris/pull/10694#discussion_r916590916


##########
be/src/olap/reader.cpp:
##########
@@ -197,11 +197,17 @@ Status TabletReader::_capture_rs_readers(const ReaderParams& read_params,
             // it's ok for rowset to return unordered result
             need_ordered_result = false;
         }
+
+        if (read_params.read_orderby_key) {
+            need_ordered_result = true;

Review Comment:
   need_ordered_result = read_params.read_orderby_key



##########
be/src/olap/rowset/rowset_reader_context.h:
##########
@@ -34,6 +34,9 @@ struct RowsetReaderContext {
     const TabletSchema* tablet_schema = nullptr;
     // whether rowset should return ordered rows.
     bool need_ordered_result = true;
+    //

Review Comment:
   Forgot to comment?



##########
be/src/vec/olap/vcollect_iterator.h:
##########
@@ -102,12 +102,14 @@ class VCollectIterator {
     // if row cursors equal, compare data version.
     class LevelIteratorComparator {
     public:
-        LevelIteratorComparator(int sequence = -1) : _sequence(sequence) {}
+        LevelIteratorComparator(int sequence, bool is_reverse) :
+            _sequence(sequence), _is_reverse(is_reverse) {}
 
         bool operator()(LevelIterator* lhs, LevelIterator* rhs);
 
     private:
         int _sequence;
+        bool _is_reverse = false;

Review Comment:
   Add comment explain its function?



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


[GitHub] [doris] xiaokang commented on a diff in pull request #10694: optimize topn query if order by columns is prefix of sort keys of table

Posted by GitBox <gi...@apache.org>.
xiaokang commented on code in PR #10694:
URL: https://github.com/apache/doris/pull/10694#discussion_r931690698


##########
be/src/olap/rowset/rowset_reader_context.h:
##########
@@ -34,6 +34,9 @@ struct RowsetReaderContext {
     const TabletSchema* tablet_schema = nullptr;
     // whether rowset should return ordered rows.
     bool need_ordered_result = true;
+    //

Review Comment:
   yes, added 



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


[GitHub] [doris] xiaokang commented on a diff in pull request #10694: optimize topn query if order by columns is prefix of sort keys of table

Posted by GitBox <gi...@apache.org>.
xiaokang commented on code in PR #10694:
URL: https://github.com/apache/doris/pull/10694#discussion_r931692373


##########
be/src/vec/olap/vcollect_iterator.cpp:
##########
@@ -34,14 +34,19 @@ VCollectIterator::~VCollectIterator() {}
         }                                                                               \
     } while (false)
 
-void VCollectIterator::init(TabletReader* reader) {
+void VCollectIterator::init(TabletReader* reader, bool force_merge, bool is_reverse) {
     _reader = reader;
     // when aggregate is enabled or key_type is DUP_KEYS, we don't merge
     // multiple data to aggregate for better performance
     if (_reader->_reader_type == READER_QUERY &&
         (_reader->_direct_mode || _reader->_tablet->keys_type() == KeysType::DUP_KEYS)) {
         _merge = false;
     }
+
+    if (force_merge) {
+        _merge = true;
+    }

Review Comment:
   can not just set _merge = force_merge, since when force_merge == false there is a chance _merge is already set to true before this statement.



##########
be/src/vec/olap/vgeneric_iterators.cpp:
##########
@@ -177,7 +178,7 @@ class VMergeIteratorContext {
         if (_is_unique) {
             result ? this->set_skip(true) : rhs.set_skip(true);
         }
-        return result;
+        return UNLIKELY(_is_reverse) ? !result : result;

Review Comment:
   fixed



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


[GitHub] [doris] yiguolei merged pull request #10694: optimize topn query if order by columns is prefix of sort keys of table

Posted by GitBox <gi...@apache.org>.
yiguolei merged PR #10694:
URL: https://github.com/apache/doris/pull/10694


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


[GitHub] [doris] xiaokang commented on pull request #10694: optimize topn query if order by columns is prefix of sort keys of table

Posted by GitBox <gi...@apache.org>.
xiaokang commented on PR #10694:
URL: https://github.com/apache/doris/pull/10694#issuecomment-1197531782

   Thansk @HappenLee @jackwener for careful review. The problem is fixed as we discuss.


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


[GitHub] [doris] xiaokang commented on a diff in pull request #10694: optimize topn query if order by columns is prefix of sort keys of table

Posted by GitBox <gi...@apache.org>.
xiaokang commented on code in PR #10694:
URL: https://github.com/apache/doris/pull/10694#discussion_r937402867


##########
be/src/olap/rowset/segment_v2/segment_iterator.cpp:
##########
@@ -915,7 +959,8 @@ Status SegmentIterator::_read_columns_by_index(uint32_t nrows_read_limit, uint32
         } else {
             nrows_read += rows_to_read;
         }
-    } while (nrows_read < nrows_read_limit);
+        // if _opts.read_orderby_key_reverse is true, only read one range for fast reverse purpose

Review Comment:
   OK. It's related to the code 'reverse block row order' at the end of SegmentIterator::next_batch.
   
   If we read more than one range in reverse order here, such as range10 with rows 9000 ~ 10000 and range9 with rows 8000 ~ 9000, the block will contain non-continous ordered rows 9000 ~ 10000,8000 ~ 9000. Then the reverse block at the end of next_batch will get rows 9000 ~ 8000,10000 ~ 9000. It's not totally in reversed order.



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


[GitHub] [doris] github-actions[bot] commented on pull request #10694: optimize topn query if order by columns is prefix of sort keys of table

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #10694:
URL: https://github.com/apache/doris/pull/10694#issuecomment-1204839159

   PR approved by at least one committer and no changes requested.


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


[GitHub] [doris] HappenLee commented on a diff in pull request #10694: optimize topn query if order by columns is prefix of sort keys of table

Posted by GitBox <gi...@apache.org>.
HappenLee commented on code in PR #10694:
URL: https://github.com/apache/doris/pull/10694#discussion_r937394167


##########
be/src/olap/rowset/segment_v2/segment_iterator.cpp:
##########
@@ -915,7 +959,8 @@ Status SegmentIterator::_read_columns_by_index(uint32_t nrows_read_limit, uint32
         } else {
             nrows_read += rows_to_read;
         }
-    } while (nrows_read < nrows_read_limit);
+        // if _opts.read_orderby_key_reverse is true, only read one range for fast reverse purpose

Review Comment:
   I don't quite understand the intent here? Can you explain it in detail?



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