Fix only_merge header

This commit is contained in:
Amos Bird 2022-07-01 16:46:58 +08:00
parent d73f975849
commit 53f47127e9
No known key found for this signature in database
GPG Key ID: 80D430DCBECFEDB4
3 changed files with 15 additions and 1 deletions

View File

@ -374,7 +374,15 @@ Block Aggregator::Params::getHeader(
if (only_merge)
{
res = header.cloneEmpty();
NameSet needed_columns(keys.begin(), keys.end());
for (const auto & aggregate : aggregates)
needed_columns.emplace(aggregate.column_name);
for (const auto & column : header)
{
if (needed_columns.contains(column.name))
res.insert(column.cloneEmpty());
}
if (final)
{

View File

@ -2,6 +2,7 @@
0 9998 5000
1 9999 5000
0 9998 5000
0 9998 5000
1
0 9998 5000
0
@ -15,6 +16,7 @@
1
1
1
2021-10-25 10:00:00 3 2021-10-27 10:00:00 3
\N 2021-10-27 10:00:00 3
0
2021-10-24 10:00:00

View File

@ -10,6 +10,7 @@ set max_rows_to_read = 2, allow_experimental_projection_optimization = 1;
select min(i), max(i), count() from d;
select min(i), max(i), count() from d group by _partition_id order by _partition_id;
select min(i), max(i), count() from d where _partition_value.1 = 0 group by _partition_id order by _partition_id;
select min(i), max(i), count() from d where moduloLegacy(i, 2) = 0 group by _partition_id order by _partition_id;
select min(i), max(i), count() from d where _partition_value.1 = 10 group by _partition_id order by _partition_id;
-- fuzz crash
@ -57,6 +58,9 @@ select min(dt), max(dt), count() from d where toDate(dt) >= '2021-10-25';
select min(dt), max(dt), count(toDate(dt) >= '2021-10-25') from d where toDate(dt) >= '2021-10-25';
select count() from d group by toDate(dt);
-- fuzz crash
SELECT min(dt), count(ignore(ignore(ignore(tupleElement(_partition_value, NULL) = NULL), NULL, NULL, NULL), 0, '10485.76', NULL)), max(dt), count(toDate(dt) >= '2021-10-25') FROM d WHERE toDate(dt) >= '2021-10-25';
-- fuzz crash
SELECT pointInEllipses(min(j), NULL), max(dt), count('0.0000000007') FROM d WHERE toDate(dt) >= '2021-10-25';
SELECT min(j) FROM d PREWHERE ceil(j) <= 0;