Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix](nereids) do not transpose semi join agg when mark join #32475

Merged
merged 5 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public Rule build() {
return logicalJoin(logicalAggregate(), any())
.whenNot(join -> ConnectContext.get().getSessionVariable().isDisableJoinReorder())
.when(join -> join.getJoinType().isLeftSemiOrAntiJoin())
.whenNot(join -> join.isMarkJoin())
.then(join -> {
LogicalAggregate<Plan> aggregate = join.left();
if (!canTranspose(aggregate, join)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public Rule build() {
return logicalJoin(logicalProject(logicalAggregate()), any())
.whenNot(join -> ConnectContext.get().getSessionVariable().isDisableJoinReorder())
.when(join -> join.getJoinType().isLeftSemiOrAntiJoin())
.whenNot(join -> join.isMarkJoin())
.when(join -> join.left().isAllSlots())
.then(join -> {
LogicalProject<LogicalAggregate<Plan>> project = join.left();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,11 @@ PhysicalResultSink
----filter((T2.__DORIS_DELETE_SIGN__ = 0))
------PhysicalOlapScan[T2]

-- !groupby_negative_case3 --
PhysicalResultSink
--hashJoin[LEFT_SEMI_JOIN] hashCondition=() otherCondition=() markCondition=((T3.len = T3.len))
----hashAgg[GLOBAL]
------hashAgg[LOCAL]
--------PhysicalOlapScan[T3]
----PhysicalOlapScan[T3]

Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,17 @@ suite("transposeSemiJoinAgg") {
sql '''
alter table T2 modify column a set stats ('ndv'='100', 'num_nulls'='0', 'row_count'='100');
'''

sql "drop table if exists T3;"
sql """
CREATE TABLE T3 (
str varchar(100),
len int
) DUPLICATE KEY(str)
DISTRIBUTED BY HASH(str) BUCKETS 10
PROPERTIES("replication_num" = "1");
"""

// RULE: TransposeSemiJoinAggProject
// 1. group-by(without grouping sets)
// agg-leftSemi => leftSemi-agg
Expand Down Expand Up @@ -146,4 +157,9 @@ suite("transposeSemiJoinAgg") {
from (select sum(C) as D from T1 group by grouping sets ((a, b), (a), ())) T3
left semi join T2 on T3.D=T2.a;
"""
// https://github.com/apache/doris/issues/31308
qt_groupby_negative_case3 """
explain shape plan
select case when len in (select len from T3) then 1 else 1 end c1 from T3 group by len;
"""
}
Loading