Merge pull request #27787 from kafka1991/master

modify column datatype to Nullable(datatype) or Nullable(datatype) to Nullable(datatype) donot allways need mutations.
This commit is contained in:
alesapin 2021-08-23 10:35:39 +03:00 committed by GitHub
commit 31b12b5240
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -679,6 +679,9 @@ bool isMetadataOnlyConversion(const IDataType * from, const IDataType * to)
while (true)
{
if (from->equals(*to))
return true;
auto it_range = ALLOWED_CONVERSIONS.equal_range(typeid(*from));
for (auto it = it_range.first; it != it_range.second; ++it)
{
@ -697,9 +700,9 @@ bool isMetadataOnlyConversion(const IDataType * from, const IDataType * to)
const auto * nullable_from = typeid_cast<const DataTypeNullable *>(from);
const auto * nullable_to = typeid_cast<const DataTypeNullable *>(to);
if (nullable_from && nullable_to)
if (nullable_to)
{
from = nullable_from->getNestedType().get();
from = nullable_from ? nullable_from->getNestedType().get() : from;
to = nullable_to->getNestedType().get();
continue;
}