dataroaring commented on code in PR #19099:
URL: https://github.com/apache/doris/pull/19099#discussion_r1184600386


##########
be/src/olap/memtable.cpp:
##########
@@ -286,32 +292,90 @@ void MemTable::_collect_vskiplist_results() {
         _output_mutable_block.add_rows(&in_block, row_pos_vec.data(),
                                        row_pos_vec.data() + in_block.rows());
     } else {
-        size_t idx = 0;
-        for (it.SeekToFirst(); it.Valid(); it.Next()) {
+        size_t idx = 0, temp_idx = 0;
+        vectorized::MutableBlock mutable_block =
+                vectorized::MutableBlock::build_mutable_block(&in_block);
+        _vec_row_comparator->set_block(&mutable_block);
+        auto new_row_it = std::next(_row_in_blocks.begin(), _last_sorted_pos);
+        // sort new rows
+        std::sort(new_row_it, _row_in_blocks.end(),
+                  [this](const RowInBlock* l, const RowInBlock* r) -> bool {
+                      auto value = (*(this->_vec_row_comparator))(l, r);
+                      if (value == 0) {
+                          return l->_row_pos > r->_row_pos;

Review Comment:
   add a stats here, e.g. same_keys_num++;



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to