It's ok when i run
 
```sql
with
   (select count(*) from system.clusters) as v1,
   (select count(*) from system.disks) as v2
select v1 as v
union  all
select v2 as v
```
result:
```
v |
--+
14|
 1|
```
,
but when i  wrap it in subquery:

```sql
SELECT v
FROM
  (with
     (select count(*)  from system.clusters) as v1,
     (select count(*) from system.disks) as v2
   select v1 as v
   union  all
   select v2 as v) as a 
```

it raise error:

`SQL Error [47]: ClickHouse exception, code: 47, host: 127.0.0.1, port: 46535; Code: 47, e.displayText() = DB::Exception: Missing columns: 'v2' while processing query: 'SELECT v2 AS v', required columns: 'v2' (version 21.7.3.14 (official build))`
,
in fact ,  if i drop `union all`, it's still ok:

```sql
SELECT v
FROM
  (with
     (select count(*) from system.clusters) as v1,
     (select count(*) from system.disks) as v2
  select v1 as v
) as a 
LIMIT 1000;
```
result:
```
v |
--+
14|
```
seems that it cannot recognize `union all` under `with` clause in subquery (version: 21.7.3.14).

Another way to avoid error is `with` first, like this:
```sql
with
     (select count(*)  from system.clusters) as v1,
     (select count(*) from system.disks) as v2
SELECT v
FROM(
   select v1 as v
   union  all
   select v2 as v) as a 
```

ASTPtr with_expression_list = first_select->with();
            if (with_expression_list)
            {
                std::map<String, ASTPtr> exprs;
                for (auto & child : with_expression_list->children)
                {
                    if (auto * ast_with_alias = dynamic_cast<ASTWithAlias *>(child.get()))
                        exprs[ast_with_alias->alias] = child;
                }
                for (auto it = node_union->list_of_selects->children.begin() + 1; it != node_union->list_of_selects->children.end(); ++it)
                {
                    if (auto * union_child = (*it)->as<ASTSelectWithUnionQuery>())
                        visit(*union_child, exprs, with_expression_list);
                    else if (auto * select_child = (*it)->as<ASTSelectQuery>())
                        visit(*select_child, exprs, with_expression_list);
                    else if (auto * intersect_except_child = (*it)->as<ASTSelectIntersectExceptQuery>())
                        visit(*intersect_except_child, exprs, with_expression_list);
                }
            }
        }
    }
    else
    {
        
        for (auto & child : ast->children)
            visit(child);
    }
}
}