```sql
CREATE TABLE test(key Int32) ENGINE = MergeTree ORDER BY (key);
insert into test select intDiv(number,100) from numbers(10000000);
SELECT COUNT() FROM test WHERE key <= 100000 AND (NOT (toLowCardinality('') IN (SELECT '')));


<Fatal> BaseDaemon: ########################################
<Fatal> BaseDaemon: ########################################
<Fatal> BaseDaemon: ########################################
<Fatal> BaseDaemon: (version 22.8.11.15 (official build), build id: 8996F0B199922EB3) (from thread 3020
ey <= 100000 AND (NOT (toLowCardinality('') IN (SELECT '' ))) ;) Received signal Segmentation fault (11
<Fatal> BaseDaemon: (version 22.8.11.15 (official build), build id: 8996F0B199922EB3) (from thread 2281
y <= 100000 AND (NOT (toLowCardinality('') IN (SELECT '' ))) ;) Received signal Segmentation fault (11)
<Fatal> BaseDaemon: (version 22.8.11.15 (official build), build id: 8996F0B199922EB3) (from thread 2524
ey <= 100000 AND (NOT (toLowCardinality('') IN (SELECT '' ))) ;) Received signal Segmentation fault (11
<Fatal> BaseDaemon: Address: 0x7f32028fc000 Access: read. Attempted access has violated the permissions
<Fatal> BaseDaemon: Address: 0x7f324e218000 Access: read. Attempted access has violated the permissions
<Fatal> BaseDaemon: Address: 0x7f323d92a000 Access: read. Attempted access has violated the permissions
<Fatal> BaseDaemon: Stack trace: 0x14663831 0x1465cb43 0xcbaa3ce 0x13ceb847 0x13cec13d 0x13ced5e9 0x149
 0xa4be8bd 0x7f32a7232fa3 0x7f32a71634cf
<Fatal> BaseDaemon: Stack trace: 0x14663831 0x1465cb43 0xcbaa3ce 0x13ceb847 0x13cec13d 0x13ced5e9 0x149
 0xa4be8bd 0x7f32a7232fa3 0x7f32a71634cf
<Fatal> BaseDaemon: Stack trace: 0x14663831 0x1465cb43 0xcbaa3ce 0x13ceb847 0x13cec13d 0x13ced5e9 0x149
 0xa4be8bd 0x7f32a7232fa3 0x7f32a71634cf

```
found in 21.8 but I guess all versions are affected.

100% reproducible with 

```
clickhouse-benchmark <<< "SELECT COUNT() FROM test WHERE key <= 100000 AND (NOT (toLowCardinality('') IN (SELECT '')))"
```

22.12.1.985 returns random results, so I guess it's affected as well.
const DataTypes & tuple_types = type_tuple->getElements();
            size_t tuple_size = tuple_columns.size();
            for (size_t i = 0; i < tuple_size; ++i)
                columns_of_key_columns.emplace_back(tuple_columns[i], tuple_types[i], "_" + toString(i));
        }
        else
            columns_of_key_columns.emplace_back(left_arg);
        
        ColumnPtr lc_indexes = nullptr;
        if (columns_of_key_columns.size() == 1)
        {
            auto & arg = columns_of_key_columns.at(0);
            const auto * col = arg.column.get();
            if (const auto * const_col = typeid_cast<const ColumnConst *>(col))
                col = &const_col->getDataColumn();
            if (const auto * lc = typeid_cast<const ColumnLowCardinality *>(col))
            {
                lc_indexes = lc->getIndexesPtr();
                arg.column = lc->getDictionary().getNestedColumn();
                arg.type = removeLowCardinality(arg.type);
            }
        }
        auto res = set->execute(columns_of_key_columns, negative);
        if (lc_indexes)
            return res->index(*lc_indexes, 0);
        return res;
    }
};
template<bool ignore_set>
void registerFunctionsInImpl(FunctionFactory & factory)