You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "zhannngchen (via GitHub)" <gi...@apache.org> on 2023/04/18 06:44:18 UTC

[GitHub] [doris] zhannngchen commented on a diff in pull request #18686: [performance](stream-load) use vector instead of skiplist when insert dup keys

zhannngchen commented on code in PR #18686:
URL: https://github.com/apache/doris/pull/18686#discussion_r1169566576


##########
be/src/olap/memtable.cpp:
##########
@@ -243,11 +243,16 @@ void MemTable::_collect_vskiplist_results() {
     VecTable::Iterator it(_vec_skip_list.get());
     vectorized::Block in_block = _input_mutable_block.to_block();
     if (_keys_type == KeysType::DUP_KEYS) {
+        RowComparator _cmp(_schema);
+        vectorized::MutableBlock mutable_block =
+                vectorized::MutableBlock::build_mutable_block(&in_block);
+        _cmp.set_block(&mutable_block);
+        std::sort(_vec_row.begin(), _vec_row.end(), _cmp);

Review Comment:
   you can use the `_vec_row_comparator` with lambda directly, like this way:
   ```
           std::sort(_vec_row.begin(), _vec_row.end(),
                     [this](const RowInBlock* l, const RowInBlock* r) -> bool {
                         return (*(this->_vec_row_comparator))(l, r) < 0;
                     });
   ```



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