You've already forked mariadb-columnstore-engine
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:
@ -53,6 +53,7 @@
|
||||
#include "vlarray.h"
|
||||
|
||||
#include "collation.h"
|
||||
#include "widedecimalutils.h"
|
||||
|
||||
//..comment out NDEBUG to enable assertions, uncomment NDEBUG to disable
|
||||
//#define NDEBUG
|
||||
@ -222,19 +223,8 @@ inline string getStringNullValue()
|
||||
return joblist::CPNULLSTRMARK;
|
||||
}
|
||||
|
||||
inline uint64_t getBinaryNullValue()
|
||||
{
|
||||
return joblist::BINARYNULL;
|
||||
}
|
||||
|
||||
inline uint64_t getBinaryEmptyValue()
|
||||
{
|
||||
return joblist::BINARYEMPTYROW;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
namespace rowgroup
|
||||
{
|
||||
const std::string typeStr("");
|
||||
@ -1176,14 +1166,11 @@ void RowAggregation::makeAggFieldsNull(Row& row)
|
||||
}
|
||||
else
|
||||
{
|
||||
// WIP This is only 1st part of the value
|
||||
uint64_t nullValue = getBinaryNullValue();
|
||||
uint64_t emptyValue = getBinaryEmptyValue();
|
||||
int128_t nullValue = 0;
|
||||
utils::setWideDecimalNullValue(nullValue);
|
||||
uint32_t offset = row.getOffset(colOut);
|
||||
row.setBinaryField_offset(&nullValue, sizeof(nullValue),
|
||||
offset);
|
||||
row.setBinaryField_offset(&emptyValue, sizeof(nullValue),
|
||||
offset+sizeof(nullValue));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -91,15 +91,9 @@ class RowDecimalTest : public ::testing::Test {
|
||||
int128_t nullValue = 0;
|
||||
int128_t bigValue = 0;
|
||||
uint64_t* uint128_pod = reinterpret_cast<uint64_t*>(&nullValue);
|
||||
uint128_pod[0] = joblist::BINARYNULL;
|
||||
uint128_pod[1] = joblist::BINARYEMPTYROW;
|
||||
uint128_pod[0] = joblist::UBIGINTNULL;
|
||||
uint128_pod[1] = joblist::UBIGINTEMPTYROW;
|
||||
bigValue = -static_cast<int128_t>(0xFFFFFFFF)*0xFFFFFFFFFFFFFFFF;
|
||||
//char buf[utils::precisionByWidth(16)+3];
|
||||
//memset(&buf[0], 0, sizeof(buf));
|
||||
//int scale1 = 3;
|
||||
//dataconvert::DataConvert::decimalToString(&bigValue, scale1, buf,
|
||||
// utils::precisionByWidth(sizeof(bigValue))+3,types[0]);
|
||||
//std::cout << buf << std::endl;
|
||||
sValueVector.push_back(nullValue);
|
||||
sValueVector.push_back(-42);
|
||||
sValueVector.push_back(bigValue);
|
||||
@ -136,8 +130,6 @@ class RowDecimalTest : public ::testing::Test {
|
||||
s64ValueVector.push_back(0x81);
|
||||
s64ValueVector.push_back(joblist::BIGINTNULL-1);
|
||||
|
||||
//r.initToNull();
|
||||
//r.nextRow(rowSize);
|
||||
for(size_t i = 0; i < sValueVector.size(); i++) {
|
||||
r.setBinaryField_offset(&sValueVector[i],
|
||||
sizeof(sValueVector[0]), offsets[0]);
|
||||
|
@ -44,6 +44,7 @@ using namespace execplan;
|
||||
#include "rowgroup.h"
|
||||
#include "dataconvert.h"
|
||||
#include "columnwidth.h"
|
||||
#include "widedecimalutils.h"
|
||||
|
||||
#include "collation.h"
|
||||
|
||||
@ -850,9 +851,7 @@ void Row::initToNull()
|
||||
|
||||
case 16 :
|
||||
{
|
||||
uint64_t *dec = reinterpret_cast<uint64_t*>(&data[offsets[i]]);
|
||||
dec[0] = joblist::BINARYNULL;
|
||||
dec[1] = joblist::BINARYEMPTYROW;
|
||||
utils::setWideDecimalNullValue(reinterpret_cast<int128_t&>(data[offsets[i]]));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -881,9 +880,7 @@ void Row::initToNull()
|
||||
break;
|
||||
case CalpontSystemCatalog::BINARY:
|
||||
{
|
||||
uint64_t *dec = reinterpret_cast<uint64_t*>(&data[offsets[i]]);
|
||||
dec[0] = joblist::BINARYNULL;
|
||||
dec[1] = joblist::BINARYEMPTYROW;
|
||||
utils::setWideDecimalNullValue(reinterpret_cast<int128_t&>(data[offsets[i]]));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -915,11 +912,11 @@ inline bool
|
||||
Row::isNullValue_offset<execplan::CalpontSystemCatalog::BINARY,32>(
|
||||
uint32_t offset) const
|
||||
{
|
||||
const int64_t *intPtr = reinterpret_cast<const int64_t*>(&data[offset]);
|
||||
return ((intPtr[0] == static_cast<int64_t>(joblist::BINARYNULL)) &&
|
||||
(intPtr[1] == static_cast<int64_t>(joblist::BINARYEMPTYROW)) &&
|
||||
(intPtr[2] == static_cast<int64_t>(joblist::BINARYEMPTYROW)) &&
|
||||
(intPtr[3] == static_cast<int64_t>(joblist::BINARYEMPTYROW)));
|
||||
const uint64_t *intPtr = reinterpret_cast<const uint64_t*>(&data[offset]);
|
||||
return ((intPtr[0] == static_cast<uint64_t>(utils::BINARYNULLVALUELOW)) &&
|
||||
(intPtr[1] == static_cast<uint64_t>(utils::BINARYNULLVALUELOW)) &&
|
||||
(intPtr[2] == static_cast<uint64_t>(utils::BINARYNULLVALUELOW)) &&
|
||||
(intPtr[3] == static_cast<uint64_t>(utils::BINARYEMPTYVALUEHIGH)));
|
||||
}
|
||||
|
||||
template<>
|
||||
@ -927,9 +924,8 @@ inline bool
|
||||
Row::isNullValue_offset<execplan::CalpontSystemCatalog::BINARY,16>(
|
||||
uint32_t offset) const
|
||||
{
|
||||
const int64_t *intPtr = reinterpret_cast<const int64_t*>(&data[offset]);
|
||||
return ((intPtr[0] == static_cast<int64_t>(joblist::BINARYNULL))
|
||||
&& (intPtr[1] == static_cast<int64_t>(joblist::BINARYEMPTYROW)));
|
||||
const int128_t *intPtr = reinterpret_cast<const int128_t*>(&data[offset]);
|
||||
return utils::isWideDecimalNullValue (*intPtr);
|
||||
}
|
||||
|
||||
template<>
|
||||
@ -937,9 +933,8 @@ inline bool
|
||||
Row::isNullValue_offset<execplan::CalpontSystemCatalog::DECIMAL,16>(
|
||||
uint32_t offset) const
|
||||
{
|
||||
const int64_t *intPtr = reinterpret_cast<const int64_t*>(&data[offset]);
|
||||
return ((intPtr[0] == static_cast<int64_t>(joblist::BINARYNULL))
|
||||
&& (intPtr[1] == static_cast<int64_t>(joblist::BINARYEMPTYROW)));
|
||||
const int128_t *intPtr = reinterpret_cast<const int128_t*>(&data[offset]);
|
||||
return utils::isWideDecimalNullValue (*intPtr);
|
||||
}
|
||||
|
||||
template<>
|
||||
@ -1059,8 +1054,7 @@ bool Row::isNullValue(uint32_t colIndex) const
|
||||
case CalpontSystemCatalog::UDECIMAL:
|
||||
{
|
||||
// WIP MCOL-641 Allmighty hack.
|
||||
int32_t width = getColumnWidth(colIndex);
|
||||
switch (width)
|
||||
switch (getColumnWidth(colIndex))
|
||||
{
|
||||
// MCOL-641
|
||||
case 16:
|
||||
|
@ -814,22 +814,27 @@ inline uint32_t Row::getStringLength(uint32_t colIndex) const
|
||||
memcpy(&data[offset], strdata, length);
|
||||
}*/
|
||||
|
||||
// WIP MCOL-641. This method can be applied to uint8_t* buffers.
|
||||
// MCOL-641. This method can be applied to uint8_t* buffers.
|
||||
template<typename T>
|
||||
inline void Row::setBinaryField(T* value, uint32_t width, uint32_t colIndex)
|
||||
{
|
||||
memcpy(&data[offsets[colIndex]], value, width);
|
||||
}
|
||||
|
||||
// WIP MCOL-641. This method !cannot! be applied to uint8_t* buffers.
|
||||
// MCOL-641. This method !cannot! be applied to uint8_t* buffers.
|
||||
template<typename T>
|
||||
inline void Row::setBinaryField_offset(T* value, uint32_t width, uint32_t offset)
|
||||
{
|
||||
// WIP Compare performance.
|
||||
//memcpy(&data[offset], value, width);
|
||||
// WIP Compare performance.
|
||||
*reinterpret_cast<T*>(&data[offset]) = *value;
|
||||
}
|
||||
|
||||
template<>
|
||||
inline void Row::setBinaryField_offset<uint8_t>(uint8_t* value, uint32_t width, uint32_t offset)
|
||||
{
|
||||
memcpy(&data[offset], value, width);
|
||||
}
|
||||
|
||||
inline void Row::setStringField(const uint8_t* strdata, uint32_t length, uint32_t colIndex)
|
||||
{
|
||||
uint64_t offset;
|
||||
|
Reference in New Issue
Block a user