**How to reproduce**
* Which ClickHouse server version to use
latest master/arcadia
* Non-default settings, if any
```sql
SET prefer_localhost_replica=0
```
(With a local stream the query works fine)
* `CREATE TABLE` statements for all tables involved
```sql
create table "t0" (a Int64, b Int64) engine = MergeTree() partition by a order by a;
create table "dist_t0" (a Int64, b Int64) engine = Distributed(test_shard_localhost, default, t0);
```
* Sample data for all these tables
```sql
insert into t0 values (0, 0);
```
* Queries to run that lead to unexpected result
```sql
di.man.yp-c.yandex.net :) SELECT a / (SELECT sum(number) FROM numbers(10)) FROM dist_t0

SELECT a / 
    (
        SELECT sum(number)
        FROM numbers(10)
    )
FROM dist_t0

Query id: 27b16db2-ad76-403c-8ac1-c03bfb9b0daf


0 rows in set. Elapsed: 0.020 sec. 

Received exception from server (version 21.5.1):
Code: 10. DB::Exception: Received from localhost:9000. DB::Exception: Not found column divide(a, _subquery4) in block. There are only columns: divide(a, CAST(45, 'UInt64')): While executing Remote.
```

{
    auto & aliases = data;
    ASTSubquery & subquery = const_cast<ASTSubquery &>(const_subquery);
    static std::atomic_uint64_t subquery_index = 0;
    if (subquery.alias.empty())
    {
        String alias;
        do
        {
            alias = "_subquery" + std::to_string(++subquery_index);
        }
        while (aliases.count(alias));
        subquery.setAlias(alias);
        aliases[alias] = ast;
    }
    else
        visitOther(ast, aliases);
    subquery.prefer_alias_to_column_name = true;
}
template <typename T>
void QueryAliasesMatcher<T>::visitOther(const ASTPtr & ast, Data & data)