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

MCOL-4387 Convert dataconvert::decimalToString() into VDecimal and TSInt128 methods

This commit is contained in:
Roman Nozdrin
2020-11-10 17:27:16 +00:00
parent 007b8a5082
commit 58495d0d2f
29 changed files with 793 additions and 878 deletions

View File

@ -153,8 +153,10 @@ void SimpleColumn_Decimal<len>::setNullVal()
template<int len>
inline const std::string& SimpleColumn_Decimal<len>:: getStrVal(rowgroup::Row& row, bool& isNull)
{
dataconvert::DataConvert::decimalToString((int64_t)row.getIntField<len>(fInputIndex), fResultType.scale, tmp, 22, fResultType.colDataType);
fResult.strVal = std::string(tmp);
datatypes::VDecimal dec((int64_t)row.getIntField<len>(fInputIndex),
fResultType.scale,
fResultType.precision);
fResult.strVal = dec.toString();
return fResult.strVal;
}

View File

@ -632,10 +632,10 @@ inline const std::string& TreeNode::getStrVal(const std::string& timeZone)
case CalpontSystemCatalog::UDECIMAL:
{
if (fResultType.colWidth == datatypes::MAXDECIMALWIDTH)
dataconvert::DataConvert::decimalToString(&fResult.decimalVal.s128Value, fResult.decimalVal.scale, tmp, datatypes::Decimal::MAXLENGTH16BYTES, fResultType.colDataType);
// Explicit path for TSInt128 decimals with low precision
fResult.strVal = fResult.decimalVal.toString(true);
else
dataconvert::DataConvert::decimalToString(fResult.decimalVal.value, fResult.decimalVal.scale, tmp, 22, fResultType.colDataType);
fResult.strVal = std::string(tmp);
fResult.strVal = fResult.decimalVal.toString();
break;
}