mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-03 13:02:00 +00:00
Remove clashed columns from totals for StorageJoin
This commit is contained in:
parent
0b990c9519
commit
9460989721
@ -284,6 +284,11 @@ void joinTotals(const Block & totals, const Block & columns_to_add, const TableJ
|
||||
for (size_t i = 0; i < columns_to_add.columns(); ++i)
|
||||
{
|
||||
const auto & col = columns_to_add.getByPosition(i);
|
||||
if (block.has(col.name))
|
||||
{
|
||||
/// For StorageJoin we discarded table qualifiers, so some names may clash
|
||||
continue;
|
||||
}
|
||||
block.insert({
|
||||
col.type->createColumnConstWithDefaultValue(1)->convertToFullColumnIfConst(),
|
||||
col.type,
|
||||
|
@ -38,3 +38,7 @@ ghi []
|
||||
1 [] 2 3 7 4
|
||||
1 [] 2 3 8 4
|
||||
1 [] 2 3 9 4
|
||||
0 a []
|
||||
1 a [0]
|
||||
|
||||
0 a []
|
||||
|
@ -11,4 +11,8 @@ SELECT s, x FROM (SELECT number AS k FROM system.numbers LIMIT 10) js1 ANY LEFT
|
||||
SELECT x, s, k FROM (SELECT number AS k FROM system.numbers LIMIT 10) js1 ANY LEFT JOIN join USING k;
|
||||
SELECT 1, x, 2, s, 3, k, 4 FROM (SELECT number AS k FROM system.numbers LIMIT 10) js1 ANY LEFT JOIN join USING k;
|
||||
|
||||
SELECT t1.k, t1.s, t2.x
|
||||
FROM ( SELECT number AS k, 'a' AS s FROM numbers(2) GROUP BY number WITH TOTALS ) AS t1
|
||||
ANY LEFT JOIN join AS t2 USING(k);
|
||||
|
||||
DROP TABLE join;
|
||||
|
Loading…
Reference in New Issue
Block a user