You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-04 04:42:30 +03:00
MCOL-641 Fixed group_concat for narrow-DECIMALs.
This commit is contained in:
@ -457,17 +457,32 @@ void GroupConcator::outputRow(std::ostringstream& oss, const rowgroup::Row& row)
|
||||
case CalpontSystemCatalog::UDECIMAL:
|
||||
{
|
||||
int scale = (int) row.getScale(*i);
|
||||
//{
|
||||
// long double dblVal = intVal / pow(10.0, (double)scale);
|
||||
// oss << fixed << setprecision(scale) << dblVal;
|
||||
//}
|
||||
char buf[utils::MAXLENGTH16BYTES];
|
||||
|
||||
int128_t* dec = row.getBinaryField<int128_t>(*i);
|
||||
dataconvert::DataConvert::decimalToString(dec,
|
||||
static_cast<uint32_t>(scale), buf,
|
||||
sizeof(buf), types[*i]);
|
||||
oss << fixed << buf;
|
||||
|
||||
if (LIKELY(row.getColumnWidth(*i) == datatypes::MAXDECIMALWIDTH))
|
||||
{
|
||||
char buf[utils::MAXLENGTH16BYTES];
|
||||
|
||||
int128_t* dec = row.getBinaryField<int128_t>(*i);
|
||||
dataconvert::DataConvert::decimalToString(dec,
|
||||
static_cast<uint32_t>(scale), buf,
|
||||
sizeof(buf), types[*i]);
|
||||
oss << fixed << buf;
|
||||
}
|
||||
else
|
||||
{
|
||||
int64_t intVal = row.getIntField(*i);
|
||||
if (scale == 0)
|
||||
{
|
||||
oss << intVal;
|
||||
}
|
||||
else
|
||||
{
|
||||
char buf[utils::MAXLENGTH8BYTES];
|
||||
dataconvert::DataConvert::decimalToString(intVal,
|
||||
scale, buf, sizeof(buf), types[*i]);
|
||||
oss << fixed << buf;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ namespace utils
|
||||
const uint64_t BINARYEMPTYVALUELOW = 1ULL;
|
||||
const uint64_t BINARYEMPTYVALUEHIGH = 0x8000000000000000ULL;
|
||||
const uint8_t MAXLENGTH16BYTES = 42;
|
||||
const uint8_t MAXLENGTH8BYTES = 23;
|
||||
|
||||
inline bool isWideDecimalNullValue(const int128_t& val)
|
||||
{
|
||||
|
@ -1911,7 +1911,8 @@ string Func_format::getStrVal(Row& row,
|
||||
|
||||
char buf[80];
|
||||
|
||||
dataconvert::DataConvert::decimalToString( decimal.value, decimal.scale, buf, 80, parm[0]->data()->resultType().colDataType);
|
||||
dataconvert::DataConvert::decimalToString( decimal.value,
|
||||
decimal.scale, buf, 80, parm[0]->data()->resultType().colDataType);
|
||||
|
||||
value = buf;
|
||||
}
|
||||
|
Reference in New Issue
Block a user