From e8431e1a97f487af092f297537df9201ef308a25 Mon Sep 17 00:00:00 2001 From: starocean999 <40539150+starocean999@users.noreply.github.com> Date: Mon, 16 Oct 2023 15:24:13 +0800 Subject: [PATCH] [fix](planner)should not add TupleIsNullPredicate for inlineview plan (#25338) --- .../doris/planner/SingleNodePlanner.java | 14 -------------- .../test_outer_join_with_cross_join.out | 3 +++ .../test_outer_join_with_cross_join.groovy | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/SingleNodePlanner.java b/fe/fe-core/src/main/java/org/apache/doris/planner/SingleNodePlanner.java index e4edb3517a..8e128b3b4a 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/planner/SingleNodePlanner.java +++ b/fe/fe-core/src/main/java/org/apache/doris/planner/SingleNodePlanner.java @@ -47,7 +47,6 @@ import org.apache.doris.analysis.TableRef; import org.apache.doris.analysis.TableValuedFunctionRef; import org.apache.doris.analysis.TupleDescriptor; import org.apache.doris.analysis.TupleId; -import org.apache.doris.analysis.TupleIsNullPredicate; import org.apache.doris.catalog.AggregateFunction; import org.apache.doris.catalog.AggregateType; import org.apache.doris.catalog.Column; @@ -74,7 +73,6 @@ import org.apache.doris.planner.external.paimon.PaimonScanNode; import org.apache.doris.qe.ConnectContext; import org.apache.doris.rewrite.mvrewrite.MVSelectFailedException; import org.apache.doris.statistics.StatisticalType; -import org.apache.doris.thrift.TNullSide; import org.apache.doris.thrift.TPushAggOp; import com.google.common.base.Preconditions; @@ -1571,18 +1569,6 @@ public class SingleNodePlanner { //set outputSmap to substitute literal in outputExpr unionNode.setWithoutTupleIsNullOutputSmap(inlineViewRef.getSmap()); unionNode.setOutputSmap(inlineViewRef.getSmap(), analyzer); - if (analyzer.isOuterJoined(inlineViewRef.getId())) { - List nullableRhs; - if (analyzer.isOuterJoinedLeftSide(inlineViewRef.getId())) { - nullableRhs = TupleIsNullPredicate.wrapExprs(inlineViewRef.getSmap().getRhs(), - unionNode.getTupleIds(), TNullSide.LEFT, analyzer); - } else { - nullableRhs = TupleIsNullPredicate.wrapExprs(inlineViewRef.getSmap().getRhs(), - unionNode.getTupleIds(), TNullSide.RIGHT, analyzer); - } - unionNode.setOutputSmap( - new ExprSubstitutionMap(inlineViewRef.getSmap().getLhs(), nullableRhs), analyzer); - } return unionNode; } } diff --git a/regression-test/data/correctness_p0/test_outer_join_with_cross_join.out b/regression-test/data/correctness_p0/test_outer_join_with_cross_join.out index 0a5825a7bb..e2f2ee9a50 100644 --- a/regression-test/data/correctness_p0/test_outer_join_with_cross_join.out +++ b/regression-test/data/correctness_p0/test_outer_join_with_cross_join.out @@ -5,3 +5,6 @@ -- !select2 -- 1 +-- !select3 -- +1 2023 2023 1 + diff --git a/regression-test/suites/correctness_p0/test_outer_join_with_cross_join.groovy b/regression-test/suites/correctness_p0/test_outer_join_with_cross_join.groovy index 507d2755dc..e0857c31c5 100644 --- a/regression-test/suites/correctness_p0/test_outer_join_with_cross_join.groovy +++ b/regression-test/suites/correctness_p0/test_outer_join_with_cross_join.groovy @@ -112,6 +112,24 @@ suite("test_outer_join_with_cross_join") { inner join test_outer_join_with_cross_join_outerjoin_C as ref_4 on true; """ + sql """set enable_nereids_planner=false;""" + qt_select3 """ + WITH a As( + select + (case + when '年' = '年' then DATE_FORMAT(date_sub(concat('2023', '-01-01'), interval 0 year), '%Y') + + end) as startdate, + (case + when '年' = '年' then DATE_FORMAT(date_sub(concat('2023', '-01-01'), interval 0 year), '%Y') + + end) as enddate + ) + select * from test_outer_join_with_cross_join_outerjoin_A DMR_POTM, a + right join ( select distinct a from test_outer_join_with_cross_join_outerjoin_B ) DD + on DMR_POTM.a =DD.a; + """ + sql """ drop table if exists test_outer_join_with_cross_join_outerjoin_A; """