You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-02 17:22:27 +03:00
MCOL-4387 Convert dataconvert::decimalToString() into VDecimal and TSInt128 methods
This commit is contained in:
@ -300,7 +300,6 @@ void BRMReporter::sendCPToFile( )
|
||||
{
|
||||
if (fCPInfo.size() > 0)
|
||||
{
|
||||
char buf[datatypes::Decimal::MAXLENGTH16BYTES];
|
||||
std::ostringstream oss;
|
||||
oss << "Writing " << fCPInfo.size() << " CP updates for table " <<
|
||||
fTableName << " to report file " << fRptFileName;
|
||||
@ -319,14 +318,9 @@ void BRMReporter::sendCPToFile( )
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string bigMin, bigMax;
|
||||
|
||||
dataconvert::DataConvert::decimalToString(&fCPInfo[i].bigMin, 0, buf, (uint8_t) sizeof(buf), fCPInfo[i].type);
|
||||
bigMin = buf;
|
||||
|
||||
dataconvert::DataConvert::decimalToString(&fCPInfo[i].bigMax, 0, buf, (uint8_t) sizeof(buf), fCPInfo[i].type);
|
||||
bigMax = buf;
|
||||
|
||||
datatypes::TSInt128 bigMin(&fCPInfo[i].bigMin);
|
||||
datatypes::TSInt128 bigMax(&fCPInfo[i].bigMax);
|
||||
|
||||
fRptFile << "CP: " << fCPInfo[i].startLbid << ' ' <<
|
||||
bigMax << ' ' <<
|
||||
bigMin << ' ' <<
|
||||
|
@ -2994,16 +2994,11 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs,
|
||||
{
|
||||
if (fetchColColwidths[fetchColPos] == datatypes::MAXDECIMALWIDTH)
|
||||
{
|
||||
int128_t* dec;
|
||||
char buf[datatypes::Decimal::MAXLENGTH16BYTES];
|
||||
dec = row.getBinaryField<int128_t>(fetchColPos);
|
||||
|
||||
dataconvert::DataConvert::decimalToString(dec,
|
||||
(unsigned)fetchColScales[fetchColPos], buf,
|
||||
(uint8_t) sizeof(buf), fetchColTypes[fetchColPos]);
|
||||
|
||||
value.assign(buf);
|
||||
|
||||
datatypes::VDecimal dec(0,
|
||||
fetchColScales[fetchColPos],
|
||||
rowGroups[txnId]->getPrecision()[fetchColPos],
|
||||
row.getBinaryField<int128_t>(fetchColPos));
|
||||
value = dec.toString(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -3042,12 +3037,10 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs,
|
||||
}
|
||||
else
|
||||
{
|
||||
const int ctmp_size = 65 + 1 + 1 + 1;
|
||||
char ctmp[ctmp_size] = {0};
|
||||
DataConvert::decimalToString(
|
||||
intColVal, fetchColScales[fetchColPos],
|
||||
ctmp, ctmp_size, fetchColTypes[fetchColPos]);
|
||||
value = ctmp; // null termination by decimalToString
|
||||
datatypes::VDecimal dec(intColVal,
|
||||
fetchColScales[fetchColPos],
|
||||
rowGroups[txnId]->getPrecision()[fetchColPos]);
|
||||
value = dec.toString();
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -3356,16 +3349,11 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs,
|
||||
{
|
||||
if (fetchColColwidths[fetchColPos] == datatypes::MAXDECIMALWIDTH)
|
||||
{
|
||||
int128_t* dec;
|
||||
char buf[datatypes::Decimal::MAXLENGTH16BYTES];
|
||||
dec = row.getBinaryField<int128_t>(fetchColPos);
|
||||
|
||||
dataconvert::DataConvert::decimalToString(dec,
|
||||
(unsigned)fetchColScales[fetchColPos], buf,
|
||||
(uint8_t) sizeof(buf), fetchColTypes[fetchColPos]);
|
||||
|
||||
value = buf;
|
||||
|
||||
datatypes::VDecimal dec(0,
|
||||
fetchColScales[fetchColPos],
|
||||
rowGroups[txnId]->getPrecision()[fetchColPos],
|
||||
row.getBinaryField<int128_t>(fetchColPos));
|
||||
value = dec.toString(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -3405,12 +3393,10 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs,
|
||||
}
|
||||
else
|
||||
{
|
||||
const int ctmp_size = 65 + 1 + 1 + 1;
|
||||
char ctmp[ctmp_size] = {0};
|
||||
DataConvert::decimalToString(
|
||||
intColVal, fetchColScales[fetchColPos],
|
||||
ctmp, ctmp_size, fetchColTypes[fetchColPos]);
|
||||
value = ctmp; // null termination by decimalToString
|
||||
datatypes::VDecimal dec(intColVal,
|
||||
fetchColScales[fetchColPos],
|
||||
rowGroups[txnId]->getPrecision()[fetchColPos]);
|
||||
value = dec.toString();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -3896,11 +3896,8 @@ void WriteEngineWrapper::printInputValue(const ColStructList& colStructList,
|
||||
curStr = boost::lexical_cast<string>(boost::any_cast<long long>(curTuple.data));
|
||||
else if (curTuple.data.type() == typeid(int128_t))
|
||||
{
|
||||
// WIP replace with a single call
|
||||
char buf[datatypes::Decimal::MAXLENGTH16BYTES];
|
||||
int128_t val = boost::any_cast<int128_t>(curTuple.data);
|
||||
dataconvert::DataConvert::decimalToString(&val, 0, buf, (uint8_t) sizeof(buf), curColStruct.colDataType);
|
||||
curStr.assign(buf);
|
||||
datatypes::TSInt128 val(boost::any_cast<int128_t>(curTuple.data));
|
||||
curStr = val.toString();
|
||||
}
|
||||
else if (curTuple.data.type() == typeid(double))
|
||||
curStr = boost::lexical_cast<string>(boost::any_cast<double>(curTuple.data));
|
||||
|
Reference in New Issue
Block a user