You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-29 08:21:15 +03:00
MCOL-4188 Fix regressions in CEIL()/CHAR() for narrow decimals.
In addition, a regression in a WHERE clause with a WF field as the LHS and an addition operation on two WF fields on the RHS is also fixed. The issue was SimpleColumn::getDecimalVal() was setting precision = 19, with the value of one of the operands of the addition operation being set in VDecimal::value instead of VDecimal::s128Value. addSubtractExecute() in mcs_decimal.cpp makes the assumption that if precision > 18 and precision <= 38, we need to fetch the wide s128Value, not the narrow value field. So we are fixing the precision set in SimpleColumn::getDecimalVal().
This commit is contained in:
committed by
Roman Nozdrin
parent
6fd7916c56
commit
007b8a5082
@ -640,8 +640,10 @@ void WindowFunctionColumn::evaluate(Row& row, bool& isNull)
|
||||
isNull = true;
|
||||
else
|
||||
{
|
||||
fResult.decimalVal.value = row.getIntField<1>(fInputIndex);
|
||||
fResult.decimalVal.scale = (unsigned)fResultType.scale;
|
||||
fResult.decimalVal = IDB_Decimal(
|
||||
row.getIntField<1>(fInputIndex),
|
||||
fResultType.scale,
|
||||
fResultType.precision);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -653,8 +655,10 @@ void WindowFunctionColumn::evaluate(Row& row, bool& isNull)
|
||||
isNull = true;
|
||||
else
|
||||
{
|
||||
fResult.decimalVal.value = row.getIntField<2>(fInputIndex);
|
||||
fResult.decimalVal.scale = (unsigned)fResultType.scale;
|
||||
fResult.decimalVal = IDB_Decimal(
|
||||
row.getIntField<2>(fInputIndex),
|
||||
fResultType.scale,
|
||||
fResultType.precision);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -666,8 +670,10 @@ void WindowFunctionColumn::evaluate(Row& row, bool& isNull)
|
||||
isNull = true;
|
||||
else
|
||||
{
|
||||
fResult.decimalVal.value = row.getIntField<4>(fInputIndex);
|
||||
fResult.decimalVal.scale = (unsigned)fResultType.scale;
|
||||
fResult.decimalVal = IDB_Decimal(
|
||||
row.getIntField<4>(fInputIndex),
|
||||
fResultType.scale,
|
||||
fResultType.precision);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -679,8 +685,10 @@ void WindowFunctionColumn::evaluate(Row& row, bool& isNull)
|
||||
isNull = true;
|
||||
else
|
||||
{
|
||||
fResult.decimalVal.value = row.getIntField<8>(fInputIndex);
|
||||
fResult.decimalVal.scale = (unsigned)fResultType.scale;
|
||||
fResult.decimalVal = IDB_Decimal(
|
||||
row.getIntField<8>(fInputIndex),
|
||||
fResultType.scale,
|
||||
fResultType.precision);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -688,13 +696,14 @@ void WindowFunctionColumn::evaluate(Row& row, bool& isNull)
|
||||
|
||||
case 16:
|
||||
{
|
||||
datatypes::TSInt128 dec(row.getBinaryField<int128_t>(fInputIndex));
|
||||
if (dec == datatypes::Decimal128Null)
|
||||
int128_t val;
|
||||
row.getInt128Field(fInputIndex, val);
|
||||
|
||||
if (val == datatypes::Decimal128Null)
|
||||
isNull = true;
|
||||
else
|
||||
{
|
||||
fResult.decimalVal = dec;
|
||||
fResult.decimalVal.scale = (unsigned)fResultType.scale;
|
||||
fResult.decimalVal = IDB_Decimal(0, fResultType.scale, fResultType.precision, val);
|
||||
}
|
||||
|
||||
break;
|
||||
|
Reference in New Issue
Block a user