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

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


The following commit(s) were added to refs/heads/branch-4.0-preview by this 
push:
     new db5044a38e1 Revert "[Improvementation](join) empty_block shall be set 
true when build block only one row (#33721) (#34264)
db5044a38e1 is described below

commit db5044a38e1a0e430206fc1d0f0ab77c8c965107
Author: Pxl <[email protected]>
AuthorDate: Sun Apr 28 22:07:54 2024 +0800

    Revert "[Improvementation](join) empty_block shall be set true when build 
block only one row (#33721) (#34264)
    
    * Revert "[Bug](join) do not short_circuit_for_probe for mark join (#34170)"
    
    This reverts commit 57621c23a356f41d802231ef071d64bad68e4d12.
    
    * Revert "[Improvementation](join) empty_block shall be set true when build 
block only one row (#33721)" (#33916)
    
    This reverts commit a93c86577c49adcf3b0f58248fd5283d7e7a27f4.
---
 be/src/pipeline/exec/hashjoin_build_sink.cpp       | 21 +++---
 be/src/pipeline/exec/hashjoin_probe_operator.cpp   | 17 +++--
 be/src/vec/core/column_with_type_and_name.cpp      | 12 ++--
 regression-test/data/nereids_syntax_p0/join.out    |  5 --
 .../join/rqg/rqg1333347798/rqg1333347798.out       |  6 --
 .../suites/nereids_syntax_p0/join.groovy           |  4 +-
 .../join/rqg/rqg1333347798/rqg1333347798.groovy    | 80 ----------------------
 7 files changed, 27 insertions(+), 118 deletions(-)

diff --git a/be/src/pipeline/exec/hashjoin_build_sink.cpp 
b/be/src/pipeline/exec/hashjoin_build_sink.cpp
index cd0af4c4369..a82dc7deb60 100644
--- a/be/src/pipeline/exec/hashjoin_build_sink.cpp
+++ b/be/src/pipeline/exec/hashjoin_build_sink.cpp
@@ -157,22 +157,21 @@ bool HashJoinBuildSinkLocalState::build_unique() const {
 
 void HashJoinBuildSinkLocalState::init_short_circuit_for_probe() {
     auto& p = _parent->cast<HashJoinBuildSinkOperatorX>();
-    bool empty_block =
-            !_shared_state->build_block ||
-            !(_shared_state->build_block->rows() > 1); // build size always 
mock a row into block
     _shared_state->short_circuit_for_probe =
-            ((_shared_state->_has_null_in_build_side &&
-              p._join_op == TJoinOp::NULL_AWARE_LEFT_ANTI_JOIN) ||
-             (empty_block &&
-              (p._join_op == TJoinOp::INNER_JOIN || p._join_op == 
TJoinOp::LEFT_SEMI_JOIN ||
-               p._join_op == TJoinOp::RIGHT_OUTER_JOIN || p._join_op == 
TJoinOp::RIGHT_SEMI_JOIN ||
-               p._join_op == TJoinOp::RIGHT_ANTI_JOIN))) &&
-            !p._is_mark_join;
+            (_shared_state->_has_null_in_build_side &&
+             p._join_op == TJoinOp::NULL_AWARE_LEFT_ANTI_JOIN && 
!p._is_mark_join) ||
+            (!_shared_state->build_block && p._join_op == TJoinOp::INNER_JOIN 
&&
+             !p._is_mark_join) ||
+            (!_shared_state->build_block && p._join_op == 
TJoinOp::LEFT_SEMI_JOIN &&
+             !p._is_mark_join) ||
+            (!_shared_state->build_block && p._join_op == 
TJoinOp::RIGHT_OUTER_JOIN) ||
+            (!_shared_state->build_block && p._join_op == 
TJoinOp::RIGHT_SEMI_JOIN) ||
+            (!_shared_state->build_block && p._join_op == 
TJoinOp::RIGHT_ANTI_JOIN);
 
     //when build table rows is 0 and not have other_join_conjunct and not 
_is_mark_join and join type is one of 
LEFT_OUTER_JOIN/FULL_OUTER_JOIN/LEFT_ANTI_JOIN
     //we could get the result is probe table + null-column(if need output)
     _shared_state->empty_right_table_need_probe_dispose =
-            (empty_block && !p._have_other_join_conjunct && !p._is_mark_join) 
&&
+            (!_shared_state->build_block && !p._have_other_join_conjunct && 
!p._is_mark_join) &&
             (p._join_op == TJoinOp::LEFT_OUTER_JOIN || p._join_op == 
TJoinOp::FULL_OUTER_JOIN ||
              p._join_op == TJoinOp::LEFT_ANTI_JOIN);
 }
diff --git a/be/src/pipeline/exec/hashjoin_probe_operator.cpp 
b/be/src/pipeline/exec/hashjoin_probe_operator.cpp
index 2e273f18660..a58ad62211c 100644
--- a/be/src/pipeline/exec/hashjoin_probe_operator.cpp
+++ b/be/src/pipeline/exec/hashjoin_probe_operator.cpp
@@ -247,9 +247,7 @@ Status HashJoinProbeOperatorX::pull(doris::RuntimeState* 
state, vectorized::Bloc
     }
 
     //TODO: this short circuit maybe could refactor, no need to check at here.
-    // only support nereids
-    if (local_state._shared_state->empty_right_table_need_probe_dispose &&
-        !Base::_projections.empty()) {
+    if (local_state._shared_state->empty_right_table_need_probe_dispose) {
         // when build table rows is 0 and not have other_join_conjunct and 
join type is one of LEFT_OUTER_JOIN/FULL_OUTER_JOIN/LEFT_ANTI_JOIN
         // we could get the result is probe table + null-column(if need output)
         // If we use a short-circuit strategy, should return block directly by 
add additional null data.
@@ -259,6 +257,12 @@ Status HashJoinProbeOperatorX::pull(doris::RuntimeState* 
state, vectorized::Bloc
             return Status::OK();
         }
 
+        vectorized::Block temp_block;
+        //get probe side output column
+        for (int i = 0; i < _left_output_slot_flags.size(); ++i) {
+            temp_block.insert(local_state._probe_block.get_by_position(i));
+        }
+
         //create build side null column, if need output
         for (int i = 0;
              (_join_op != TJoinOp::LEFT_ANTI_JOIN) && i < 
_right_output_slot_flags.size(); ++i) {
@@ -269,8 +273,8 @@ Status HashJoinProbeOperatorX::pull(doris::RuntimeState* 
state, vectorized::Bloc
                     
vectorized::ColumnVector<vectorized::UInt8>::create(block_rows, 1);
             auto nullable_column = 
vectorized::ColumnNullable::create(std::move(column),
                                                                       
std::move(null_map_column));
-            local_state._probe_block.insert({std::move(nullable_column), 
make_nullable(type),
-                                             _right_table_column_names[i]});
+            temp_block.insert({std::move(nullable_column), make_nullable(type),
+                               _right_table_column_names[i]});
         }
         if (_is_outer_join) {
             reinterpret_cast<vectorized::ColumnUInt8*>(
@@ -286,7 +290,8 @@ Status HashJoinProbeOperatorX::pull(doris::RuntimeState* 
state, vectorized::Bloc
         /// No need to check the block size in `_filter_data_and_build_output` 
because here dose not
         /// increase the output rows count(just same as `_probe_block`'s rows 
count).
         RETURN_IF_ERROR(local_state.filter_data_and_build_output(state, 
output_block, eos,
-                                                                 
&local_state._probe_block, false));
+                                                                 &temp_block, 
false));
+        temp_block.clear();
         
local_state._probe_block.clear_column_data(_child_x->row_desc().num_materialized_slots());
         return Status::OK();
     }
diff --git a/be/src/vec/core/column_with_type_and_name.cpp 
b/be/src/vec/core/column_with_type_and_name.cpp
index e93946804ff..cd0f7194004 100644
--- a/be/src/vec/core/column_with_type_and_name.cpp
+++ b/be/src/vec/core/column_with_type_and_name.cpp
@@ -62,17 +62,15 @@ void ColumnWithTypeAndName::dump_structure(std::ostream& 
out) const {
         out << name;
     }
 
-    if (type) {
+    if (type)
         out << " " << type->get_name();
-    } else {
+    else
         out << " nullptr";
-    }
 
-    if (column) {
-        out << ' ' << column->dump_structure() << "(use_count=" << 
column->use_count() << ')';
-    } else {
+    if (column)
+        out << ' ' << column->dump_structure();
+    else
         out << " nullptr";
-    }
 }
 
 String ColumnWithTypeAndName::dump_structure() const {
diff --git a/regression-test/data/nereids_syntax_p0/join.out 
b/regression-test/data/nereids_syntax_p0/join.out
index 2cbe9fedd46..48599590462 100644
--- a/regression-test/data/nereids_syntax_p0/join.out
+++ b/regression-test/data/nereids_syntax_p0/join.out
@@ -60,8 +60,3 @@
 -- !outer_join_with_filter --
 1310179        1455    1455    42
 
--- !test --
-
--- !test --
-29     Supplier#000000029      VVSymB3fbwaN    ARGENTINA4      ARGENTINA       
AMERICA 11-773-203-7342
-
diff --git 
a/regression-test/data/query_p0/join/rqg/rqg1333347798/rqg1333347798.out 
b/regression-test/data/query_p0/join/rqg/rqg1333347798/rqg1333347798.out
deleted file mode 100644
index 64568eea9c6..00000000000
--- a/regression-test/data/query_p0/join/rqg/rqg1333347798/rqg1333347798.out
+++ /dev/null
@@ -1,6 +0,0 @@
--- This file is automatically generated. You should know what you did if you 
want to edit this
--- !test --
-\N
-\N
-\N
-
diff --git a/regression-test/suites/nereids_syntax_p0/join.groovy 
b/regression-test/suites/nereids_syntax_p0/join.groovy
index 4b79f8f52a8..63382c3ed44 100644
--- a/regression-test/suites/nereids_syntax_p0/join.groovy
+++ b/regression-test/suites/nereids_syntax_p0/join.groovy
@@ -260,7 +260,7 @@ suite("join") {
     );
     """
 
-    order_qt_test """
+    sql """
         select 
          ref_1.`c_long_decimal` as c0,
          ref_3.`c1` as c1
@@ -271,6 +271,4 @@ suite("join") {
         where
           ref_2.`id` is not NULL
     """
-
-    order_qt_test "SELECT * FROM lineorder RIGHT SEMI JOIN supplier ON 
lineorder.lo_suppkey = supplier.s_suppkey and s_name='Supplier#000000029';"
 }
diff --git 
a/regression-test/suites/query_p0/join/rqg/rqg1333347798/rqg1333347798.groovy 
b/regression-test/suites/query_p0/join/rqg/rqg1333347798/rqg1333347798.groovy
deleted file mode 100644
index e870be15682..00000000000
--- 
a/regression-test/suites/query_p0/join/rqg/rqg1333347798/rqg1333347798.groovy
+++ /dev/null
@@ -1,80 +0,0 @@
-// 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("rqg1333347798") {
-    sql """
-    DROP TABLE IF EXISTS 
`table_50_undef_partitions2_keys3_properties4_distributed_by53`;
-    """
-    sql """
-create table table_50_undef_partitions2_keys3_properties4_distributed_by53 (
-pk int,
-col_bigint_undef_signed bigint   ,
-col_bigint_undef_signed2 bigint   
-) engine=olap
-DUPLICATE KEY(pk)
-distributed by hash(pk) buckets 10
-properties("replication_num" = "1");
-    """
-
-    sql """insert into 
table_50_undef_partitions2_keys3_properties4_distributed_by53(pk,col_bigint_undef_signed,col_bigint_undef_signed2)
 values 
(0,null,18332),(1,788547,null),(2,4644959,-56),(3,8364628,72),(4,null,-5581),(5,2344024,-62),(6,-2689177,22979),(7,1320,-41),(8,null,-54),(9,12,-6236),(10,-8321648,null),(11,153691,null),(12,-8056,null),(13,-12,-2343514),(14,-35,-3361960),(15,62,null),(16,-551249,750),(17,-14,null),(18,36,109),(19,null,9365),(20,null,-2574125),(21,null,-739080),
 [...]
-    """
-    sql """analyze table 
table_50_undef_partitions2_keys3_properties4_distributed_by53 with sync;
- """
-
-
-        sql """
-    DROP TABLE IF EXISTS 
`table_100_undef_partitions2_keys3_properties4_distributed_by52`;
-    """
-    sql """
-create table table_100_undef_partitions2_keys3_properties4_distributed_by52 (
-pk int,
-col_bigint_undef_signed bigint   ,
-col_bigint_undef_signed2 bigint   
-) engine=olap
-DUPLICATE KEY(pk, col_bigint_undef_signed)
-distributed by hash(pk) buckets 10
-properties("replication_num" = "1");
-    """
-
-    sql """insert into 
table_100_undef_partitions2_keys3_properties4_distributed_by52(pk,col_bigint_undef_signed,col_bigint_undef_signed2)
 values 
(0,null,69),(1,97,-61),(2,-6336,999069),(3,-32178,null),(4,18555,7),(5,null,-7825686),(6,92,11525),(7,106,null),(8,null,-22098),(9,-39,null),(10,31317,-17962),(11,null,-3402748),(12,1494928,1915512),(13,-25,-15251),(14,null,-5533979),(15,-6919683,71),(16,-30968,80),(17,58,null),(18,null,-1),(19,null,107),(20,null,21),(21,-764352,null),(22,14590
 [...]
-    """
-    sql """analyze table 
table_100_undef_partitions2_keys3_properties4_distributed_by52 with sync;
- """
-
-
-    sql """
-    DROP TABLE IF EXISTS 
`table_100_undef_partitions2_keys3_properties4_distributed_by5`;
-    """
-    sql """
-create table table_100_undef_partitions2_keys3_properties4_distributed_by5 (
-col_bigint_undef_signed bigint/*agg_type_placeholder*/   ,
-col_bigint_undef_signed2 bigint/*agg_type_placeholder*/   ,
-pk int/*agg_type_placeholder*/
-) engine=olap
-distributed by hash(pk) buckets 10
-properties("replication_num" = "1");
-    """
-
-    sql """insert into 
table_100_undef_partitions2_keys3_properties4_distributed_by5(pk,col_bigint_undef_signed,col_bigint_undef_signed2)
 values 
(0,3429168,null),(1,-8095203,null),(2,null,null),(3,5227651,null),(4,-50,6026740),(5,-43,null),(6,-10,-77),(7,-13598,null),(8,13156,112),(9,-16585,18163),(10,-1184022,-5541355),(11,2386763,90),(12,-29492,-7934048),(13,-30940,-21),(14,22803,null),(15,27132,null),(16,17,-411),(17,6965,-29093),(18,32341,98),(19,-14991,116),(20,-7075162,null),(21,34
 [...]
-    """
-    sql """analyze table 
table_100_undef_partitions2_keys3_properties4_distributed_by5 with sync;
- """
-
-    qt_test """
-    SELECT  T2.col_bigint_undef_signed AS C1   FROM 
table_50_undef_partitions2_keys3_properties4_distributed_by53 AS T1  RIGHT 
OUTER JOIN  table_100_undef_partitions2_keys3_properties4_distributed_by52 AS 
T2 ON T1.col_bigint_undef_signed  <=>  T2.col_bigint_undef_signed2   AND  
T1.col_bigint_undef_signed IN  (SELECT T3.col_bigint_undef_signed FROM 
table_100_undef_partitions2_keys3_properties4_distributed_by5 AS T3 WHERE 
T1.col_bigint_undef_signed  >=  T3.col_bigint_undef_signed2) ORDER B [...]
-    """
-}
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to