mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
fix segfault with -StateResample combinators
This commit is contained in:
parent
a5cbeda1e3
commit
e2e92afd98
@ -1181,15 +1181,17 @@ Block Aggregator::prepareBlockAndFill(
|
||||
if (aggregate_functions[i]->isState())
|
||||
{
|
||||
/// The ColumnAggregateFunction column captures the shared ownership of the arena with aggregate function states.
|
||||
ColumnAggregateFunction * column_aggregate_func = nullptr;
|
||||
/// Aggregate state can be wrapped into array if aggregate function ends with -Resample combinator.
|
||||
if (auto * column_array = typeid_cast<ColumnArray *>(final_aggregate_columns[i].get()))
|
||||
column_aggregate_func = &assert_cast<ColumnAggregateFunction &>(column_array->getData());
|
||||
else
|
||||
column_aggregate_func = &assert_cast<ColumnAggregateFunction &>(*final_aggregate_columns[i]);
|
||||
|
||||
if (auto * column_aggregate_func = typeid_cast<ColumnAggregateFunction *>(final_aggregate_columns[i].get()))
|
||||
for (auto & pool : data_variants.aggregates_pools)
|
||||
column_aggregate_func->addArena(pool);
|
||||
|
||||
/// Aggregate state can be wrapped into array if aggregate function ends with -Resample combinator.
|
||||
final_aggregate_columns[i]->forEachSubcolumn([&data_variants](auto & subcolumn)
|
||||
{
|
||||
if (auto * column_aggregate_func = typeid_cast<ColumnAggregateFunction *>(subcolumn.get()))
|
||||
for (auto & pool : data_variants.aggregates_pools)
|
||||
column_aggregate_func->addArena(pool);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user