Skip to content

Commit 2467f9e

Browse files
Merge pull request ClickHouse#91498 from ClickHouse/backport/25.8/90927
Backport ClickHouse#90927 to 25.8: Fix SummingMergeTree aggregation for Nested LowCardinality columns
2 parents ffa905e + b66cc20 commit 2467f9e

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

src/Processors/Merges/Algorithms/SummingSortedAlgorithm.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ static SummingSortedAlgorithm::ColumnsDefinition defineColumns(
415415
{
416416
const ColumnWithTypeAndName & key_col = header.safeGetByPosition(*column_num_it);
417417
const String & name = key_col.name;
418-
const IDataType & nested_type = *assert_cast<const DataTypeArray &>(*key_col.type).getNestedType();
418+
const IDataType & nested_type = *recursiveRemoveLowCardinality(assert_cast<const DataTypeArray &>(*key_col.type).getNestedType());
419419

420420
if (column_num_it == map.second.begin()
421421
|| endsWith(name, "ID")
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
lol 10 ['a','b'] [4,6]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CREATE TABLE sums (key LowCardinality(String), sumOfSums UInt64, sumsMap Nested (key LowCardinality(String), sum UInt64)) ENGINE = SummingMergeTree PRIMARY KEY (key);
2+
3+
INSERT INTO sums (key, sumOfSums, sumsMap.key, sumsMap.sum) VALUES ('lol', 3, ['a', 'b'], [1, 2]);
4+
INSERT INTO sums (key, sumOfSums, sumsMap.key, sumsMap.sum) VALUES ('lol', 7, ['a', 'b'], [3, 4]);
5+
6+
OPTIMIZE TABLE sums;
7+
8+
SELECT * FROM sums;

0 commit comments

Comments
 (0)