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-4180 Add some missing support for wide decimals to dbcon/execplan
classes.
This commit is contained in:
@ -127,7 +127,8 @@ bool ArithmeticOperator::operator!=(const TreeNode* t) const
|
||||
|
||||
void ArithmeticOperator::adjustResultType(const CalpontSystemCatalog::ColType& m)
|
||||
{
|
||||
if (m.colDataType != CalpontSystemCatalog::DECIMAL)
|
||||
if (m.colDataType != CalpontSystemCatalog::DECIMAL &&
|
||||
m.colDataType != CalpontSystemCatalog::UDECIMAL)
|
||||
{
|
||||
fResultType = m;
|
||||
}
|
||||
|
@ -246,11 +246,12 @@ inline void ArithmeticOperator::evaluate(rowgroup::Row& row, bool& isNull, Parse
|
||||
case execplan::CalpontSystemCatalog::LONGDOUBLE:
|
||||
fResult.longDoubleVal = execute(lop->getLongDoubleVal(row, isNull), rop->getLongDoubleVal(row, isNull), isNull);
|
||||
break;
|
||||
// WIP MCOL-641
|
||||
|
||||
case execplan::CalpontSystemCatalog::DECIMAL:
|
||||
case execplan::CalpontSystemCatalog::UDECIMAL:
|
||||
execute(fResult.decimalVal, lop->getDecimalVal(row, isNull), rop->getDecimalVal(row, isNull), isNull);
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
std::ostringstream oss;
|
||||
|
@ -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:
|
||||
|
Reference in New Issue
Block a user