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/06/20 07:19:27 UTC

[GitHub] [doris] englefly commented on a diff in pull request #10259: [enhancement] optmize 2 cases in seg_iter: all/none rows passed predicate

englefly commented on code in PR #10259:
URL: https://github.com/apache/doris/pull/10259#discussion_r901330938


##########
be/src/olap/rowset/segment_v2/segment_iterator.cpp:
##########
@@ -871,28 +871,45 @@ void SegmentIterator::_evaluate_vectorization_predicate(uint16_t* sel_rowid_idx,
     memset(ret_flags, 1, selected_size);
     _pre_eval_block_predicate->evaluate_vec(_current_return_columns, selected_size, ret_flags);
 
-    uint32_t sel_pos = 0;
-    const uint32_t sel_end = sel_pos + selected_size;
-    static constexpr size_t SIMD_BYTES = 32;
-    const uint32_t sel_end_simd = sel_pos + selected_size / SIMD_BYTES * SIMD_BYTES;
     uint16_t new_size = 0;
-
-    while (sel_pos < sel_end_simd) {
-        auto mask = simd::bytes32_mask_to_bits32_mask(ret_flags + sel_pos);
-        while (mask) {
-            const size_t bit_pos = __builtin_ctzll(mask);
-            sel_rowid_idx[new_size++] = sel_pos + bit_pos;
-            mask = mask & (mask - 1);
+    size_t num_zeros = simd::count_zero_num(reinterpret_cast<int8_t*>(ret_flags), original_size);
+    if (0 == num_zeros) {
+        for (uint16_t i = 0; i < original_size; i++) {
+            sel_rowid_idx[i] = i;

Review Comment:
   “0 == num_zeros ” means all rows passed the predicate, we should set all of them in sel_rowid_idx array



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