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
{
    size_t rows = chunk.getNumRows();
    Columns source_columns = chunk.detachColumns();
    for (auto & source_column : source_columns)
        source_column = source_column->cut(key_end, rows - key_end);
    current_chunk = Chunk(source_columns, rows - key_end);
    src_rows -= current_chunk.getNumRows();
    block_end_reached = true;
    need_generate = true;
    variants.without_key = nullptr;
}
void AggregatingInOrderTransform::work()
{
    if (is_consume_finished || need_generate)
    {
        generate();
    }
    else
    {
        consume(std::move(current_chunk));
    }
}
IProcessor::Status AggregatingInOrderTransform::prepare()