Skip to content

Commit

Permalink
[Fix](func) fix group_array_intersect result error in all arr contain…
Browse files Browse the repository at this point in the history
… null
  • Loading branch information
HappenLee committed Jan 7, 2025
1 parent 4c40b4e commit 73fc76c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions be/src/exprs/hybrid_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ class HybridSetBase : public RuntimeFilterFuncBase {
_contains_null |= set->_contains_null;
}

bool emtpy() { return !_contains_null && size() == 0; }
virtual int size() = 0;
virtual bool find(const void* data) const = 0;
// use in vectorize execute engine
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,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) {
Expand Down Expand Up @@ -214,10 +214,7 @@ class AggregateFunctionGroupArrayIntersect
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>();
Expand Down Expand Up @@ -420,7 +417,7 @@ class AggregateFunctionGroupArrayIntersectGeneric
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) {
Expand Down Expand Up @@ -454,7 +451,7 @@ class AggregateFunctionGroupArrayIntersectGeneric
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,6 @@
-- !notnull_6 --
[]

-- !notnull_7 --
[]

Original file line number Diff line number Diff line change
Expand Up @@ -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;"""
}

0 comments on commit 73fc76c

Please sign in to comment.