xiaokang commented on code in PR #31669:
URL: https://github.com/apache/doris/pull/31669#discussion_r1509709192


##########
be/src/olap/accept_null_predicate.h:
##########
@@ -168,44 +173,35 @@ class AcceptNullPredicate : public ColumnPredicate {
     uint16_t _evaluate_inner(const vectorized::IColumn& column, uint16_t* sel,
                              uint16_t size) const override {
         if (column.has_null()) {
+            if (size == 0) return 0;
             // create selected_flags
-            uint16_t max_idx = *std::max_element(sel, sel + size);
-            auto selected_flags_ptr = std::make_unique<bool[]>(max_idx + 1);
-            auto* selected_flags = selected_flags_ptr.get();
-            // init to 0 / false
-            memset(selected_flags, 0, (max_idx + 1) * sizeof(bool));
-            for (uint16_t i = 0; i < size; ++i) {
-                uint16_t row_idx = sel[i];
-                if (column.is_null_at(row_idx)) {
-                    // set selected flag true for NULL value
-                    selected_flags[row_idx] = true;
-                }
-            }
+            uint16_t max_idx = sel[size - 1];

Review Comment:
   It's more reasonable to use *std::max_element(sel, sel + size)



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

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


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

Reply via email to