
```
select *
from (
select 'table' as table, toInt64(10) as rows, toInt64(101) as elements
union all
select 'another table' as table, toInt64(0) as rows, toInt64(0) as elements
)
where rows - elements <> 0

DB::Exception: Block structure mismatch in Pipe::unitePipes stream: different number of columns:
table String String(size = 0), rows Int64 Int64(size = 0), elements Int64 Int64(size = 0)
table String String(size = 0), rows Int64 Int64(size = 0), elements Int64 Int64(size = 0), dummy UInt8 UInt8(size = 0) (version 21.5.3.1 (official build))
```
{
    
    
    
    
    
    
    std::unordered_map<const Node *, size_t> removed_first_result;
    
    std::unordered_map<const Node *, const Node *> inputs_map;
    
    {
        
        std::unordered_map<std::string_view, std::list<const Node *>> first_result;
        for (const auto & node : first.index)
            first_result[node->result_name].push_back(node);
        for (const auto & node : second.inputs)
        {
            auto it = first_result.find(node->result_name);
            if (it == first_result.end() || it->second.empty())
            {
                if (first.project_input)