Merge pull request #7366 from achimbab/fixbug_inop

Made IN operator support Array(LowCardinality(Nullable(String)))
This commit is contained in:
alexey-milovidov 2019-10-31 00:26:22 +03:00 committed by GitHub
commit 0d2a2c332f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 1 deletions

View File

@ -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);

View File

@ -10,3 +10,4 @@ a 1
b 1
1 1
2 1
['1']

View File

@ -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;