Fix totals row for projections.

This commit is contained in:
Nikolai Kochetov 2023-02-20 16:40:35 +00:00
parent 84e442e620
commit 413a8d38fa
3 changed files with 9 additions and 1 deletions

View File

@ -2890,6 +2890,13 @@ bool Aggregator::mergeOnBlock(Block block, AggregatedDataVariants & result, bool
LOG_TRACE(log, "Aggregation method: {}", result.getMethodName());
}
if ((params.overflow_row || result.type == AggregatedDataVariants::Type::without_key) && !result.without_key)
{
AggregateDataPtr place = result.aggregates_pool->alignedAlloc(total_size_of_aggregate_states, align_aggregate_states);
createAggregateStates(place);
result.without_key = place;
}
if (result.type == AggregatedDataVariants::Type::without_key || block.info.is_overflows)
mergeBlockWithoutKeyStreamsImpl(std::move(block), result);
#define M(NAME, IS_TWO_LEVEL) \

View File

@ -1,3 +1,3 @@
create table test(day Date, id UInt32) engine=MergeTree partition by day order by tuple();
insert into test select toDate('2023-01-05') AS day, number from numbers(10);
with toUInt64(id) as id_with select day, count(id_with) from test where day >= '2023-01-01' group by day limit 1000; -- { serverError NOT_FOUND_COLUMN_IN_BLOCK }
with toUInt64(id) as id_with select day, count(id_with) from test where day >= '2023-01-01' group by day limit 1000;