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

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


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new 0d4b7779159 branch-3.0: [Fix](func) fix group_array_intersect result 
error in all arr contain null #46521 (#46578)
0d4b7779159 is described below

commit 0d4b7779159ab31392e05e4bf34d0874fbd45732
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri Jan 10 20:14:55 2025 +0800

    branch-3.0: [Fix](func) fix group_array_intersect result error in all arr 
contain null #46521 (#46578)
    
    Cherry-picked from #46521
    
    Co-authored-by: HappenLee <[email protected]>
---
 be/src/exprs/hybrid_set.h                                     |  1 +
 .../aggregate_function_group_array_intersect.h                | 11 ++++-------
 .../data/query_p0/aggregate/group_array_intersect.out         |  3 +++
 .../suites/query_p0/aggregate/group_array_intersect.groovy    |  1 +
 4 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/be/src/exprs/hybrid_set.h b/be/src/exprs/hybrid_set.h
index f0977a652b1..b39cfc1481e 100644
--- a/be/src/exprs/hybrid_set.h
+++ b/be/src/exprs/hybrid_set.h
@@ -215,6 +215,7 @@ public:
         _contains_null |= set->_contains_null;
     }
 
+    bool empty() { return !_contains_null && size() == 0; }
     virtual int size() = 0;
     virtual bool find(const void* data) const = 0;
     // use in vectorize execute engine
diff --git 
a/be/src/vec/aggregate_functions/aggregate_function_group_array_intersect.h 
b/be/src/vec/aggregate_functions/aggregate_function_group_array_intersect.h
index 94b34caff78..5892f5e22ff 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_group_array_intersect.h
+++ b/be/src/vec/aggregate_functions/aggregate_function_group_array_intersect.h
@@ -123,7 +123,7 @@ struct AggregateFunctionGroupArrayIntersectData {
                 set->insert(src_data);
             }
             init = true;
-        } else if (set->size() != 0 || set->contain_null()) {
+        } else if (!set->empty()) {
             Set new_set = std::make_unique<NullableNumericOrDateSetType>();
 
             for (size_t i = 0; i < arr_size; ++i) {
@@ -213,10 +213,7 @@ public:
                 it->next();
             }
             init = true;
-            return;
-        }
-
-        if (set->size() != 0) {
+        } else if (!set->empty()) {
             auto create_new_set = [](auto& lhs_val, auto& rhs_val) {
                 typename State::Set new_set =
                         std::make_unique<typename 
State::NullableNumericOrDateSetType>();
@@ -419,7 +416,7 @@ public:
                 set->insert((void*)src.data, src.size);
             }
             init = true;
-        } else if (set->size() != 0 || set->contain_null()) {
+        } else if (!set->empty()) {
             typename State::Set new_set = 
std::make_unique<NullableStringSet>();
 
             for (size_t i = 0; i < arr_size; ++i) {
@@ -452,7 +449,7 @@ public:
                 it->next();
             }
             init = true;
-        } else if (set->size() != 0) {
+        } else if (!set->empty()) {
             auto create_new_set = [](auto& lhs_val, auto& rhs_val) {
                 typename State::Set new_set = 
std::make_unique<NullableStringSet>();
                 HybridSetBase::IteratorBase* it = lhs_val->begin();
diff --git a/regression-test/data/query_p0/aggregate/group_array_intersect.out 
b/regression-test/data/query_p0/aggregate/group_array_intersect.out
index c58ede1043e..7778d24b703 100644
--- a/regression-test/data/query_p0/aggregate/group_array_intersect.out
+++ b/regression-test/data/query_p0/aggregate/group_array_intersect.out
@@ -91,3 +91,6 @@
 -- !notnull_6 --
 []
 
+-- !notnull_7 --
+[]
+
diff --git 
a/regression-test/suites/query_p0/aggregate/group_array_intersect.groovy 
b/regression-test/suites/query_p0/aggregate/group_array_intersect.groovy
index 8e0ecbe3c21..6141dea3da8 100644
--- a/regression-test/suites/query_p0/aggregate/group_array_intersect.groovy
+++ b/regression-test/suites/query_p0/aggregate/group_array_intersect.groovy
@@ -103,4 +103,5 @@ suite("group_array_intersect") {
     qt_notnull_4 """select array_sort(group_array_intersect(c_array_string)) 
from group_array_intersect_test_not_null where id between 1 and 2;"""
     qt_notnull_5 """select array_sort(group_array_intersect(c_array_int)), 
array_sort(group_array_intersect(c_array_float)), 
array_sort(group_array_intersect(c_array_string)) from 
group_array_intersect_test_not_null where id between 3 and 4;"""
     qt_notnull_6 """select array_sort(group_array_intersect(c_array_string)) 
from group_array_intersect_test_not_null where id between 1 and 5;"""
+    qt_notnull_7 """select array_sort(group_array_intersect(c_array_float)) 
from group_array_intersect_test_not_null where id between 1 and 5;"""
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to