1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

Merge pull request #1987 from mariadb-corporation/bar-develop-MCOL-4700

MCOL-4700 Wrong result of a UNION for INT and INT UNSIGNED
This commit is contained in:
Gagan Goel
2021-06-14 02:36:10 -04:00
committed by GitHub
3 changed files with 214 additions and 3 deletions

View File

@ -3054,10 +3054,15 @@ DataConvert::joinColTypeForUnion(datatypes::SystemCatalog::TypeHolderStd &unione
unionedType.colWidth = type.colWidth;
}
// If same size and result is signed but source is unsigned...
if (type.colWidth == unionedType.colWidth && !isUnsigned(unionedType.colDataType) && isUnsigned(type.colDataType))
// If same size but different signedness
if (type.colWidth == unionedType.colWidth &&
((!isUnsigned(unionedType.colDataType) && isUnsigned(type.colDataType)) ||
(!isUnsigned(type.colDataType) && isUnsigned(unionedType.colDataType))))
{
unionedType.colDataType = type.colDataType;
unionedType.colDataType = datatypes::SystemCatalog::DECIMAL;
unionedType.colWidth = datatypes::Decimal::isWideDecimalTypeByPrecision(unionedType.precision) ?
datatypes::MAXDECIMALWIDTH :
datatypes::MAXLEGACYWIDTH;
}
if (type.colDataType == datatypes::SystemCatalog::DECIMAL || type.colDataType == datatypes::SystemCatalog::UDECIMAL)