Found in stress test: https://gist.github.com/alesapin/5cd6b8901488a1f170d5ef389900a534
Report: https://s3.amazonaws.com/clickhouse-test-reports/31158/7fb9a42b119b6c3eba1784caaabde51c1ded3384/stress_tests__debug__actions_.html
#include <Processors/Transforms/MergingAggregatedTransform.h>
#include <Processors/Transforms/AggregatingTransform.h>
namespace DB
{
namespace ErrorCodes
{
    extern const int LOGICAL_ERROR;
}
MergingAggregatedTransform::MergingAggregatedTransform(
    Block header_, AggregatingTransformParamsPtr params_, size_t max_threads_)
    : IAccumulatingTransform(std::move(header_), params_->getHeader())
    , params(std::move(params_)), max_threads(max_threads_)
{
}
void MergingAggregatedTransform::consume(Chunk chunk)