**Describe the bug**
When using ORDER BY with multiple expressions on a MergeTree table, the ordering is not correct.


**How to reproduce**
` yandex/clickhouse-server:20.5.2.7`

Create the table:
```sql
create table order_test
(
    timestamp DateTime64(3),
    color     LowCardinality(Nullable(String))
) engine = MergeTree()
      PARTITION BY toYYYYMM(timestamp)
      ORDER BY timestamp
      SETTINGS index_granularity = 8192;
```

Fill the table (run a few time times to get a range of timestamps):
```sql
insert into order_test
select now64(),
       arrayElement(['red', 'green', 'blue', null], modulo(number, 4) + 1) as color
from (select number from system.numbers limit 1000000);
```

Query:
```sql
SELECT count(),
       color,
       toStartOfSecond(timestamp) AS `second`
FROM order_test AS i
GROUP BY color, `second`
ORDER BY color, `second` desc
LIMIT 500;
```


See out of order results:
```
500000,blue,2020-08-21 18:30:06.000
500000,blue,2020-08-21 18:30:09.000
250000,blue,2020-08-21 18:30:03.000
250000,blue,2020-08-21 18:30:08.000
250000,blue,2020-08-21 18:30:07.000
```

**Expected behavior**
See results in order by descending second:
```
500000,blue,2020-08-21 18:30:09.000
250000,blue,2020-08-21 18:30:08.000
250000,blue,2020-08-21 18:30:07.000
500000,blue,2020-08-21 18:30:06.000
250000,blue,2020-08-21 18:30:03.000
```

Notes:

It appears when I take out `LowCardinality` from the color column, the order works as expected. 



{
        const auto& [first, last] = equal_range.back();
        if (reverse)
            std::partial_sort(res.begin() + first, res.begin() + limit, res.begin() + last, [this, nan_direction_hint](size_t a, size_t b)
                              {return getDictionary().compareAt(getIndexes().getUInt(a), getIndexes().getUInt(b), getDictionary(), nan_direction_hint) > 0; });
        else
            std::partial_sort(res.begin() + first, res.begin() + limit, res.begin() + last, [this, nan_direction_hint](size_t a, size_t b)
                              {return getDictionary().compareAt(getIndexes().getUInt(a), getIndexes().getUInt(b), getDictionary(), nan_direction_hint) < 0; });
        auto new_first = first;
        for (auto j = first + 1; j < limit; ++j)
        {
            if (getDictionary().compareAt(getIndexes().getUInt(new_first), getIndexes().getUInt(j), getDictionary(), nan_direction_hint) != 0)
            {
                if (j - new_first > 1)
                    new_ranges.emplace_back(new_first, j);
                new_first = j;
            }
        }
        auto new_last = limit;
        for (auto j = limit; j < last; ++j)
        {
            if (getDictionary().compareAt(getIndexes().getUInt(new_first), getIndexes().getUInt(j), getDictionary(), nan_direction_hint) == 0)
            {
                std::swap(res[new_last], res[j]);
                ++new_last;
            }
        }
        if (new_last - new_first > 1)
            new_ranges.emplace_back(new_first, new_last);
    }