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

MCOL-641 This commit introduces GTest Suite into CS.

Binary NULL magic now consists of a series of BINARYEMPTYROW-s + BINARYNULL
in the end.

ByteStream now has hexbyte alias.

Added ColumnCommand::getEmptyRowValue to support 16 byte EMPTY values.
This commit is contained in:
Roman Nozdrin
2020-02-19 18:50:48 +00:00
parent 31d597d87e
commit f73de30427
13 changed files with 283 additions and 87 deletions

View File

@ -285,7 +285,6 @@ template<>
inline bool isEmptyVal<16>(uint8_t type, const uint8_t* ival) // For BINARY
{
const uint64_t* val = reinterpret_cast<const uint64_t*>(ival);
// WIP ugly speed hack
return ((val[0] == joblist::BINARYEMPTYROW) && (val[1] == joblist::BINARYEMPTYROW));
}
@ -415,15 +414,15 @@ template<>
inline bool isNullVal<16>(uint8_t type, const uint8_t* ival) // For BINARY
{
const uint64_t* val = reinterpret_cast<const uint64_t*>(ival);
return ((val[0] == joblist::BINARYNULL) && (val[1] == joblist::BINARYNULL));
return ((val[0] == joblist::BINARYEMPTYROW) && (val[1] == joblist::BINARYNULL));
}
template<>
inline bool isNullVal<32>(uint8_t type, const uint8_t* ival) // For BINARY
{
const uint64_t* val = reinterpret_cast<const uint64_t*>(ival);
return ((val[0] == joblist::BINARYNULL) && (val[1] == joblist::BINARYNULL)
&& (val[2] == joblist::BINARYNULL) && (val[3] == joblist::BINARYNULL));
return ((val[0] == joblist::BINARYEMPTYROW) && (val[1] == joblist::BINARYEMPTYROW)
&& (val[2] == joblist::BINARYEMPTYROW) && (val[3] == joblist::BINARYNULL));
}
template<>
@ -614,7 +613,7 @@ inline bool isMinMaxValid(const NewColRequestHeader* in)
case CalpontSystemCatalog::DECIMAL:
case CalpontSystemCatalog::UDECIMAL:
return (in->DataSize <= 16);
return (in->DataSize <= 16 );
default:
return false;

View File

@ -165,6 +165,7 @@ void ColumnCommand::loadData()
{
// fill remaining blocks with empty values when col scan
int blockLen = BLOCK_SIZE / colType.colWidth;
ByteStream::hexbyte* hPtr = NULL;
ByteStream::octbyte* oPtr = NULL;
ByteStream::quadbyte* qPtr = NULL;
ByteStream::byte* bPtr = NULL;
@ -183,6 +184,10 @@ void ColumnCommand::loadData()
if (colType.colWidth == 8)
oPtr = reinterpret_cast<ByteStream::octbyte*>(&bpp->blockData[i * BLOCK_SIZE]);
if (colType.colWidth == 16)
hPtr = reinterpret_cast<ByteStream::hexbyte*>(&bpp->blockData[i * BLOCK_SIZE]);
for (int idx = 0; idx < blockLen; idx++)
{
if (bPtr && colType.colWidth == 1)
@ -208,9 +213,7 @@ void ColumnCommand::loadData()
}
else if (colType.colWidth == 16)
{
uint64_t *ptr = reinterpret_cast<uint64_t*>(&bpp->blockData[i * BLOCK_SIZE] + (idx*16) );
*ptr = joblist::BINARYEMPTYROW;
*(ptr + 1) = joblist::BINARYEMPTYROW;
getEmptyRowValue(colType.colDataType, colType.colWidth, &hPtr[idx]);
}
}
@ -965,7 +968,7 @@ void ColumnCommand::enableFilters()
* RETURN:
* emptyVal - the value of empty row
***********************************************************/
uint64_t ColumnCommand::getEmptyRowValue( const execplan::CalpontSystemCatalog::ColDataType dataType, const int width ) const
const uint64_t ColumnCommand::getEmptyRowValue( const CSCDataType dataType, const int width ) const
{
uint64_t emptyVal = 0;
int offset;
@ -1056,6 +1059,16 @@ uint64_t ColumnCommand::getEmptyRowValue( const execplan::CalpontSystemCatalog::
return emptyVal;
}
void ColumnCommand::getEmptyRowValue(const CSCDataType dataType,
const int width, messageqcpp::ByteStream::hexbyte* space) const
{
uint64_t *ptr = reinterpret_cast<uint64_t*>(space);
ptr[0] = joblist::BINARYEMPTYROW;
ptr[1] = joblist::BINARYEMPTYROW;
}
void ColumnCommand::getLBIDList(uint32_t loopCount, vector<int64_t>* lbids)
{
int64_t firstLBID = lbid, lastLBID = firstLBID + (loopCount * colType.colWidth) - 1, i;

View File

@ -34,6 +34,8 @@
#include "command.h"
#include "calpontsystemcatalog.h"
using CSCDataType = execplan::CalpontSystemCatalog::ColDataType;
namespace primitiveprocessor
{
@ -82,8 +84,10 @@ public:
makeAbsRids = m;
}
bool willPrefetch();
uint64_t getEmptyRowValue( const execplan::CalpontSystemCatalog::ColDataType dataType, const int width ) const;
int64_t getLastLbid();
const uint64_t getEmptyRowValue( const CSCDataType dataType, const int width ) const;
void getEmptyRowValue(const CSCDataType dataType,
const int width, messageqcpp::ByteStream::hexbyte* space) const;
const int64_t getLastLbid();
void getLBIDList(uint32_t loopCount, std::vector<int64_t>* lbids);
virtual SCommand duplicate();