Skip to content

Commit 98c4aaf

Browse files
authored
Merge pull request ClickHouse#89629 from ClickHouse/backport/25.8/89512
Backport ClickHouse#89512 to 25.8: Fix incorrect join result in case of JOIN on condition with OR
2 parents 25ad86d + 1c35c0f commit 98c4aaf

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

src/Interpreters/HashJoin/HashJoin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1811,7 +1811,7 @@ void HashJoin::onBuildPhaseFinish()
18111811
}
18121812
}
18131813

1814-
if (all_values_unique && strictness == JoinStrictness::All && isInnerOrLeft(kind))
1814+
if (all_values_unique && strictness == JoinStrictness::All && isInnerOrLeft(kind) && data->maps.size() == 1)
18151815
{
18161816
strictness = JoinStrictness::RightAny;
18171817
all_join_was_promoted_to_right_any = true;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
0 1 0
2+
0 1 1
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
SELECT *
2+
FROM ( SELECT number AS a, number + 1 AS b FROM numbers(1) ) AS l
3+
INNER JOIN ( SELECT number AS a FROM numbers(2) ) AS r ON (l.a = r.a) OR (l.b = r.a)
4+
ORDER BY ALL;

0 commit comments

Comments
 (0)