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

lihaopeng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 0c30f2c3ba0 [Bug](set) fix find null get wrong result on set operators 
(#48001)
0c30f2c3ba0 is described below

commit 0c30f2c3ba07229764b193a46b2ede653345b794
Author: Pxl <x...@selectdb.com>
AuthorDate: Tue Feb 18 17:46:30 2025 +0800

    [Bug](set) fix find null get wrong result on set operators (#48001)
    
    fix find null get wrong result on set operators
---
 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 f0a365cfc09..60c2370bc60 100644
--- a/be/src/vec/common/columns_hashing.h
+++ b/be/src/vec/common/columns_hashing.h
@@ -152,8 +152,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: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to