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

Adding mcs_basic_types.h

For now it consists of only:

using int128_t = __int128;
using uint128_t = unsigned __int128;

All new privitive data types should go into this file in the future.
This commit is contained in:
Alexander Barkov
2020-11-06 18:05:50 +04:00
committed by Roman Nozdrin
parent 916950d1e9
commit d5c6645ba1
36 changed files with 138 additions and 133 deletions

View File

@ -31,6 +31,7 @@
#include <climits>
#include <string>
#include <time.h>
#include "mcs_basic_types.h"
#include "logicalpartition.h"
#ifndef _MSC_VER
@ -153,12 +154,12 @@ struct CPInfo
int32_t seqNum;
union
{
__int128 bigMax;
int128_t bigMax;
int64_t max_;
};
union
{
__int128 bigMin;
int128_t bigMin;
int64_t min_;
};
bool isBinaryColumn;
@ -173,12 +174,12 @@ struct CPMaxMin
int32_t seqNum;
union
{
__int128 bigMax;
int128_t bigMax;
int64_t max_;
};
union
{
__int128 bigMin;
int128_t bigMin;
int64_t min_;
};
bool isBinaryColumn;
@ -198,12 +199,12 @@ struct CPInfoMerge
bool newExtent; // is this to be treated as a new extent
union
{
__int128 bigMax;
int128_t bigMax;
int64_t max_;
};
union
{
__int128 bigMin;
int128_t bigMin;
int64_t min_;
};
};
@ -221,12 +222,12 @@ struct CPMaxMinMerge
bool newExtent;
union
{
__int128 bigMax;
int128_t bigMax;
int64_t max_;
};
union
{
__int128 bigMin;
int128_t bigMin;
int64_t min_;
};
};

View File

@ -560,7 +560,7 @@ int DBRM::setExtentsMaxMin(const CPInfoList_t& cpInfos) DBRM_THROW
{
if (it->isBinaryColumn)
{
command << (uint8_t)1 << (uint64_t)it->firstLbid << (unsigned __int128)it->bigMax << (unsigned __int128)it->bigMin << (uint32_t)it->seqNum;
command << (uint8_t)1 << (uint64_t)it->firstLbid << (uint128_t)it->bigMax << (uint128_t)it->bigMin << (uint32_t)it->seqNum;
}
else
{
@ -4583,7 +4583,7 @@ void DBRM::invalidateUncommittedExtentLBIDs(execplan::CalpontSystemCatalog::SCN
}
template
int DBRM::getExtentMaxMin<__int128>(const LBID_t lbid, __int128& max, __int128& min, int32_t& seqNum) throw();
int DBRM::getExtentMaxMin<int128_t>(const LBID_t lbid, int128_t& max, int128_t& min, int32_t& seqNum) throw();
template
int DBRM::getExtentMaxMin<int64_t>(const LBID_t lbid, int64_t& max, int64_t& min, int32_t& seqNum) throw();

View File

@ -132,7 +132,7 @@ EMCasualPartition_struct::EMCasualPartition_struct(const int64_t lo, const int64
isValid = CP_INVALID;
}
EMCasualPartition_struct::EMCasualPartition_struct(const __int128 bigLo, const __int128 bigHi, const int32_t seqNum)
EMCasualPartition_struct::EMCasualPartition_struct(const int128_t bigLo, const int128_t bigHi, const int32_t seqNum)
{
bigLoVal = bigLo;
bigHiVal = bigHi;
@ -890,15 +890,15 @@ void ExtentMap::mergeExtentsMaxMin(CPMaxMinMergeMap_t& cpMap, bool useLock)
}
else
{
if (static_cast<unsigned __int128>(it->second.bigMin) <
static_cast<unsigned __int128>(fExtentMap[i].partition.cprange.bigLoVal))
if (static_cast<uint128_t>(it->second.bigMin) <
static_cast<uint128_t>(fExtentMap[i].partition.cprange.bigLoVal))
{
fExtentMap[i].partition.cprange.bigLoVal =
it->second.bigMin;
}
if (static_cast<unsigned __int128>(it->second.bigMax) >
static_cast<unsigned __int128>(fExtentMap[i].partition.cprange.bigHiVal))
if (static_cast<uint128_t>(it->second.bigMax) >
static_cast<uint128_t>(fExtentMap[i].partition.cprange.bigHiVal))
{
fExtentMap[i].partition.cprange.bigHiVal =
it->second.bigMax;
@ -1033,7 +1033,7 @@ bool ExtentMap::isValidCPRange(const T& max, const T& min, execplan::CalpontSyst
{
if (isUnsigned(type))
{
if (typeid(T) != typeid(__int128))
if (typeid(T) != typeid(int128_t))
{
if ( (static_cast<uint64_t>(min) >= (numeric_limits<uint64_t>::max() - 1)) ||
(static_cast<uint64_t>(max) >= (numeric_limits<uint64_t>::max() - 1)) )
@ -1043,11 +1043,11 @@ bool ExtentMap::isValidCPRange(const T& max, const T& min, execplan::CalpontSyst
}
else
{
unsigned __int128 temp;
uint128_t temp;
utils::uint128Max(temp);
if ( (static_cast<unsigned __int128>(min) >= (temp - 1)) ||
(static_cast<unsigned __int128>(max) >= (temp - 1)) )
if ( (static_cast<uint128_t>(min) >= (temp - 1)) ||
(static_cast<uint128_t>(max) >= (temp - 1)) )
{
return false;
}
@ -1055,7 +1055,7 @@ bool ExtentMap::isValidCPRange(const T& max, const T& min, execplan::CalpontSyst
}
else
{
if (typeid(T) != typeid(__int128))
if (typeid(T) != typeid(int128_t))
{
if ( (min <= (numeric_limits<int64_t>::min() + 1)) ||
(max <= (numeric_limits<int64_t>::min() + 1)) )
@ -1065,7 +1065,7 @@ bool ExtentMap::isValidCPRange(const T& max, const T& min, execplan::CalpontSyst
}
else
{
__int128 temp;
int128_t temp;
utils::int128Min(temp);
if ( (min <= (temp + 1)) ||
@ -1105,9 +1105,9 @@ int ExtentMap::getMaxMin(const LBID_t lbid,
}
#endif
if (typeid(T) == typeid(__int128))
if (typeid(T) == typeid(int128_t))
{
__int128 tmpMax, tmpMin;
int128_t tmpMax, tmpMin;
utils::int128Min(tmpMax);
utils::int128Max(tmpMin);
max = tmpMax;
@ -1143,7 +1143,7 @@ int ExtentMap::getMaxMin(const LBID_t lbid,
if (lbid >= fExtentMap[i].range.start && lbid <= lastBlock)
{
if (typeid(T) == typeid(__int128))
if (typeid(T) == typeid(int128_t))
{
max = fExtentMap[i].partition.cprange.bigHiVal;
min = fExtentMap[i].partition.cprange.bigLoVal;
@ -6059,7 +6059,7 @@ void ExtentMap::dumpTo(ostream& os)
*/
template
int ExtentMap::getMaxMin<__int128>(const LBID_t lbidRange, __int128& max, __int128& min, int32_t& seqNum);
int ExtentMap::getMaxMin<int128_t>(const LBID_t lbidRange, int128_t& max, int128_t& min, int32_t& seqNum);
template
int ExtentMap::getMaxMin<int64_t>(const LBID_t lbidRange, int64_t& max, int64_t& min, int32_t& seqNum);

View File

@ -137,17 +137,17 @@ struct EMCasualPartition_struct
char isValid; //CP_INVALID - No min/max and no DML in progress. CP_UPDATING - Update in progress. CP_VALID- min/max is valid
union
{
__int128 bigLoVal; // These need to be reinterpreted as unsigned for uint64_t/uint128_t column types.
int128_t bigLoVal; // These need to be reinterpreted as unsigned for uint64_t/uint128_t column types.
int64_t loVal;
};
union
{
__int128 bigHiVal;
int128_t bigHiVal;
int64_t hiVal;
};
EXPORT EMCasualPartition_struct();
EXPORT EMCasualPartition_struct(const int64_t lo, const int64_t hi, const int32_t seqNum);
EXPORT EMCasualPartition_struct(const __int128 bigLo, const __int128 bigHi, const int32_t seqNum);
EXPORT EMCasualPartition_struct(const int128_t bigLo, const int128_t bigHi, const int32_t seqNum);
EXPORT EMCasualPartition_struct(const EMCasualPartition_struct& em);
EXPORT EMCasualPartition_struct& operator= (const EMCasualPartition_struct& em);
};

View File

@ -1330,7 +1330,7 @@ void SlaveComm::do_setExtentsMaxMin(ByteStream& msg)
uint64_t tmp64;
uint32_t tmp32;
uint8_t tmp8;
unsigned __int128 tmp128;
uint128_t tmp128;
int err;
ByteStream reply;
int32_t updateCount;