Skip to content

Commit

Permalink
[fix](planner)should not add TupleIsNullPredicate for inlineview plan (
Browse files Browse the repository at this point in the history
  • Loading branch information
starocean999 authored and 王翔宇 committed Oct 28, 2023
1 parent 833549b commit 21c7081
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
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;
Expand All @@ -74,7 +73,6 @@
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;
Expand Down Expand Up @@ -1571,18 +1569,6 @@ private PlanNode createInlineViewPlan(Analyzer analyzer, InlineViewRef inlineVie
//set outputSmap to substitute literal in outputExpr
unionNode.setWithoutTupleIsNullOutputSmap(inlineViewRef.getSmap());
unionNode.setOutputSmap(inlineViewRef.getSmap(), analyzer);
if (analyzer.isOuterJoined(inlineViewRef.getId())) {
List<Expr> 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;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
-- !select2 --
1

-- !select3 --
1 2023 2023 1

Original file line number Diff line number Diff line change
Expand Up @@ -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;
"""
Expand Down

0 comments on commit 21c7081

Please sign in to comment.