1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

MCOL-641 Replaced NULL binary constants.

DataConvert::decimalToString, toString, writeIntPart, writeFractionalPart are not templates anymore.
This commit is contained in:
Roman Nozdrin
2020-03-02 14:38:40 +00:00
parent 61647c1f5b
commit 97ee1609b2
16 changed files with 200 additions and 193 deletions

View File

@ -51,8 +51,8 @@ using namespace BRM;
#include "cacheutils.h"
#include "IDBDataFile.h"
#include "IDBPolicy.h"
#include "checks.h"
#include "columnwidth.h"
namespace WriteEngine
{
@ -3000,21 +3000,16 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs,
case CalpontSystemCatalog::UDECIMAL:
{
// WIP MCOL-641
// decimal width > 8 cannot be stored in an integer
if (fetchColColwidths[fetchColPos] > 8)
if (fetchColColwidths[fetchColPos] == 16)
{
int128_t* dec;
char buf[41];
char buf[utils::MAXLENGTH16BYTES];
dec = row.getBinaryField<int128_t>(fetchColPos);
dataconvert::DataConvert::decimalToString<int128_t>(dec,
dataconvert::DataConvert::decimalToString(dec,
(unsigned)fetchColScales[fetchColPos], buf,
sizeof(buf), fetchColTypes[fetchColPos]);
value = buf;
//value = row.getStringField(fetchColPos);
//unsigned i = strlen(value.c_str());
//value = value.substr(0, i);
value.assign(buf);
break;
}
@ -3368,22 +3363,17 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs,
case CalpontSystemCatalog::DECIMAL:
case CalpontSystemCatalog::UDECIMAL:
{
// WIP MCOL-641
// decimal width > 8 cannot be stored in an integer
if (fetchColColwidths[fetchColPos] > 8)
if (fetchColColwidths[fetchColPos] == 16)
{
// WIP MCOL-641
int128_t* dec;
char buf[41];
char buf[utils::MAXLENGTH16BYTES];
dec = row.getBinaryField<int128_t>(fetchColPos);
dataconvert::DataConvert::decimalToString<int128_t>(dec,
dataconvert::DataConvert::decimalToString(dec,
(unsigned)fetchColScales[fetchColPos], buf,
sizeof(buf), fetchColTypes[fetchColPos]);
value = buf;
//value = row.getStringField(fetchColPos);
//unsigned i = strlen(value.c_str());
//value = value.substr(0, i);
break;
}

View File

@ -58,6 +58,7 @@ using namespace execplan;
#include "MonitorProcMem.h"
using namespace idbdatafile;
#include "dataconvert.h"
#include "widedecimalutils.h"
#ifdef _MSC_VER
#define isnan _isnan
@ -3973,11 +3974,16 @@ void WriteEngineWrapper::printInputValue(const ColStructList& colStructList,
curStr = boost::lexical_cast<string>(boost::any_cast<float>(curTuple.data));
else if (curTuple.data.type() == typeid(long long))
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[utils::MAXLENGTH16BYTES];
int128_t val = boost::any_cast<int128_t>(curTuple.data);
dataconvert::DataConvert::toString(&val, 0, buf, utils::MAXLENGTH16BYTES);
curStr.assign(buf);
}
else if (curTuple.data.type() == typeid(double))
curStr = boost::lexical_cast<string>(boost::any_cast<double>(curTuple.data));
// else
// if (curTuple.data.type() == typeid(bool))
// curStr = boost::lexical_cast<string>(boost::any_cast<bool>(curTuple.data));
else if (curTuple.data.type() == typeid(short))
curStr = boost::lexical_cast<string>(boost::any_cast<short>(curTuple.data));
else if (curTuple.data.type() == typeid(char))