mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
Allocates arena for SimpleAggregateFunction only if IAggregateFunction requires
This commit is contained in:
parent
2f471d6ea3
commit
db274bf516
@ -47,6 +47,9 @@ AggregatingSortedBlockInputStream::AggregatingSortedBlockInputStream(
|
|||||||
{
|
{
|
||||||
// simple aggregate function
|
// simple aggregate function
|
||||||
SimpleAggregateDescription desc{simple_aggr->getFunction(), i};
|
SimpleAggregateDescription desc{simple_aggr->getFunction(), i};
|
||||||
|
if (desc.function->allocatesMemoryInArena())
|
||||||
|
allocatesMemoryInArena = true;
|
||||||
|
|
||||||
columns_to_simple_aggregate.emplace_back(std::move(desc));
|
columns_to_simple_aggregate.emplace_back(std::move(desc));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -135,7 +138,8 @@ void AggregatingSortedBlockInputStream::merge(MutableColumns & merged_columns, s
|
|||||||
for (auto & desc : columns_to_simple_aggregate)
|
for (auto & desc : columns_to_simple_aggregate)
|
||||||
desc.createState();
|
desc.createState();
|
||||||
|
|
||||||
arena = std::make_unique<Arena>();
|
if (allocatesMemoryInArena)
|
||||||
|
arena = std::make_unique<Arena>();
|
||||||
|
|
||||||
++merged_rows;
|
++merged_rows;
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,10 @@ private:
|
|||||||
*/
|
*/
|
||||||
void insertSimpleAggregationResult(MutableColumns & merged_columns);
|
void insertSimpleAggregationResult(MutableColumns & merged_columns);
|
||||||
|
|
||||||
/// Memory pool for SimpleAggregateFunction.
|
/// Does SimpleAggregateFunction allocates memory in arena?
|
||||||
|
bool allocatesMemoryInArena = false;
|
||||||
|
/// Memory pool for SimpleAggregateFunction
|
||||||
|
/// (only when allocatesMemoryInArena == true).
|
||||||
std::unique_ptr<Arena> arena;
|
std::unique_ptr<Arena> arena;
|
||||||
|
|
||||||
/// Stores information for aggregation of SimpleAggregateFunction columns
|
/// Stores information for aggregation of SimpleAggregateFunction columns
|
||||||
|
Loading…
Reference in New Issue
Block a user