Add test.

This commit is contained in:
Nikolai Kochetov 2021-06-16 15:05:31 +03:00
parent 81022aadd4
commit 192fe1fc5b
3 changed files with 26 additions and 3 deletions

View File

@ -45,8 +45,8 @@ struct SummingSortedAlgorithm::AggregateDescription
AlignedBuffer state;
bool created = false;
/// For LowCardinality, convert is converted to nested type. nested_type is nullptr if no conversion needed.
/// This is used only for simple aggregate functions.
/// Those types are used only for simple aggregate functions.
/// For LowCardinality, convert to nested type. nested_type is nullptr if no conversion needed.
DataTypePtr nested_type; /// Nested type for LowCardinality, if it is.
DataTypePtr real_type; /// Type in header.
@ -275,7 +275,7 @@ static SummingSortedAlgorithm::ColumnsDefinition defineColumns(
desc.real_type = column.type;
desc.nested_type = recursiveRemoveLowCardinality(desc.real_type);
if (desc.real_type->equals(*desc.nested_type))
if (desc.real_type.get() == desc.nested_type.get())
desc.nested_type = nullptr;
}
else if (!is_agg_func)

View File

@ -0,0 +1,21 @@
drop table if exists smta;
CREATE TABLE smta
(
`k` Int64,
`a` AggregateFunction(max, Int64),
`city` SimpleAggregateFunction(max, LowCardinality(String))
)
ENGINE = SummingMergeTree
ORDER BY k;
insert into smta(k, city) values (1, 'x');
select k, city from smta;
insert into smta(k, city) values (1, 'y');
optimize table smta;
select k, city from smta;
drop table if exists smta;