You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +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
@ -75,6 +75,12 @@ int64_t Func_ceil::getIntVal(Row& row,
|
||||
case execplan::CalpontSystemCatalog::DECIMAL:
|
||||
case execplan::CalpontSystemCatalog::UDECIMAL:
|
||||
{
|
||||
if (op_ct.scale == 0)
|
||||
{
|
||||
ret = parm[0]->data()->getIntVal(row, isNull);
|
||||
break;
|
||||
}
|
||||
|
||||
IDB_Decimal d = parm[0]->data()->getDecimalVal(row, isNull);
|
||||
|
||||
if (isNull)
|
||||
@ -222,6 +228,12 @@ uint64_t Func_ceil::getUintVal(Row& row,
|
||||
case execplan::CalpontSystemCatalog::DECIMAL:
|
||||
case execplan::CalpontSystemCatalog::UDECIMAL:
|
||||
{
|
||||
if (op_ct.scale == 0)
|
||||
{
|
||||
ret = parm[0]->data()->getIntVal(row, isNull);
|
||||
break;
|
||||
}
|
||||
|
||||
IDB_Decimal d = parm[0]->data()->getDecimalVal(row, isNull);
|
||||
|
||||
if (isNull)
|
||||
|
@ -134,7 +134,7 @@ string Func_char::getStrVal(Row& row,
|
||||
case execplan::CalpontSystemCatalog::DECIMAL:
|
||||
case execplan::CalpontSystemCatalog::UDECIMAL:
|
||||
{
|
||||
IDB_Decimal d = parm[0]->data()->getDecimalVal(row, isNull);
|
||||
IDB_Decimal d = rc->getDecimalVal(row, isNull);
|
||||
|
||||
if (ct.colWidth == datatypes::MAXDECIMALWIDTH)
|
||||
{
|
||||
@ -154,30 +154,16 @@ string Func_char::getStrVal(Row& row,
|
||||
tmpval++;
|
||||
|
||||
value = datatypes::Decimal::getInt32FromWideDecimal(tmpval);
|
||||
|
||||
// WIP MCOL-641
|
||||
/*if ( !getChar((int64_t)tmpval, buf) )
|
||||
{
|
||||
isNull = true;
|
||||
return "";
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
double dscale = d.scale;
|
||||
// get decimal and round up
|
||||
int value = d.value / pow(10.0, dscale);
|
||||
value = d.value / pow(10.0, dscale);
|
||||
int lefto = (d.value - value * pow(10.0, dscale)) / pow(10.0, dscale - 1);
|
||||
|
||||
if ( lefto > 4 )
|
||||
value++;
|
||||
|
||||
// WIP MCOL-641
|
||||
/*if ( !getChar((int64_t)value, buf) )
|
||||
{
|
||||
isNull = true;
|
||||
return "";
|
||||
}*/
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
Reference in New Issue
Block a user