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

MCOL-4188 Fix regression in a union subquery involving a numeric field.

Since we now perform type promotion to wide decimals for aggregations
involving numeric fields, we need to check for wide decimal in
in and out ROWs and call the appropriate setter and getter functions.
This commit is contained in:
Gagan Goel
2020-11-05 18:09:10 -05:00
committed by Roman Nozdrin
parent 3d7f5c6fd1
commit 6fd7916c56
2 changed files with 83 additions and 17 deletions

View File

@ -3160,6 +3160,9 @@ 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;
@ -3390,7 +3393,6 @@ DataConvert::joinColTypeForUnion(datatypes::SystemCatalog::TypeHolderStd &unione
case datatypes::SystemCatalog::MEDINT:
case datatypes::SystemCatalog::INT:
case datatypes::SystemCatalog::BIGINT:
case datatypes::SystemCatalog::DECIMAL:
case datatypes::SystemCatalog::FLOAT:
case datatypes::SystemCatalog::DOUBLE:
case datatypes::SystemCatalog::UTINYINT:
@ -3398,7 +3400,6 @@ DataConvert::joinColTypeForUnion(datatypes::SystemCatalog::TypeHolderStd &unione
case datatypes::SystemCatalog::UMEDINT:
case datatypes::SystemCatalog::UINT:
case datatypes::SystemCatalog::UBIGINT:
case datatypes::SystemCatalog::UDECIMAL:
case datatypes::SystemCatalog::UFLOAT:
case datatypes::SystemCatalog::UDOUBLE:
unionedType.colDataType = datatypes::SystemCatalog::DOUBLE;
@ -3406,6 +3407,16 @@ DataConvert::joinColTypeForUnion(datatypes::SystemCatalog::TypeHolderStd &unione
unionedType.colWidth = sizeof(double);
break;
case datatypes::SystemCatalog::DECIMAL:
case datatypes::SystemCatalog::UDECIMAL:
if (unionedType.colWidth != datatypes::MAXDECIMALWIDTH)
{
unionedType.colDataType = datatypes::SystemCatalog::DOUBLE;
unionedType.scale = 0;
unionedType.colWidth = sizeof(double);
}
break;
default:
break;
}
@ -3446,7 +3457,6 @@ DataConvert::joinColTypeForUnion(datatypes::SystemCatalog::TypeHolderStd &unione
case datatypes::SystemCatalog::MEDINT:
case datatypes::SystemCatalog::INT:
case datatypes::SystemCatalog::BIGINT:
case datatypes::SystemCatalog::DECIMAL:
case datatypes::SystemCatalog::FLOAT:
case datatypes::SystemCatalog::DOUBLE:
case datatypes::SystemCatalog::UTINYINT:
@ -3454,7 +3464,6 @@ DataConvert::joinColTypeForUnion(datatypes::SystemCatalog::TypeHolderStd &unione
case datatypes::SystemCatalog::UMEDINT:
case datatypes::SystemCatalog::UINT:
case datatypes::SystemCatalog::UBIGINT:
case datatypes::SystemCatalog::UDECIMAL:
case datatypes::SystemCatalog::UFLOAT:
case datatypes::SystemCatalog::UDOUBLE:
case datatypes::SystemCatalog::LONGDOUBLE:
@ -3464,6 +3473,17 @@ DataConvert::joinColTypeForUnion(datatypes::SystemCatalog::TypeHolderStd &unione
unionedType.precision = -1;
break;
case datatypes::SystemCatalog::DECIMAL:
case datatypes::SystemCatalog::UDECIMAL:
if (unionedType.colWidth != datatypes::MAXDECIMALWIDTH)
{
unionedType.colDataType = datatypes::SystemCatalog::LONGDOUBLE;
unionedType.scale = (type.scale > unionedType.scale) ? type.scale : unionedType.scale;
unionedType.colWidth = sizeof(long double);
unionedType.precision = -1;
}
break;
default:
break;
}