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

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

commit 4e03cf762a034b5b287e6a00f0ff708f0dc5a500
Author: Jerry Hu <mrh...@gmail.com>
AuthorDate: Fri Sep 8 09:28:55 2023 +0800

    [fix](nested_loop_join) null value should be output in semi-anti join 
(#23971)
    
    create table t1
            (k1 bigint, k2 bigint)
            ENGINE=OLAP
    DUPLICATE KEY(k1, k2)
    COMMENT 'OLAP'
    DISTRIBUTED BY HASH(k2) BUCKETS 1
    PROPERTIES (
    "replication_allocation" = "tag.location.default: 1",
    "is_being_synced" = "false",
    "storage_format" = "V2",
    "light_schema_change" = "true",
    "disable_auto_compaction" = "false",
    "enable_single_replica_compaction" = "false"
    );
    create table t3
            (k1 bigint, k2 bigint)
            ENGINE=OLAP
    DUPLICATE KEY(k1, k2)
    COMMENT 'OLAP'
    DISTRIBUTED BY HASH(k2) BUCKETS 1
    PROPERTIES (
    "replication_allocation" = "tag.location.default: 1",
    "is_being_synced" = "false",
    "storage_format" = "V2",
    "light_schema_change" = "true",
    "disable_auto_compaction" = "false",
    "enable_single_replica_compaction" = "false"
    );
    Data:
    
    insert into t1 values (1,null),(null,1),(1,2), (null,2),(1,3), (2,4), 
(2,5), (3,3), (3,4), (20,2), (22,3), (24,4),(null,null);
    insert into t3 values (1,null),(null,1),(1,4), (1,2), (null,3), (2,4), 
(3,7), (3,9),(null,null),(5,1);
    Query:
    
     select t1.* from t1 where not exists ( select k1 from t3 where t1.k2 < 
t3.k2 );
    Result:
    
    Empty set
    Expect result:
    
    +------+------+
    | k1   | k2   |
    +------+------+
    | NULL | NULL |
    |    1 | NULL |
    +------+------+
---
 be/src/vec/exec/join/vnested_loop_join_node.h         | 4 +---
 regression-test/data/nereids_p0/join/test_join_13.out | 2 ++
 regression-test/data/query_p0/join/test_join.out      | 2 ++
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/be/src/vec/exec/join/vnested_loop_join_node.h 
b/be/src/vec/exec/join/vnested_loop_join_node.h
index 03676629bc..931db5f7f1 100644
--- a/be/src/vec/exec/join/vnested_loop_join_node.h
+++ b/be/src/vec/exec/join/vnested_loop_join_node.h
@@ -91,9 +91,7 @@ public:
 private:
     template <typename JoinOpType, bool set_build_side_flag, bool 
set_probe_side_flag>
     Status _generate_join_block_data(RuntimeState* state, JoinOpType& 
join_op_variants) {
-        constexpr bool ignore_null = JoinOpType::value == 
TJoinOp::LEFT_ANTI_JOIN ||
-                                     JoinOpType::value == 
TJoinOp::NULL_AWARE_LEFT_ANTI_JOIN ||
-                                     JoinOpType::value == 
TJoinOp::RIGHT_ANTI_JOIN;
+        constexpr bool ignore_null = JoinOpType::value == 
TJoinOp::NULL_AWARE_LEFT_ANTI_JOIN;
         _left_block_start_pos = _left_block_pos;
         _left_side_process_count = 0;
         DCHECK(!_need_more_input_data || !_matched_rows_done);
diff --git a/regression-test/data/nereids_p0/join/test_join_13.out 
b/regression-test/data/nereids_p0/join/test_join_13.out
index 9a9c622f54..64f08c9be7 100644
--- a/regression-test/data/nereids_p0/join/test_join_13.out
+++ b/regression-test/data/nereids_p0/join/test_join_13.out
@@ -51,6 +51,7 @@
 15
 
 -- !left_anti_join_null_3 --
+\N
 1
 2
 3
@@ -91,6 +92,7 @@
 3
 
 -- !right_anti_join_null_1 --
+\N
 1
 
 -- !right_anti_join_null_2 --
diff --git a/regression-test/data/query_p0/join/test_join.out 
b/regression-test/data/query_p0/join/test_join.out
index 225e41d501..57a5da7516 100644
--- a/regression-test/data/query_p0/join/test_join.out
+++ b/regression-test/data/query_p0/join/test_join.out
@@ -1268,6 +1268,7 @@ false     3       1989    1002    11011905        
24453.325       false   2012-03-14      2000-01-01T00:00        yunlj8@nk
 15
 
 -- !left_anti_join_null_3 --
+\N
 1
 2
 3
@@ -1308,6 +1309,7 @@ false     3       1989    1002    11011905        
24453.325       false   2012-03-14      2000-01-01T00:00        yunlj8@nk
 3
 
 -- !right_anti_join_null_1 --
+\N
 1
 
 -- !right_anti_join_null_2 --


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

Reply via email to