diff --git a/dbms/src/Interpreters/Set.cpp b/dbms/src/Interpreters/Set.cpp index 68c219c3a91..330f0dc0287 100644 --- a/dbms/src/Interpreters/Set.cpp +++ b/dbms/src/Interpreters/Set.cpp @@ -424,7 +424,8 @@ void Set::checkColumnsNumber(size_t num_key_columns) const void Set::checkTypesEqual(size_t set_type_idx, const DataTypePtr & other_type) const { - if (!removeNullable(data_types[set_type_idx])->equals(*removeNullable(other_type))) + + if (!removeNullable(recursiveRemoveLowCardinality(data_types[set_type_idx]))->equals(*removeNullable(recursiveRemoveLowCardinality(other_type)))) throw Exception("Types of column " + toString(set_type_idx + 1) + " in section IN don't match: " + data_types[set_type_idx]->getName() + " on the right, " + other_type->getName() + " on the left.", ErrorCodes::TYPE_MISMATCH); diff --git a/dbms/tests/queries/0_stateless/00688_low_cardinality_in.reference b/dbms/tests/queries/0_stateless/00688_low_cardinality_in.reference index 74266c7f888..8edea4d363a 100644 --- a/dbms/tests/queries/0_stateless/00688_low_cardinality_in.reference +++ b/dbms/tests/queries/0_stateless/00688_low_cardinality_in.reference @@ -10,3 +10,4 @@ a 1 b 1 1 1 2 1 +['1'] diff --git a/dbms/tests/queries/0_stateless/00688_low_cardinality_in.sql b/dbms/tests/queries/0_stateless/00688_low_cardinality_in.sql index 09a96743847..cb57fad51a4 100644 --- a/dbms/tests/queries/0_stateless/00688_low_cardinality_in.sql +++ b/dbms/tests/queries/0_stateless/00688_low_cardinality_in.sql @@ -9,3 +9,9 @@ select val, val in (select arrayJoin([1, 3])) from lc_00688; select str, str in (select str from lc_00688) from lc_00688; select val, val in (select val from lc_00688) from lc_00688; drop table if exists lc_00688; + +drop table if exists ary_lc_null; +CREATE TABLE ary_lc_null (i int, v Array(LowCardinality(Nullable(String)))) ENGINE = MergeTree() ORDER BY i ; +INSERT INTO ary_lc_null VALUES (1, ['1']); +SELECT v FROM ary_lc_null WHERE v IN (SELECT v FROM ary_lc_null); +drop table if exists ary_lc_null;