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

MCOL-4180 Add some missing support for wide decimals to dbcon/execplan

classes.
This commit is contained in:
Gagan Goel
2020-12-12 00:14:48 +00:00
parent 9c623a5434
commit ed7811e161
5 changed files with 67 additions and 9 deletions

View File

@ -763,7 +763,14 @@ inline uint64_t TreeNode::getUintVal()
case CalpontSystemCatalog::DECIMAL:
case CalpontSystemCatalog::UDECIMAL:
{
return (uint64_t)(fResult.decimalVal.value / pow((double)10, fResult.decimalVal.scale));
if (fResultType.colWidth == datatypes::MAXDECIMALWIDTH)
{
return static_cast<uint64_t>(fResult.decimalVal.getIntegralPart());
}
else
{
return (uint64_t)(fResult.decimalVal.value / pow((double)10, fResult.decimalVal.scale));
}
}
case CalpontSystemCatalog::DATE:
@ -829,8 +836,16 @@ inline float TreeNode::getFloatVal()
return (float)fResult.doubleVal;
case CalpontSystemCatalog::DECIMAL:
case CalpontSystemCatalog::UDECIMAL:
{
return (fResult.decimalVal.value / pow((double)10, fResult.decimalVal.scale));
if (fResultType.colWidth == datatypes::MAXDECIMALWIDTH)
{
return static_cast<float>(fResult.decimalVal);
}
else
{
return (fResult.decimalVal.value / pow((double)10, fResult.decimalVal.scale));
}
}
case CalpontSystemCatalog::DATE:
@ -974,8 +989,15 @@ inline long double TreeNode::getLongDoubleVal()
case CalpontSystemCatalog::DECIMAL:
case CalpontSystemCatalog::UDECIMAL:
{
// this may not be accurate. if this is problematic, change to pre-calculated power array.
return (long double)(fResult.decimalVal.value / pow((long double)10, fResult.decimalVal.scale));
if (fResultType.colWidth == datatypes::MAXDECIMALWIDTH)
{
return static_cast<long double>(fResult.decimalVal);
}
else
{
// this may not be accurate. if this is problematic, change to pre-calculated power array.
return (long double)(fResult.decimalVal.value / pow((long double)10, fResult.decimalVal.scale));
}
}
case CalpontSystemCatalog::DATE: