1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

MCOL-4700 Wrong result of a UNION for INT and INT UNSIGNED

This commit is contained in:
Alexander Barkov
2021-06-10 23:20:33 +04:00
parent 7c93624bd6
commit 67449418ed
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)