1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-01 06:46:55 +03:00

MCOL-641 This commit introduces templates for DataConvert and RowGroup methods.

This commit is contained in:
drrtuy
2020-01-21 12:57:31 +03:00
committed by Roman Nozdrin
parent 0c67b6ab50
commit 54c152d6c8
9 changed files with 111 additions and 37 deletions

View File

@ -953,6 +953,11 @@ bool Row::isNullValue(uint32_t colIndex) const
switch (len)
{
// MCOL-641 WIP
case 16:
return (*((int64_t*) &data[offsets[colIndex]]) == static_cast<int64_t>(joblist::BIGINTNULL));
break;
case 1 :
return (data[offsets[colIndex]] == joblist::TINYINTNULL);

View File

@ -435,7 +435,10 @@ public:
inline void setVarBinaryField(const uint8_t* val, uint32_t len, uint32_t colIndex);
inline std::string getBinaryField(uint32_t colIndex) const;
inline const uint8_t* getBinaryField2(uint32_t colIndex) const;
template <typename T>
inline T* getBinaryField(uint32_t colIndex) const;
template <typename T>
inline T* getBinaryField_offset(uint32_t offset) const;
inline boost::shared_ptr<mcsv1sdk::UserData> getUserData(uint32_t colIndex) const;
inline void setUserData(mcsv1sdk::mcsv1Context& context,
@ -792,7 +795,7 @@ inline uint32_t Row::getStringLength(uint32_t colIndex) const
return strnlen((char*) &data[offsets[colIndex]], getColumnWidth(colIndex));
}
// Check whether memcpy affects perf here
inline void Row::setBinaryField(const uint8_t* strdata, uint32_t length, uint32_t offset)
{
memcpy(&data[offset], strdata, length);
@ -837,11 +840,19 @@ inline std::string Row::getBinaryField(uint32_t colIndex) const
}
// WIP MCOL-641
inline const uint8_t* Row::getBinaryField2(uint32_t colIndex) const
template <typename T>
inline T* Row::getBinaryField(uint32_t colIndex) const
{
return &data[offsets[colIndex]];
return reinterpret_cast<T*>(&data[offsets[colIndex]]);
}
template <typename T>
inline T* Row::getBinaryField_offset(uint32_t offset) const
{
return reinterpret_cast<T*>(&data[offset]);
}
inline std::string Row::getVarBinaryStringField(uint32_t colIndex) const
{
if (inStringTable(colIndex))
@ -961,10 +972,12 @@ inline void Row::setUintField_offset(uint64_t val, uint32_t offset)
case 8:
*((uint64_t*) &data[offset]) = val;
break;
/* This doesn't look like appropriate place
case 16:
std::cout << __FILE__<< ":" <<__LINE__ << " Fix for 16 Bytes ?" << std::endl;
*((uint64_t*) &data[offset]) = val;
break;
*/
default:
idbassert(0);
throw std::logic_error("Row::setUintField called on a non-uint32_t field");