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 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:
Gagan Goel
2020-11-09 18:45:22 -05:00
committed by Roman Nozdrin
parent 6fd7916c56
commit 007b8a5082
5 changed files with 44 additions and 36 deletions

View File

@ -335,20 +335,18 @@ public:
// the original decimal scale is stored in scale field, which is no use for double.
if (fResultType.precision == -1)
{
IDB_Decimal rv;
if (fResultType.colDataType == CalpontSystemCatalog::DOUBLE)
{
rv.scale = fResultType.scale;
rv.precision = 15;
rv.value = (int64_t)(TreeNode::getDoubleVal() * IDB_pow[rv.scale]);
IDB_Decimal rv(
(int64_t)(TreeNode::getDoubleVal() * IDB_pow[fResultType.scale]),
fResultType.scale, 15);
return rv;
}
else if (fResultType.colDataType == CalpontSystemCatalog::LONGDOUBLE)
{
IDB_Decimal rv;
rv.scale = fResultType.scale;
rv.precision = 19;
rv.value = (int64_t)(TreeNode::getLongDoubleVal() * IDB_pow[rv.scale]);
IDB_Decimal rv (
(int64_t)(TreeNode::getLongDoubleVal() * IDB_pow[fResultType.scale]),
fResultType.scale, fResultType.precision);
return rv;
}
}