You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-29 08:21:15 +03:00
MDEV-25080 Fix some corner cases in DataConvert::joinColTypeForUnion().
This commit is contained in:
@ -2975,7 +2975,7 @@ void DataConvert::joinColTypeForUnion(datatypes::SystemCatalog::TypeHolderStd& u
|
||||
case datatypes::SystemCatalog::UBIGINT:
|
||||
case datatypes::SystemCatalog::UDECIMAL:
|
||||
|
||||
if (type.scale != 0)
|
||||
if (type.scale != 0 && unionedType.scale != 0)
|
||||
{
|
||||
const unsigned int digitsBeforeDecimal = type.precision - type.scale;
|
||||
const unsigned int digitsBeforeDecimalUnion = unionedType.precision - unionedType.scale;
|
||||
@ -2988,7 +2988,18 @@ void DataConvert::joinColTypeForUnion(datatypes::SystemCatalog::TypeHolderStd& u
|
||||
}
|
||||
}
|
||||
|
||||
unionedType.precision = std::max(type.precision, unionedType.precision);
|
||||
// Handle the scenario where the upstream code assigns special values of 9999
|
||||
// and -1 as the precision of the unionedType.
|
||||
if ((unionedType.precision == 9999 || unionedType.precision == -1) &&
|
||||
(type.precision != 9999 && type.precision != -1))
|
||||
{
|
||||
unionedType.precision = type.precision;
|
||||
}
|
||||
else
|
||||
{
|
||||
unionedType.precision = std::max(type.precision, unionedType.precision);
|
||||
}
|
||||
|
||||
unionedType.scale = std::max(type.scale, unionedType.scale);
|
||||
|
||||
if (datatypes::Decimal::isWideDecimalTypeByPrecision(unionedType.precision))
|
||||
@ -3056,6 +3067,10 @@ void DataConvert::joinColTypeForUnion(datatypes::SystemCatalog::TypeHolderStd& u
|
||||
case datatypes::SystemCatalog::UFLOAT:
|
||||
case datatypes::SystemCatalog::UDOUBLE:
|
||||
case datatypes::SystemCatalog::LONGDOUBLE:
|
||||
if (datatypes::isWideDecimalType(type.colDataType, type.colWidth))
|
||||
unionedType = type;
|
||||
break;
|
||||
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user