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

[GitHub] [doris] HappenLee commented on a diff in pull request #18278: [Improvement](predicate) optimize short-circuit predicates

HappenLee commented on code in PR #18278:
URL: https://github.com/apache/doris/pull/18278#discussion_r1155563145


##########
be/src/olap/null_predicate.cpp:
##########
@@ -54,10 +54,17 @@ uint16_t NullPredicate::evaluate(const vectorized::IColumn& column, uint16_t* se
             return _is_null ? 0 : size;
         }
         auto& null_map = nullable->get_null_map_data();
-        for (uint16_t i = 0; i < size; ++i) {
-            uint16_t idx = sel[i];
-            sel[new_size] = idx;
-            new_size += (null_map[idx] == _is_null);
+        if (null_map.size() == size) {
+            for (uint16_t i = 0; i < size; ++i) {
+                sel[new_size] = i;
+                new_size += (null_map[i] == _is_null);
+            }
+        } else {
+            for (uint16_t i = 0; i < size; ++i) {
+                uint16_t idx = sel[i];
+                sel[new_size] = idx;
+                new_size += (null_map[idx] == _is_null);
+            }

Review Comment:
   better need a function to do:
   ```
   uint16_t idx = is_parse_column ? i : sel[i];
   ```
   to simple the function logic
   
   `is_parse_column` better be const bool



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