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

MCOL-5708 Calculate precision and scale for constant decimal.

This patch calculates precision and scale for constant decimal
value for SUM aggregation function.
This commit is contained in:
Denis Khalikov
2024-06-11 14:47:24 +00:00
parent e5722b0f02
commit ccb7ba5914
5 changed files with 90 additions and 2 deletions

View File

@ -3702,10 +3702,13 @@ void RowAggregationUM::doNotNullConstantAggregate(const ConstantAggData& aggData
auto width = fRow.getColumnWidth(colOut);
if (width == datatypes::MAXDECIMALWIDTH)
{
int precision, scale;
// MCOL-5708 Calculate precision and scale based on the given value.
datatypes::decimalPrecisionAndScale(aggData.fConstValue, precision, scale);
datatypes::TypeHolderStd colType;
colType.colWidth = width;
colType.precision = fRow.getPrecision(i);
colType.scale = fRow.getScale(i);
colType.precision = precision;
colType.scale = scale;
colType.colDataType = colDataType;
int128_t constValue = colType.decimal128FromString(aggData.fConstValue);
int128_t sum;