Skip to content

Commit df3de28

Browse files
authored
Merge pull request ClickHouse#91457 from ClickHouse/backport/25.8/91396
Backport ClickHouse#91396 to 25.8: Remove Sparse columns from header in merge algorithms
2 parents 41482d7 + dcdc888 commit df3de28

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

src/Processors/Merges/Algorithms/MergedData.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include <Columns/IColumn.h>
22
#include <Core/Block.h>
33
#include <Processors/Merges/Algorithms/MergedData.h>
4+
#include <Columns/ColumnSparse.h>
45

56
namespace DB
67
{
@@ -27,6 +28,8 @@ void MergedData::initialize(const Block & header, const IMergingAlgorithm::Input
2728

2829
for (size_t i = 0; i != columns.size(); ++i)
2930
{
31+
/// Sometimes header can contain Sparse columns, we don't support Sparse in merge algorithms.
32+
columns[i] = recursiveRemoveSparse(std::move(columns[i]))->assumeMutable();
3033
if (columns[i]->hasDynamicStructure())
3134
columns[i]->takeDynamicStructureFromSourceColumns(source_columns[i]);
3235
}

tests/queries/0_stateless/03751_summing_coalescing_merge_tree_sparse_columns_in_header.reference

Whitespace-only changes.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
drop table if exists src;
2+
create table src (x UInt64) engine=MergeTree order by tuple();
3+
insert into src select 0 from numbers(1000000);
4+
drop table if exists dst;
5+
create table dst (x UInt64) engine=CoalescingMergeTree order by tuple();
6+
insert into dst select * from src;
7+
drop table dst;
8+
create table dst (x UInt64) engine=SummingMergeTree order by tuple();
9+
insert into dst select * from src;
10+
drop table dst;
11+
drop table src;
12+

0 commit comments

Comments
 (0)