Fix error + one more optimization

This commit is contained in:
Alexey Milovidov 2020-08-03 04:34:43 +03:00
parent 486a4b3a17
commit eaccddc51b

View File

@ -521,6 +521,17 @@ void NO_INLINE Aggregator::executeImplBatch(
size_t rows,
AggregateFunctionInstruction * aggregate_instructions) const
{
/// Optimization for special case when there are no aggregate functions.
if (params.aggregates_size == 0)
{
/// For all rows.
AggregateDataPtr place = aggregates_pool->alloc(0);
for (size_t i = 0; i < rows; ++i)
state.emplaceKey(method.data, i, *aggregates_pool).setMapped(place);
return;
}
/// Optimization for special case when aggregating by 8bit key.
if constexpr (std::is_same_v<Method, typename decltype(AggregatedDataVariants::key8)::element_type>)
{
for (AggregateFunctionInstruction * inst = aggregate_instructions; inst->that; ++inst)
@ -541,6 +552,8 @@ void NO_INLINE Aggregator::executeImplBatch(
return;
}
/// Generic case.
PODArray<AggregateDataPtr> places(rows);
/// For all rows.