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

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

commit dac204d6e53128751f4f1c9a0edcc72adf87334e
Author: BiteTheDDDDt <pxl...@qq.com>
AuthorDate: Thu Nov 23 16:53:09 2023 +0800

    update
---
 .../vec/exec/join/process_hash_table_probe_impl.h  |  7 +--
 .../data/query_p0/join/mark_join/mark_join.out     | 19 +++++++
 .../query_p0/join/mark_join/mark_join.groovy       | 64 ++++++++++++++++++++++
 3 files changed, 85 insertions(+), 5 deletions(-)

diff --git a/be/src/vec/exec/join/process_hash_table_probe_impl.h 
b/be/src/vec/exec/join/process_hash_table_probe_impl.h
index c3263e9a2b9..39acd7e8f23 100644
--- a/be/src/vec/exec/join/process_hash_table_probe_impl.h
+++ b/be/src/vec/exec/join/process_hash_table_probe_impl.h
@@ -241,16 +241,12 @@ Status ProcessHashTableProbe<JoinOpType, 
Parent>::do_other_join_conjuncts(
         auto new_filter_column = ColumnUInt8::create(row_count);
         auto* __restrict filter_map = new_filter_column->get_data().data();
 
-        auto null_map_column = ColumnUInt8::create(row_count, 0);
-        auto* __restrict null_map_data = null_map_column->get_data().data();
         // process equal-conjuncts-matched tuples that are newly generated
         // in this run if there are any.
         for (int i = 0; i < row_count; ++i) {
             bool join_hit = _build_indexs[i];
             bool other_hit = filter_column_ptr[i];
 
-            null_map_data[i] = !join_hit || !other_hit;
-
             if (!join_hit) {
                 filter_map[i] = _parent->_last_probe_match != _probe_indexs[i];
             } else {
@@ -263,7 +259,8 @@ Status ProcessHashTableProbe<JoinOpType, 
Parent>::do_other_join_conjuncts(
 
         for (size_t i = 0; i < row_count; ++i) {
             if (filter_map[i]) {
-                _tuple_is_null_right_flags->emplace_back(null_map_data[i]);
+                _tuple_is_null_right_flags->emplace_back(!_build_indexs[i] ||
+                                                         
!filter_column_ptr[i]);
                 if constexpr (JoinOpType == TJoinOp::FULL_OUTER_JOIN) {
                     visited[_build_indexs[i]] = 1;
                 }
diff --git a/regression-test/data/query_p0/join/mark_join/mark_join.out 
b/regression-test/data/query_p0/join/mark_join/mark_join.out
new file mode 100644
index 00000000000..ed3575d0e14
--- /dev/null
+++ b/regression-test/data/query_p0/join/mark_join/mark_join.out
@@ -0,0 +1,19 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !test --
+1      1       1       a
+2      2       2       b
+3      -3      \N      c
+3      3       \N      c
+
+-- !test --
+1      1       1       a
+2      2       2       b
+3      -3      \N      c
+3      3       \N      c
+
+-- !test --
+1      1       1       a
+2      2       2       b
+3      -3      \N      c
+3      3       \N      c
+
diff --git a/regression-test/suites/query_p0/join/mark_join/mark_join.groovy 
b/regression-test/suites/query_p0/join/mark_join/mark_join.groovy
new file mode 100644
index 00000000000..9759a0e9b4c
--- /dev/null
+++ b/regression-test/suites/query_p0/join/mark_join/mark_join.groovy
@@ -0,0 +1,64 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+suite("mark_join") {
+    sql "drop table if exists t1;"
+    sql "drop table if exists t2;"
+    sql """
+        create table t1 (
+            k1 int null,
+            k2 int null,
+            k3 bigint null,
+        k4 varchar(100) null
+        )
+        duplicate key (k1,k2,k3)
+        distributed BY hash(k1) buckets 3
+        properties("replication_num" = "1");
+    """
+
+    sql """
+        create table t2 (
+            k1 int null,
+            k2 int null,
+            k3 bigint null,
+        k4 varchar(100) null
+        )
+        duplicate key (k1,k2,k3)
+        distributed BY hash(k1) buckets 3
+        properties("replication_num" = "1");
+    """
+
+    sql "insert into t1 select 1,1,1,'a';"
+    sql "insert into t1 select 2,2,2,'b';"
+    sql "insert into t1 select 3,-3,null,'c';"
+    sql "insert into t1 select 3,3,null,'c';"
+
+    sql "insert into t2 select 1,1,1,'a';"
+    sql "insert into t2 select 2,2,2,'b';"
+    sql "insert into t2 select 3,-3,null,'c';"
+    sql "insert into t2 select 3,3,null,'c';"
+
+    qt_test """
+    select * from t1 where exists (select t2.k3 from t2 where t1.k2 = t2.k2) 
or k1 < 10 order by k1, k2;
+    """
+    qt_test """
+    select * from t1 where not exists (select t2.k3 from t2 where t1.k2 = 
t2.k2) or k1 < 10 order by k1, k2;
+    """
+    qt_test """
+    select * from t1 where t1.k1 not in (select t2.k3 from t2 where t2.k2 = 
t1.k2) or k1 < 10 order by k1, k2;
+    """
+}


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

Reply via email to