This is an automated email from the ASF dual-hosted git repository.
gabriellee 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 57621c23a35 [Bug](join) do not short_circuit_for_probe for mark join
(#34170)
57621c23a35 is described below
commit 57621c23a356f41d802231ef071d64bad68e4d12
Author: Pxl <[email protected]>
AuthorDate: Sun Apr 28 09:57:12 2024 +0800
[Bug](join) do not short_circuit_for_probe for mark join (#34170)
---
be/src/pipeline/exec/hashjoin_build_sink.cpp | 14 ++--
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 ++++++++++++++++++++++
5 files changed, 101 insertions(+), 8 deletions(-)
diff --git a/be/src/pipeline/exec/hashjoin_build_sink.cpp
b/be/src/pipeline/exec/hashjoin_build_sink.cpp
index d583a827059..3bec2b07f0b 100644
--- a/be/src/pipeline/exec/hashjoin_build_sink.cpp
+++ b/be/src/pipeline/exec/hashjoin_build_sink.cpp
@@ -160,13 +160,13 @@ void
HashJoinBuildSinkLocalState::init_short_circuit_for_probe() {
!_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 &&
!p._is_mark_join) ||
- (empty_block && p._join_op == TJoinOp::INNER_JOIN &&
!p._is_mark_join) ||
- (empty_block && p._join_op == TJoinOp::LEFT_SEMI_JOIN &&
!p._is_mark_join) ||
- (empty_block && p._join_op == TJoinOp::RIGHT_OUTER_JOIN) ||
- (empty_block && p._join_op == TJoinOp::RIGHT_SEMI_JOIN) ||
- (empty_block && p._join_op == TJoinOp::RIGHT_ANTI_JOIN);
+ ((_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;
//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)
diff --git a/regression-test/data/nereids_syntax_p0/join.out
b/regression-test/data/nereids_syntax_p0/join.out
index 48599590462..2cbe9fedd46 100644
--- a/regression-test/data/nereids_syntax_p0/join.out
+++ b/regression-test/data/nereids_syntax_p0/join.out
@@ -60,3 +60,8 @@
-- !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
new file mode 100644
index 00000000000..64568eea9c6
--- /dev/null
+++ b/regression-test/data/query_p0/join/rqg/rqg1333347798/rqg1333347798.out
@@ -0,0 +1,6 @@
+-- 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 63382c3ed44..4b79f8f52a8 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") {
);
"""
- sql """
+ order_qt_test """
select
ref_1.`c_long_decimal` as c0,
ref_3.`c1` as c1
@@ -271,4 +271,6 @@ 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
new file mode 100644
index 00000000000..e870be15682
--- /dev/null
+++
b/regression-test/suites/query_p0/join/rqg/rqg1333347798/rqg1333347798.groovy
@@ -0,0 +1,80 @@
+// 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]