https://clickhouse-test-reports.s3.yandex.net/20599/0a62f95bbe380abe8d8846ef9690b8a18c6a762b/fuzzer_debug/report.html#fail1
for (const auto * node : index)
        data[reverse_index[node]].used_in_result = true;
    for (const auto & node : nodes)
    {
        for (const auto & child : node.children)
            data[reverse_index[child]].parents.emplace_back(&node);
    }
    for (const auto & node : nodes)
    {
        if (node.children.empty())
            ready_nodes.emplace(&node);
    }
    
    
    std::stack<size_t> free_positions;
    while (!ready_nodes.empty() || !ready_array_joins.empty())
    {
        auto & stack = ready_nodes.empty() ? ready_array_joins : ready_nodes;
        const Node * node = stack.front();
        stack.pop();
        auto & cur = data[reverse_index[node]];
        
        size_t free_position = num_columns;
        if (free_positions.empty())
            ++num_columns;
        else
        {
            free_position = free_positions.top();
            free_positions.pop();
        }