You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-27 21:01:50 +03:00
MCOL-4387 Convert dataconvert::decimalToString() into VDecimal and TSInt128 methods
This commit is contained in:
@ -1099,8 +1099,8 @@ dec4: /* have to pick a scale to use for the double. using 5... */
|
||||
case CalpontSystemCatalog::DECIMAL:
|
||||
case CalpontSystemCatalog::UDECIMAL:
|
||||
{
|
||||
int64_t val;
|
||||
int128_t val128;
|
||||
int64_t val = 0;
|
||||
int128_t val128 = 0;
|
||||
bool isInputWide = false;
|
||||
|
||||
if (in.getColumnWidth(i) == datatypes::MAXDECIMALWIDTH)
|
||||
@ -1185,15 +1185,21 @@ dec4: /* have to pick a scale to use for the double. using 5... */
|
||||
case CalpontSystemCatalog::VARCHAR:
|
||||
default:
|
||||
{
|
||||
char buf[50];
|
||||
dataconvert::DataConvert::decimalToString(val, scale, buf, 50, out->getColTypes()[i]);
|
||||
/* ostringstream oss;
|
||||
if (scale == 0)
|
||||
oss << val;
|
||||
else
|
||||
oss << (val / IDB_pow[scale]) << "."
|
||||
<< setw(scale) << setfill('0') << (val % IDB_pow[scale]); */
|
||||
out->setStringField(string(buf), i);
|
||||
if (LIKELY(isInputWide))
|
||||
{
|
||||
datatypes::VDecimal dec(0,
|
||||
in.getScale(i),
|
||||
in.getPrecision(i),
|
||||
val128);
|
||||
out->setStringField(dec.toString(), i);
|
||||
}
|
||||
else
|
||||
{
|
||||
datatypes::VDecimal dec(val,
|
||||
in.getScale(i),
|
||||
in.getPrecision(i));
|
||||
out->setStringField(dec.toString(), i);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user