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
if (has_two_level)
        pushed_to_output = tryPushTwoLevelData();
    auto need_input = [this](size_t input_num)
    {
        if (last_bucket_number[input_num] < current_bucket)
            return true;
        return expect_several_chunks_for_single_bucket_per_source && last_bucket_number[input_num] == current_bucket;
    };
    
    for (; ; ++current_bucket)
    {
        bool finished = true;
        bool need_data = false;
        auto in = inputs.begin();
        for (size_t input_num = 0; input_num < num_inputs; ++input_num, ++in)
        {
            if (in->isFinished())
                continue;
            finished = false;
            if (!need_input(input_num))
                continue;
            in->setNeeded();
            if (!in->hasData())
            {
                need_data = true;
                continue;
            }
            auto chunk = in->pull();
            addChunk(std::move(chunk), input_num);
            if (has_two_level && !single_level_chunks.empty())