**How to reproduce**

Query:
```sql
select
	x,
	min(x) as lower,
	max(x)+1 as upper,
	upper-lower as range
from (select arrayJoin([1, 2]) as x)
group by x
with rollup;
```

## 20.4.6
```
┌─x─┬─lower─┬─upper─┬─range─┐
│ 1 │     1 │     2 │     1 │
│ 2 │     2 │     3 │     1 │
└───┴───────┴───────┴───────┘
┌─x─┬─lower─┬─upper─┬─range─┐
│ 0 │     1 │     3 │     2 │
└───┴───────┴───────┴───────┘
```
Summary looks correct.

## 20.9.3
```
┌─x─┬─lower─┬─upper─┬─range─┐
│ 1 │     1 │     2 │     1 │
│ 2 │     2 │     3 │     1 │
└───┴───────┴───────┴───────┘
┌─x─┬─lower─┬─upper─┬─range─┐
│ 0 │     0 │     3 │     2 │
└───┴───────┴───────┴───────┘
```
`lower` is wrong - the minimum should be 1. However, all other "derived" values are correct. For example `range` correctly shows up as 2, even though table would wrongly imply that `upper-lower==3-0==3`.
Note that I only tested 20.4.6 and 20.9.3, so the regression might have been anywhere in between.

## 20.10.2
```
┌─x─┬─lower─┬─upper─┬─range─┐
│ 1 │     1 │     2 │     1 │
│ 2 │     2 │     3 │     1 │
└───┴───────┴───────┴───────┘
┌─x─┬─lower─┬─upper─┬─range─┐
│ 0 │     0 │     1 │     1 │
└───┴───────┴───────┴───────┘
```
All values are wrong.
{
    if (!select_query->groupBy())
        return;
    auto grp_by = select_query->groupBy();
    auto & group_keys = grp_by->children;
    GroupByKeysInfo group_by_keys_data = getGroupByKeysInfo(group_keys);
    SelectAggregateFunctionOfGroupByKeysVisitor::Data visitor_data{group_by_keys_data.key_names};
    SelectAggregateFunctionOfGroupByKeysVisitor(visitor_data).visit(node);
}
void optimizeDuplicatesInOrderBy(const ASTSelectQuery * select_query)
{
    if (!select_query->orderBy())
        return;
    
    using NameAndLocale = std::pair<String, String>;
    std::set<NameAndLocale> elems_set;
    ASTs & elems = select_query->orderBy()->children;
    ASTs unique_elems;
    unique_elems.reserve(elems.size());
    for (const auto & elem : elems)
    {
        String name = elem->children.front()->getColumnName();
        const auto & order_by_elem = elem->as<ASTOrderByElement &>();
        if (elems_set.emplace(name, order_by_elem.collation ? order_by_elem.collation->getColumnName() : "").second)
            unique_elems.emplace_back(elem);
    }
    if (unique_elems.size() < elems.size())
        elems = std::move(unique_elems);
}
void optimizeDuplicateOrderBy(ASTPtr & query, const Context & context)