refactor isCompatibleEnumTypes to remove PVS warning

This commit is contained in:
Dmitry Novik 2021-08-24 21:11:47 +03:00
parent 1984940eb6
commit 2da3893b1f

View File

@ -503,14 +503,14 @@ namespace
*/ */
bool isCompatibleEnumTypes(const IDataType * lhs, const IDataType * rhs) bool isCompatibleEnumTypes(const IDataType * lhs, const IDataType * rhs)
{ {
WhichDataType which{lhs}; if (IDataTypeEnum const * enum_type = dynamic_cast<IDataTypeEnum const *>(lhs))
if (!which.isEnum()) {
return false;
IDataTypeEnum const * enum_type = dynamic_cast<IDataTypeEnum const *>(lhs);
if (!enum_type->contains(*rhs)) if (!enum_type->contains(*rhs))
return false; return false;
return enum_type->getMaximumSizeOfValueInMemory() == rhs->getMaximumSizeOfValueInMemory(); return enum_type->getMaximumSizeOfValueInMemory() == rhs->getMaximumSizeOfValueInMemory();
} }
return false;
}
} }
void StorageInMemoryMetadata::check(const Names & column_names, const NamesAndTypesList & virtuals, const StorageID & storage_id) const void StorageInMemoryMetadata::check(const Names & column_names, const NamesAndTypesList & virtuals, const StorageID & storage_id) const