20.10.1.4853

```sql
drop table if exists xp;
drop table if exists xp_d;

create table xp(A Date, B Int64, S String) Engine=MergeTree partition by toYYYYMM(A) order by B;
insert into xp select '2020-01-01', number , '' from numbers(100000);
insert into xp select '2020-10-01', number , '' from numbers(100000);
create table xp_d as xp Engine=Distributed(test_shard_localhost, currentDatabase(), xp);

select count() from xp_d prewhere toYYYYMM(A) global in (select toYYYYMM(min(A)) from xp_d) where B > -1;
┌─count()─┐
│       0 │     <------ expected 100000
└─────────┘

-- global in & both predicates in prewhere 
select count() from xp_d prewhere toYYYYMM(A) global in (select toYYYYMM(min(A)) from xp_d) and B > -1;
┌─count()─┐
│  100000 │
└─────────┘

-- global in & both predicates in where 
select count() from xp_d where toYYYYMM(A) global in (select toYYYYMM(min(A)) from xp_d) and B > -1;
┌─count()─┐
│  100000 │
└─────────┘

-- not global
select count() from xp_d prewhere toYYYYMM(A) in (select toYYYYMM(min(A)) from xp_d) where B > -1;
┌─count()─┐
│  100000 │
└─────────┘



select count() from xp_d prewhere toYYYYMM(A) global in (select 202001) where B > -1;
┌─count()─┐
│       0 │
└─────────┘
```

hmm, it worked in 19.13.7.57
if (has_aggregation)
    {
        
        if (select_query)
        {
            if (select_query->groupBy())
            {
                NameSet unique_keys;
                ASTs & group_asts = select_query->groupBy()->children;
                for (ssize_t i = 0; i < ssize_t(group_asts.size()); ++i)
                {
                    ssize_t size = group_asts.size();
                    getRootActionsNoMakeSet(group_asts[i], true, temp_actions, false);
                    const auto & column_name = group_asts[i]->getColumnName();
                    const auto & index = temp_actions->getIndex();
                    auto it = index.find(column_name);
                    if (it == index.end())
                        throw Exception("Unknown identifier (in GROUP BY): " + column_name, ErrorCodes::UNKNOWN_IDENTIFIER);
                    const auto & node = it->second;
                    
                    if (node->column && isColumnConst(*node->column))
                    {
                        
                        if (!aggregate_descriptions.empty() || size > 1)
                        {
                            if (i + 1 < static_cast<ssize_t>(size))
                                group_asts[i] = std::move(group_asts.back());
                            group_asts.pop_back();
                            --i;
                            continue;