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 #1899 from tntnatbry/MCOL-4612

MCOL-4612 A subquery with a union for DECIMAL and BIGINT returns zeros.
This commit is contained in:
Gagan Goel
2021-05-03 02:52:23 -04:00
committed by GitHub
4 changed files with 187 additions and 36 deletions

View File

@ -3037,6 +3037,17 @@ DataConvert::joinColTypeForUnion(datatypes::SystemCatalog::TypeHolderStd &unione
case datatypes::SystemCatalog::UINT:
case datatypes::SystemCatalog::UBIGINT:
case datatypes::SystemCatalog::UDECIMAL:
unionedType.precision = std::max(type.precision, unionedType.precision);
unionedType.scale = std::max(type.scale, unionedType.scale);
if (datatypes::Decimal::isWideDecimalTypeByPrecision(unionedType.precision))
{
unionedType.colDataType = datatypes::SystemCatalog::DECIMAL;
unionedType.colWidth = datatypes::MAXDECIMALWIDTH;
break;
}
if (type.colWidth > unionedType.colWidth)
{
unionedType.colDataType = type.colDataType;
@ -3054,10 +3065,6 @@ DataConvert::joinColTypeForUnion(datatypes::SystemCatalog::TypeHolderStd &unione
unionedType.colDataType = datatypes::SystemCatalog::DECIMAL;
}
if (type.precision > unionedType.precision)
unionedType.precision = type.precision;
unionedType.scale = (type.scale > unionedType.scale) ? type.scale : unionedType.scale;
break;
case datatypes::SystemCatalog::DATE: