You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "github-actions[bot] (via GitHub)" <gi...@apache.org> on 2023/04/03 10:08:14 UTC

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

github-actions[bot] commented on code in PR #18278:
URL: https://github.com/apache/doris/pull/18278#discussion_r1155755222


##########
be/src/olap/column_predicate.h:
##########
@@ -121,6 +121,34 @@ struct PredicateTypeTraits {
     }
 };
 
+#define EVALUATE_BY_SELECTOR(EVALUATE_IMPL_WITH_NULL_MAP, EVALUATE_IMPL_WITHOUT_NULL_MAP) \

Review Comment:
   warning: macro is not used [clang-diagnostic-unused-macros]
   ```cpp
   #define EVALUATE_BY_SELECTOR(EVALUATE_IMPL_WITH_NULL_MAP, EVALUATE_IMPL_WITHOUT_NULL_MAP) \
           ^
   ```
   



##########
be/src/olap/comparison_predicate.h:
##########
@@ -504,20 +512,36 @@ class ComparisonPredicateBase : public ColumnPredicate {
 
     template <bool is_nullable, typename TArray, typename TValue>
     uint16_t _base_loop(uint16_t* sel, uint16_t size, const uint8_t* __restrict null_map,
-                        const TArray* __restrict data_array, const TValue& value) const {
+                        const TArray* __restrict data_array, const TValue& value,
+                        const bool is_dense) const {
         uint16_t new_size = 0;
-        for (uint16_t i = 0; i < size; ++i) {
-            uint16_t idx = sel[i];
-            if constexpr (is_nullable) {
-                if (_opposite ^ (!null_map[idx] && _operator(data_array[idx], value))) {
-                    sel[new_size++] = idx;
+        if (is_dense) {
+            for (uint16_t i = 0; i < size; ++i) {
+                if constexpr (is_nullable) {
+                    if (_opposite ^ (!null_map[i] && _operator(data_array[i], value))) {
+                        sel[new_size++] = i;
+                    }
+                } else {
+                    if (_opposite ^ _operator(data_array[i], value)) {
+                        sel[new_size++] = i;
+                    }
                 }
-            } else {
-                if (_opposite ^ _operator(data_array[idx], value)) {
-                    sel[new_size++] = idx;
+            }
+        } else {
+            for (uint16_t i = 0; i < size; ++i) {
+                uint16_t idx = sel[i];
+                if constexpr (is_nullable) {
+                    if () {

Review Comment:
   warning: expected expression [clang-diagnostic-error]
   ```cpp
                       if () {
                           ^
   ```
   



##########
be/src/olap/comparison_predicate.h:
##########
@@ -504,20 +512,36 @@
 
     template <bool is_nullable, typename TArray, typename TValue>
     uint16_t _base_loop(uint16_t* sel, uint16_t size, const uint8_t* __restrict null_map,
-                        const TArray* __restrict data_array, const TValue& value) const {
+                        const TArray* __restrict data_array, const TValue& value,
+                        const bool is_dense) const {
         uint16_t new_size = 0;
-        for (uint16_t i = 0; i < size; ++i) {
-            uint16_t idx = sel[i];
-            if constexpr (is_nullable) {
-                if (_opposite ^ (!null_map[idx] && _operator(data_array[idx], value))) {
-                    sel[new_size++] = idx;
+        if (is_dense) {
+            for (uint16_t i = 0; i < size; ++i) {
+                if constexpr (is_nullable) {
+                    if (_opposite ^ (!null_map[i] && _operator(data_array[i], value))) {
+                        sel[new_size++] = i;
+                    }
+                } else {
+                    if (_opposite ^ _operator(data_array[i], value)) {
+                        sel[new_size++] = i;
+                    }
                 }
-            } else {
-                if (_opposite ^ _operator(data_array[idx], value)) {
-                    sel[new_size++] = idx;
+            }
+        } else {
+            for (uint16_t i = 0; i < size; ++i) {
+                uint16_t idx = sel[i];
+                if constexpr (is_nullable) {
+                    if () {
+                        sel[new_size++] = idx;
+                    }
+                } else {
+                    if () {

Review Comment:
   warning: expected expression [clang-diagnostic-error]
   ```cpp
                       if () {
                           ^
   ```
   



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