LowCardinality UUID fix

This commit is contained in:
Maksim Kita 2021-01-28 14:11:34 +03:00
parent a1d9eee0b5
commit 105ecef628
4 changed files with 20 additions and 5 deletions

View File

@ -885,15 +885,17 @@ MutableColumnUniquePtr DataTypeLowCardinality::createColumnUniqueImpl(const IDat
if (const auto * nullable_type = typeid_cast<const DataTypeNullable *>(&keys_type))
type = nullable_type->getNestedType().get();
if (isString(type))
WhichDataType which(type);
if (which.isString())
return creator(static_cast<ColumnString *>(nullptr));
if (isFixedString(type))
else if (which.isFixedString())
return creator(static_cast<ColumnFixedString *>(nullptr));
if (typeid_cast<const DataTypeDate *>(type))
else if (which.isDate())
return creator(static_cast<ColumnVector<UInt16> *>(nullptr));
if (typeid_cast<const DataTypeDateTime *>(type))
else if (which.isDateTime())
return creator(static_cast<ColumnVector<UInt32> *>(nullptr));
if (isColumnedAsNumber(type))
else if (which.isInt() || which.isUInt() || which.isFloat())
{
MutableColumnUniquePtr column;
TypeListNativeNumbers::forEach(CreateColumnVector(column, *type, creator));

View File

@ -31,6 +31,7 @@ public:
bool canBeUsedInBitOperations() const override { return true; }
bool canBeInsideNullable() const override { return true; }
bool canBeInsideLowCardinality() const override { return false; }
bool canBePromoted() const override { return false; }
};

View File

@ -18,3 +18,6 @@ c
d
cb
db
-
61f0c404-5cb3-11e7-907b-a6006ad3dba0 61f0c404-5cb3-11e7-907b-a6006ad3dba0 61f0c404-5cb3-11e7-907b-a6006ad3dba0
\N \N \N

View File

@ -71,3 +71,12 @@ select (toLowCardinality('a') as val) || 'b' group by val;
select toLowCardinality(z) as val from (select arrayJoin(['c', 'd']) as z) group by val;
select (toLowCardinality(z) as val) || 'b' from (select arrayJoin(['c', 'd']) as z) group by val;
select '-';
drop table if exists lc_str_uuid;
create table lc_str_uuid(str1 String, str2 LowCardinality(String), str3 StringWithDictionary) ENGINE=Memory;
select toUUID(str1), toUUID(str2), toUUID(str3) from lc_str_uuid;
select toUUID(str1, '', NULL), toUUID(str2, '', NULL), toUUID(str3, '', NULL) from lc_str_uuid;
insert into lc_str_uuid values ('61f0c404-5cb3-11e7-907b-a6006ad3dba0', '61f0c404-5cb3-11e7-907b-a6006ad3dba0', '61f0c404-5cb3-11e7-907b-a6006ad3dba0');
select toUUID(str1), toUUID(str2), toUUID(str3) from lc_str_uuid;
select toUUID(str1, '', NULL), toUUID(str2, '', NULL), toUUID(str3, '', NULL) from lc_str_uuid;
drop table if exists lc_str_uuid;