This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 5deeb42f6db branch-2.1: [opt] Optimization for short circuit of 
CompoundPred #45422 (#46241)
5deeb42f6db is described below

commit 5deeb42f6db00ca4a703e76d92649dae3efd4eb2
Author: zhiqiang <hezhiqi...@selectdb.com>
AuthorDate: Thu Jan 2 10:11:47 2025 +0800

    branch-2.1: [opt] Optimization for short circuit of CompoundPred #45422 
(#46241)
    
    cherry pick from #45422
---
 be/src/vec/exprs/vcompound_pred.h | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/be/src/vec/exprs/vcompound_pred.h 
b/be/src/vec/exprs/vcompound_pred.h
index d1d7739e541..c7ca1417494 100644
--- a/be/src/vec/exprs/vcompound_pred.h
+++ b/be/src/vec/exprs/vcompound_pred.h
@@ -268,24 +268,27 @@ public:
         auto vector_vector_null = [&]<bool is_and_op>() {
             auto col_res = ColumnUInt8::create(size);
             auto col_nulls = ColumnUInt8::create(size);
+
             auto* __restrict res_datas = 
assert_cast<ColumnUInt8*>(col_res)->get_data().data();
             auto* __restrict res_nulls = 
assert_cast<ColumnUInt8*>(col_nulls)->get_data().data();
             ColumnPtr temp_null_map = nullptr;
             // maybe both children are nullable / or one of children is 
nullable
-            lhs_null_map = create_null_map_column(temp_null_map, lhs_null_map);
-            rhs_null_map = create_null_map_column(temp_null_map, rhs_null_map);
+            auto* __restrict lhs_null_map_tmp = 
create_null_map_column(temp_null_map, lhs_null_map);
+            auto* __restrict rhs_null_map_tmp = 
create_null_map_column(temp_null_map, rhs_null_map);
+            auto* __restrict lhs_data_column_tmp = lhs_data_column;
+            auto* __restrict rhs_data_column_tmp = rhs_data_column;
 
             if constexpr (is_and_op) {
                 for (size_t i = 0; i < size; ++i) {
-                    res_nulls[i] = apply_and_null(lhs_data_column[i], 
lhs_null_map[i],
-                                                  rhs_data_column[i], 
rhs_null_map[i]);
-                    res_datas[i] = lhs_data_column[i] & rhs_data_column[i];
+                    res_nulls[i] = apply_and_null(lhs_data_column_tmp[i], 
lhs_null_map_tmp[i],
+                                                  rhs_data_column_tmp[i], 
rhs_null_map_tmp[i]);
+                    res_datas[i] = lhs_data_column_tmp[i] & 
rhs_data_column_tmp[i];
                 }
             } else {
                 for (size_t i = 0; i < size; ++i) {
-                    res_nulls[i] = apply_or_null(lhs_data_column[i], 
lhs_null_map[i],
-                                                 rhs_data_column[i], 
rhs_null_map[i]);
-                    res_datas[i] = lhs_data_column[i] | rhs_data_column[i];
+                    res_nulls[i] = apply_or_null(lhs_data_column_tmp[i], 
lhs_null_map_tmp[i],
+                                                 rhs_data_column_tmp[i], 
rhs_null_map_tmp[i]);
+                    res_datas[i] = lhs_data_column_tmp[i] | 
rhs_data_column_tmp[i];
                 }
             }
             auto result_column = ColumnNullable::create(std::move(col_res), 
std::move(col_nulls));


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

Reply via email to