**Describe the bug**
We encounter the following problem when performing some SELECT queries to a Distributed table with LowCardinality columns:

```DB::Exception: Expected ColumnLowCardinality, gotUInt8: While executing MergingSortedTransform```

**Does it reproduce on recent release?**
Reproduces on the second recent release.

**How to reproduce**
* Which ClickHouse server version to use
 21.3.4.25
* Non-default settings, if any
```
use_uncompressed_cache,0
replication_alter_partitions_sync,2
load_balancing,random
log_queries,1
max_result_bytes,32212254720
max_execution_time,600
readonly,2
max_memory_usage,0
max_memory_usage_for_user,32212254720
```
* `CREATE TABLE` statements for all tables involved
```
create table tablename
(
    column1 DateTime64(9),
    column2 LowCardinality(String),
    column3 LowCardinality(String),
    column4 LowCardinality(String),
    column5 Array(UInt64),
    column6 Array(Decimal(18, 9)),
    column7 Array(Decimal(18, 6)),
    column8 Array(UInt64),
    column9 Array(Decimal(18, 9)),
    column10 Array(Decimal(18, 6)),
    column11 UInt8,
    column12 Nullable(DateTime64(9)),
    column13 Array(LowCardinality(String)) default [],
    column14 Array(LowCardinality(String)) default []
)
    engine = Distributed('some_cluster', 'default', 'tablename_partial', halfMD5(toStartOfHour(column1), column2));

create table tablename_partial
(
    column1 DateTime64(9),
    column2 LowCardinality(String),
    column3 LowCardinality(String),
    column4 LowCardinality(String),
    column5 Array(UInt64),
    column6 Array(Decimal(18, 9)),
    column7 Array(Decimal(18, 6)),
    column8 Array(UInt64),
    column9 Array(Decimal(18, 9)),
    column10 Array(Decimal(18, 6)),
    column11 UInt8,
    column12 Nullable(DateTime64(9)),
    column13 Array(LowCardinality(String)) default [],
    column14 Array(LowCardinality(String)) default []
)
    engine = ReplicatedMergeTree('/clickhouse/tables/{shard}/tablename_partial', '{replica}')
PARTITION BY (column4, toDate(column1))
ORDER BY (column2, column1, column3)
SETTINGS index_granularity = 8192;
```

* Queries to run that lead to unexpected result
```sql
SELECT
    *
FROM tablename
WHERE column1 >= toDateTime64('2020-05-01 00:00:00.000000000', 9)
  AND column1 < toDateTime64('2020-06-01 00:00:00.000000000', 9)
  AND column3 = 'value1'
  AND column2 = 'value2'
ORDER BY column2, column1, column3
  LIMIT 10000
SETTINGS optimize_read_in_order=1;
```

**Expected behavior**
Expected the query to work, not to throw an exception.

**Error message and/or stacktrace**
```
DB::Exception: Expected ColumnLowCardinality, gotUInt8: While executing MergingSortedTransform, Stack trace (when copying this message, always include the lines below):

0. DB::ColumnLowCardinality::insertFrom(DB::IColumn const&, unsigned long) @ 0xf1e7da7 in /usr/bin/clickhouse
1. DB::IMergingAlgorithm::Status DB::MergingSortedAlgorithm::mergeImpl<DB::SortingHeap<DB::SortCursor> >(DB::SortingHeap<DB::SortCursor>&) @ 0xfac3beb in /usr/bin/clickhouse
2. DB::IMergingTransform<DB::MergingSortedAlgorithm>::work() @ 0xf63e0bd in /usr/bin/clickhouse
3. ? @ 0xf9391ed in /usr/bin/clickhouse
4. DB::PipelineExecutor::executeStepImpl(unsigned long, unsigned long, std::__1::atomic<bool>*) @ 0xf935e11 in /usr/bin/clickhouse
5. ? @ 0xf93a9e6 in /usr/bin/clickhouse
6. ThreadPoolImpl<std::__1::thread>::worker(std::__1::__list_iterator<std::__1::thread, void*>) @ 0x865165f in /usr/bin/clickhouse
7. ? @ 0x86550f3 in /usr/bin/clickhouse
8. start_thread @ 0x7ea5 in /usr/lib64/libpthread-2.17.so
9. __clone @ 0xfe96d in /usr/lib64/libc-2.17.so
 (version 21.3.4.25 (official build))
```

**Additional context**
##### Workaround
Explicitly `cast` the LowCardinality columns to their base type.

Also, the problem doesn't reproduce
- when using non-distributed table,
- or when disabling the option `optimize_read_in_order`,
- or randomly when you change query params (column1).
UInt64 val =
                static_cast<UInt64>(_mm_movemask_epi8(_mm_cmpeq_epi8(
                        _mm_loadu_si128(reinterpret_cast<const __m128i *>(pos)),
                        zero16)))
                | (static_cast<UInt64>(_mm_movemask_epi8(_mm_cmpeq_epi8(
                        _mm_loadu_si128(reinterpret_cast<const __m128i *>(pos + 16)),
                        zero16))) << 16u)
                | (static_cast<UInt64>(_mm_movemask_epi8(_mm_cmpeq_epi8(
                        _mm_loadu_si128(reinterpret_cast<const __m128i *>(pos + 32)),
                        zero16))) << 32u)
                | (static_cast<UInt64>(_mm_movemask_epi8(_mm_cmpeq_epi8(
                        _mm_loadu_si128(reinterpret_cast<const __m128i *>(pos + 48)),
                        zero16))) << 48u);
        val = ~val;
        if (val == 0)
            count += 64;
        else
        {
            count += __builtin_clzll(val);
            return count;
        }
    }
#endif
    while (end > begin && *(--end) == 0)
    {
        ++count;
    }
    return count;
}
void MergeTreeRangeReader::ReadResult::setFilter(const ColumnPtr & new_filter)