Backport #63755 to 24.3: Fix ILLEGAL_COLUMN in partial_merge join

This commit is contained in:
robot-clickhouse 2024-05-15 13:07:49 +00:00
parent a3c1ba35b1
commit 3b0da30568
3 changed files with 13 additions and 2 deletions

View File

@ -700,7 +700,9 @@ void MergeJoin::joinBlock(Block & block, ExtraBlockPtr & not_processed)
/// We need to check type of masks before `addConditionJoinColumn`, because it assumes that types is correct
JoinCommon::checkTypesOfMasks(block, mask_column_name_left, right_sample_block, mask_column_name_right);
/// Add auxiliary column, will be removed after joining
if (!not_processed)
/// Add an auxiliary column, which will be removed after joining
/// We do not need to add it twice when we are continuing to process the block from the previous iteration
addConditionJoinColumn(block, JoinTableSide::Left);
/// Types of keys can be checked only after `checkTypesOfKeys`

View File

@ -0,0 +1 @@
9900 49990050 49990050 49990050

View File

@ -0,0 +1,8 @@
SET join_algorithm = 'partial_merge';
SET max_joined_block_size_rows = 100;
SELECT count(ignore(*)), sum(t1.a), sum(t1.b), sum(t2.a)
FROM ( SELECT number AS a, number AS b FROM numbers(10000) ) t1
JOIN ( SELECT number + 100 AS a FROM numbers(10000) ) t2
ON t1.a = t2.a AND t1.b > 0;