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 c7ad5b69048 branch-2.1: [Bug](set) fix find null get wrong result on
set operators #48001 (#48020)
c7ad5b69048 is described below
commit c7ad5b69048cdd3085a06d0abea1d4e59174ccbf
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Wed Feb 19 09:26:49 2025 +0800
branch-2.1: [Bug](set) fix find null get wrong result on set operators
#48001 (#48020)
Cherry-picked from #48001
Co-authored-by: Pxl <[email protected]>
---
be/src/vec/common/columns_hashing.h | 8 ++++--
.../data/query_p0/operator/test_set_operator.out | Bin 210 -> 223 bytes
.../query_p0/operator/test_set_operator.groovy | 27 +++++++++++++++++++++
3 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/be/src/vec/common/columns_hashing.h
b/be/src/vec/common/columns_hashing.h
index c25c8acdb7b..d039ff7813b 100644
--- a/be/src/vec/common/columns_hashing.h
+++ b/be/src/vec/common/columns_hashing.h
@@ -139,8 +139,12 @@ struct HashMethodSingleLowNullableColumn : public
SingleColumnMethod {
template <typename Data, typename Key>
ALWAYS_INLINE FindResult find_key_with_hash(Data& data, size_t i, Key key,
size_t hash_value) {
- if (key_column->is_null_at(i) && data.has_null_key_data()) {
- return FindResult {&data.template get_null_key_data<Mapped>(),
true};
+ if (key_column->is_null_at(i)) {
+ if (data.has_null_key_data()) {
+ return FindResult {&data.template get_null_key_data<Mapped>(),
true};
+ } else {
+ return FindResult {nullptr, false};
+ }
}
return Base::find_key_impl(key, hash_value, data);
}
diff --git a/regression-test/data/query_p0/operator/test_set_operator.out
b/regression-test/data/query_p0/operator/test_set_operator.out
index 48eb4a0c9ba..211854115bc 100644
Binary files a/regression-test/data/query_p0/operator/test_set_operator.out and
b/regression-test/data/query_p0/operator/test_set_operator.out differ
diff --git a/regression-test/suites/query_p0/operator/test_set_operator.groovy
b/regression-test/suites/query_p0/operator/test_set_operator.groovy
index 7d6219585e4..a013313b254 100644
--- a/regression-test/suites/query_p0/operator/test_set_operator.groovy
+++ b/regression-test/suites/query_p0/operator/test_set_operator.groovy
@@ -97,4 +97,31 @@ suite("test_set_operators", "query,p0,arrow_flight_sql") {
order_qt_select_except """
select col1, col1 from t1 except select col1, col1 from t2;
"""
+
+ sql """
+ DROP TABLE IF EXISTS a_table;
+ """
+ sql """
+ create table a_table (
+ k1 int null
+ )
+ duplicate key (k1)
+ distributed BY hash(k1) buckets 3
+ properties("replication_num" = "1");
+ """
+ sql """
+ DROP TABLE IF EXISTS b_table;
+ """
+ sql """
+ create table b_table (
+ k1 int null
+ )
+ duplicate key (k1)
+ distributed BY hash(k1) buckets 3
+ properties("replication_num" = "1");
+ """
+
+ sql "insert into a_table select 0;"
+ sql "insert into b_table select null;"
+ qt_test "select * from a_table intersect select * from b_table;"
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]