From 2aeaea410ffe8421597adccabdd84aae02f256ad Mon Sep 17 00:00:00 2001 From: starocean999 <12095047@qq.com> Date: Mon, 19 Feb 2024 11:13:08 +0800 Subject: [PATCH] [fix](nereids)diable PushDownJoinOtherCondition rule for mark join --- .../rewrite/PushDownJoinOtherCondition.java | 3 ++- .../data/nereids_p0/join/test_mark_join.out | 9 +++++++++ .../nereids_p0/join/test_mark_join.groovy | 19 ++++++++++++++++++- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownJoinOtherCondition.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownJoinOtherCondition.java index 8fff61988d4d61..cec7413cd61305 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownJoinOtherCondition.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownJoinOtherCondition.java @@ -62,7 +62,8 @@ public Rule build() { return logicalJoin() // TODO: we may need another rule to handle on true or on false condition .when(join -> !join.getOtherJoinConjuncts().isEmpty() && !(join.getOtherJoinConjuncts().size() == 1 - && join.getOtherJoinConjuncts().get(0) instanceof BooleanLiteral)) + && join.getOtherJoinConjuncts().get(0) instanceof BooleanLiteral) + && !join.isMarkJoin()) .then(join -> { List otherJoinConjuncts = join.getOtherJoinConjuncts(); List remainingOther = Lists.newArrayList(); diff --git a/regression-test/data/nereids_p0/join/test_mark_join.out b/regression-test/data/nereids_p0/join/test_mark_join.out index 4098502b75df66..1ab6bcce40ee78 100644 --- a/regression-test/data/nereids_p0/join/test_mark_join.out +++ b/regression-test/data/nereids_p0/join/test_mark_join.out @@ -41,3 +41,12 @@ 3 \N true 4 \N false +-- !mark_join7 -- +1 p 0 +9 1 +\N \N 2 +\N \N 3 +3 4 +2 q 5 +0 6 + diff --git a/regression-test/suites/nereids_p0/join/test_mark_join.groovy b/regression-test/suites/nereids_p0/join/test_mark_join.groovy index 6008919d831a5a..e951ea155771c8 100644 --- a/regression-test/suites/nereids_p0/join/test_mark_join.groovy +++ b/regression-test/suites/nereids_p0/join/test_mark_join.groovy @@ -21,6 +21,7 @@ suite("test_mark_join", "nereids_p0") { sql "drop table if exists `test_mark_join_t1`;" sql "drop table if exists `test_mark_join_t2`;" + sql "drop table if exists table_7_undef_partitions2_keys3_properties4_distributed_by5;" sql """ CREATE TABLE IF NOT EXISTS `test_mark_join_t1` ( @@ -60,6 +61,16 @@ suite("test_mark_join", "nereids_p0") { ); """ + sql """ + create table table_7_undef_partitions2_keys3_properties4_distributed_by5 ( + col_int_undef_signed int/*agg_type_placeholder*/ , + col_varchar_10__undef_signed varchar(10)/*agg_type_placeholder*/ , + pk int/*agg_type_placeholder*/ + ) engine=olap + distributed by hash(pk) buckets 10 + properties("replication_num" = "1"); + """ + sql """ insert into `test_mark_join_t1` values (1, 1, 1, 'abc', 'efg', 'hjk'), @@ -80,6 +91,8 @@ suite("test_mark_join", "nereids_p0") { ); """ + sql """insert into table_7_undef_partitions2_keys3_properties4_distributed_by5(pk,col_int_undef_signed,col_varchar_10__undef_signed) values (0,1,'p'),(1,9,''),(2,null,null),(3,null,null),(4,3,''),(5,2,'q'),(6,0,'');""" + qt_mark_join1 """ select k1, k2 @@ -122,5 +135,9 @@ suite("test_mark_join", "nereids_p0") { from test_mark_join_t1 order by 1, 2, 3; """ - + qt_mark_join7 """ + SELECT * FROM table_7_undef_partitions2_keys3_properties4_distributed_by5 AS t1 + WHERE EXISTS ( SELECT MIN(`pk`) FROM table_7_undef_partitions2_keys3_properties4_distributed_by5 AS t2 WHERE t1.pk = 6 ) + OR EXISTS ( SELECT `pk` FROM table_7_undef_partitions2_keys3_properties4_distributed_by5 AS t2 WHERE t1.pk = 5 ) order by pk ; + """ }