1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +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

@ -32,10 +32,6 @@ typedef int32_t mcs_sint32_t;
#endif
using int128_t = __int128;
using uint128_t = unsigned __int128;
// Because including my_sys.h in a Columnstore header causes too many conflicts
struct charset_info_st;
typedef const struct charset_info_st CHARSET_INFO;

View File

@ -21,11 +21,10 @@
#include <cstdint>
#include <cfloat>
#include <limits>
#include "mcs_basic_types.h"
#include "exceptclasses.h"
#include "widedecimalutils.h"
using int128_t = __int128;
using uint128_t = unsigned __int128;
namespace datatypes
{

View File

@ -39,6 +39,7 @@
#include <iosfwd>
#include <limits>
#include "mcs_basic_types.h"
#include "../../writeengine/shared/we_typeext.h"
#include "columnresult.h"
#include "bytestream.h"

View File

@ -731,12 +731,12 @@ void BatchPrimitiveProcessorJL::deserializeAggregateResult(ByteStream* in,
}
void BatchPrimitiveProcessorJL::getRowGroupData(ByteStream& in, vector<RGData>* out,
bool* validCPData, uint64_t* lbid, __int128* min, __int128* max,
bool* validCPData, uint64_t* lbid, int128_t* min, int128_t* max,
uint32_t* cachedIO, uint32_t* physIO, uint32_t* touchedBlocks, bool* countThis,
uint32_t threadID, bool* hasWideColumn, const execplan::CalpontSystemCatalog::ColType& colType) const
{
uint64_t tmp64;
unsigned __int128 tmp128;
uint128_t tmp128;
uint8_t tmp8;
RGData rgData;
uint32_t rowCount;

View File

@ -37,6 +37,7 @@
#include <boost/scoped_ptr.hpp>
#include <boost/uuid/uuid.hpp>
#include "mcs_basic_types.h"
#include "primitivemsg.h"
#include "serializeable.h"
#include "primitivestep.h"
@ -168,7 +169,7 @@ public:
void deserializeAggregateResults(messageqcpp::ByteStream* in,
std::vector<rowgroup::RGData>* out) const;
void getRowGroupData(messageqcpp::ByteStream& in, std::vector<rowgroup::RGData>* out,
bool* validCPData, uint64_t* lbid, __int128* min, __int128* max,
bool* validCPData, uint64_t* lbid, int128_t* min, int128_t* max,
uint32_t* cachedIO, uint32_t* physIO, uint32_t* touchedBlocks, bool* countThis,
uint32_t threadID, bool* hasBinaryColumn, const execplan::CalpontSystemCatalog::ColType& colType) const;
void deserializeAggregateResult(messageqcpp::ByteStream* in,

View File

@ -236,7 +236,7 @@ bool LBIDList::GetMinMax(T& min, T& max, int64_t& seq, int64_t lbid,
if (isUnsigned(colDataType))
{
if (typeid(T) == typeid(__int128))
if (typeid(T) == typeid(int128_t))
{
mmp->bigMax = 0;
mmp->bigMin = -1;
@ -249,7 +249,7 @@ bool LBIDList::GetMinMax(T& min, T& max, int64_t& seq, int64_t lbid,
}
else
{
if (typeid(T) == typeid(__int128))
if (typeid(T) == typeid(int128_t))
{
utils::int128Min(mmp->bigMax);
utils::int128Max(mmp->bigMin);
@ -296,7 +296,7 @@ bool LBIDList::GetMinMax(T* min, T* max, int64_t* seq,
if (isUnsigned(colDataType))
{
if (typeid(T) == typeid(__int128))
if (typeid(T) == typeid(int128_t))
{
mmp->bigMax = 0;
mmp->bigMin = -1;
@ -309,7 +309,7 @@ bool LBIDList::GetMinMax(T* min, T* max, int64_t* seq,
}
else
{
if (typeid(T) == typeid(__int128))
if (typeid(T) == typeid(int128_t))
{
utils::int128Min(mmp->bigMax);
utils::int128Max(mmp->bigMin);
@ -327,7 +327,7 @@ bool LBIDList::GetMinMax(T* min, T* max, int64_t* seq,
return false;
}
if (typeid(T) == typeid(__int128))
if (typeid(T) == typeid(int128_t))
{
*min = entry.partition.cprange.bigLoVal;
*max = entry.partition.cprange.bigHiVal;
@ -356,7 +356,7 @@ int LBIDList::getMinMaxFromEntries(T& min, T& max, int32_t& seq,
if (lbid >= EMEntries[i].range.start && lbid <= lastLBID)
{
if (typeid(T) == typeid(__int128))
if (typeid(T) == typeid(int128_t))
{
min = EMEntries[i].partition.cprange.bigLoVal;
max = EMEntries[i].partition.cprange.bigHiVal;
@ -426,12 +426,12 @@ void LBIDList::UpdateMinMax(T min, T max, int64_t lbid, CalpontSystemCatalog::Co
}
else if (datatypes::isUnsigned(type))
{
if (typeid(T) == typeid(__int128))
if (typeid(T) == typeid(int128_t))
{
if (static_cast<unsigned __int128>(min) < static_cast<unsigned __int128>(mmp->bigMin))
if (static_cast<uint128_t>(min) < static_cast<uint128_t>(mmp->bigMin))
mmp->bigMin = min;
if (static_cast<unsigned __int128>(max) > static_cast<unsigned __int128>(mmp->bigMax))
if (static_cast<uint128_t>(max) > static_cast<uint128_t>(mmp->bigMax))
mmp->bigMax = max;
}
else
@ -445,7 +445,7 @@ void LBIDList::UpdateMinMax(T min, T max, int64_t lbid, CalpontSystemCatalog::Co
}
else
{
if (typeid(T) == typeid(__int128))
if (typeid(T) == typeid(int128_t))
{
if (min < mmp->bigMin)
mmp->bigMin = min;
@ -686,7 +686,7 @@ bool LBIDList::checkSingleValue(T min, T max, T value,
if (isCharType(type))
{
// MCOL-641 LBIDList::CasualPartitionDataType() returns false if
// width > 8 for a character type, so T cannot be __int128 here
// width > 8 for a character type, so T cannot be int128_t here
uint64_t mmin = order_swap(min);
uint64_t mmax = order_swap(max);
uint64_t vvalue = order_swap(value);
@ -694,10 +694,10 @@ bool LBIDList::checkSingleValue(T min, T max, T value,
}
else if (isUnsigned(type))
{
if (typeid(T) == typeid(__int128))
if (typeid(T) == typeid(int128_t))
{
return (static_cast<unsigned __int128>(value) >= static_cast<unsigned __int128>(min) &&
static_cast<unsigned __int128>(value) <= static_cast<unsigned __int128>(max));
return (static_cast<uint128_t>(value) >= static_cast<uint128_t>(min) &&
static_cast<uint128_t>(value) <= static_cast<uint128_t>(max));
}
else
{
@ -718,7 +718,7 @@ bool LBIDList::checkRangeOverlap(T min, T max, T tmin, T tmax,
if (isCharType(type))
{
// MCOL-641 LBIDList::CasualPartitionDataType() returns false if
// width > 8 for a character type, so T cannot be __int128 here
// width > 8 for a character type, so T cannot be int128_t here
uint64_t min2 = order_swap(min);
uint64_t max2 = order_swap(max);
uint64_t tmin2 = order_swap(tmin);
@ -727,10 +727,10 @@ bool LBIDList::checkRangeOverlap(T min, T max, T tmin, T tmax,
}
else if (isUnsigned(type))
{
if (typeid(T) == typeid(__int128))
if (typeid(T) == typeid(int128_t))
{
return (static_cast<unsigned __int128>(tmin) <= static_cast<unsigned __int128>(max) &&
static_cast<unsigned __int128>(tmax) >= static_cast<unsigned __int128>(min));
return (static_cast<uint128_t>(tmin) <= static_cast<uint128_t>(max) &&
static_cast<uint128_t>(tmax) >= static_cast<uint128_t>(min));
}
else
{
@ -755,7 +755,7 @@ bool LBIDList::CasualPartitionPredicate(const BRM::EMCasualPartition_t& cpRange,
const char* MsgDataPtr = (const char*) bs->buf();
bool scan = true;
int64_t value = 0;
__int128 bigValue = 0;
int128_t bigValue = 0;
bool bIsUnsigned = datatypes::isUnsigned(ct.colDataType);
bool bIsChar = datatypes::isCharType(ct.colDataType);
@ -891,7 +891,7 @@ bool LBIDList::CasualPartitionPredicate(const BRM::EMCasualPartition_t& cpRange,
}
else
{
scan = compareVal(static_cast<unsigned __int128>(cpRange.bigLoVal), static_cast<unsigned __int128>(cpRange.bigHiVal), static_cast<unsigned __int128>(bigValue), op, lcf);
scan = compareVal(static_cast<uint128_t>(cpRange.bigLoVal), static_cast<uint128_t>(cpRange.bigHiVal), static_cast<uint128_t>(bigValue), op, lcf);
}
}
else
@ -959,7 +959,7 @@ void LBIDList::copyLbidList(const LBIDList& rhs)
}
template
bool LBIDList::GetMinMax<__int128>(__int128& min, __int128& max, int64_t& seq, int64_t lbid,
bool LBIDList::GetMinMax<int128_t>(int128_t& min, int128_t& max, int64_t& seq, int64_t lbid,
const std::vector<struct BRM::EMEntry>* pEMEntries,
execplan::CalpontSystemCatalog::ColDataType colDataType);
template
@ -968,7 +968,7 @@ bool LBIDList::GetMinMax<int64_t>(int64_t& min, int64_t& max, int64_t& seq, int6
execplan::CalpontSystemCatalog::ColDataType colDataType);
template
bool LBIDList::GetMinMax<__int128>(__int128* min, __int128* max, int64_t* seq,
bool LBIDList::GetMinMax<int128_t>(int128_t* min, int128_t* max, int64_t* seq,
int64_t lbid, const tr1::unordered_map<int64_t, BRM::EMEntry>& entries,
execplan::CalpontSystemCatalog::ColDataType colDataType);
@ -978,7 +978,7 @@ bool LBIDList::GetMinMax<int64_t>(int64_t* min, int64_t* max, int64_t* seq,
execplan::CalpontSystemCatalog::ColDataType colDataType);
template
void LBIDList::UpdateMinMax<__int128>(__int128 min, __int128 max, int64_t lbid,
void LBIDList::UpdateMinMax<int128_t>(int128_t min, int128_t max, int64_t lbid,
execplan::CalpontSystemCatalog::ColDataType type, bool validData = true);
template
@ -986,7 +986,7 @@ void LBIDList::UpdateMinMax<int64_t>(int64_t min, int64_t max, int64_t lbid,
execplan::CalpontSystemCatalog::ColDataType type, bool validData = true);
template
bool LBIDList::checkSingleValue<__int128>(__int128 min, __int128 max, __int128 value,
bool LBIDList::checkSingleValue<int128_t>(int128_t min, int128_t max, int128_t value,
execplan::CalpontSystemCatalog::ColDataType type);
template
@ -994,7 +994,7 @@ bool LBIDList::checkSingleValue<int64_t>(int64_t min, int64_t max, int64_t value
execplan::CalpontSystemCatalog::ColDataType type);
template
bool LBIDList::checkRangeOverlap<__int128>(__int128 min, __int128 max, __int128 tmin, __int128 tmax,
bool LBIDList::checkRangeOverlap<int128_t>(int128_t min, int128_t max, int128_t tmin, int128_t tmax,
execplan::CalpontSystemCatalog::ColDataType type);
template

View File

@ -55,12 +55,12 @@ struct MinMaxPartition
uint32_t blksScanned;
union
{
__int128 bigMin;
int128_t bigMin;
int64_t min;
};
union
{
__int128 bigMax;
int128_t bigMax;
int64_t max;
};
};

View File

@ -46,6 +46,7 @@
#include <boost/thread.hpp>
#include <boost/thread/condition.hpp>
#include "mcs_basic_types.h"
#include "calpontsystemcatalog.h"
#include "calpontselectexecutionplan.h"
#include "brm.h"
@ -1327,7 +1328,7 @@ public:
* Note that it is an adder not a setter. For an extent to be scanned, all calls
* must have a non-empty intersection.
*/
void addCPPredicates(uint32_t OID, const std::vector<__int128>& vals, bool isRange,
void addCPPredicates(uint32_t OID, const std::vector<int128_t>& vals, bool isRange,
bool isSmallSideWideDecimal);
/* semijoin adds */

View File

@ -927,7 +927,7 @@ void TupleBPS::prepCasualPartitioning()
{
uint32_t i;
int64_t min, max, seq;
__int128 bigMin, bigMax;
int128_t bigMin, bigMax;
boost::mutex::scoped_lock lk(cpMutex);
for (i = 0; i < scannedExtents.size(); i++)
@ -1889,15 +1889,15 @@ abort:
struct _CPInfo
{
_CPInfo(int64_t MIN, int64_t MAX, uint64_t l, bool val) : min(MIN), max(MAX), LBID(l), valid(val) { };
_CPInfo(__int128 BIGMIN, __int128 BIGMAX, uint64_t l, bool val) : bigMin(BIGMIN), bigMax(BIGMAX), LBID(l), valid(val) { };
_CPInfo(int128_t BIGMIN, int128_t BIGMAX, uint64_t l, bool val) : bigMin(BIGMIN), bigMax(BIGMAX), LBID(l), valid(val) { };
union
{
__int128 bigMin;
int128_t bigMin;
int64_t min;
};
union
{
__int128 bigMax;
int128_t bigMax;
int64_t max;
};
uint64_t LBID;
@ -1918,8 +1918,8 @@ void TupleBPS::receiveMultiPrimitiveMessages(uint32_t threadID)
bool validCPData;
bool hasBinaryColumn;
__int128 min;
__int128 max;
int128_t min;
int128_t max;
uint64_t lbid;
vector<_CPInfo> cpv;
uint32_t cachedIO;
@ -3212,7 +3212,7 @@ void TupleBPS::setJoinFERG(const RowGroup& rg)
fBPP->setJoinFERG(rg);
}
void TupleBPS::addCPPredicates(uint32_t OID, const vector<__int128>& vals, bool isRange,
void TupleBPS::addCPPredicates(uint32_t OID, const vector<int128_t>& vals, bool isRange,
bool isSmallSideWideDecimal)
{
@ -3221,7 +3221,7 @@ void TupleBPS::addCPPredicates(uint32_t OID, const vector<__int128>& vals, bool
uint32_t i, j, k;
int64_t min, max, seq;
__int128 bigMin, bigMax;
int128_t bigMin, bigMax;
bool isValid, intersection;
vector<SCommand> colCmdVec = fBPP->getFilterSteps();
ColumnCommandJL* cmd;
@ -3292,7 +3292,7 @@ void TupleBPS::addCPPredicates(uint32_t OID, const vector<__int128>& vals, bool
}
else
{
runtimeCPFlags[j] = ll.checkRangeOverlap((__int128) min, (__int128) max, vals[0], vals[1],
runtimeCPFlags[j] = ll.checkRangeOverlap((int128_t) min, (int128_t) max, vals[0], vals[1],
colType.colDataType) && runtimeCPFlags[j];
}
}
@ -3310,7 +3310,7 @@ void TupleBPS::addCPPredicates(uint32_t OID, const vector<__int128>& vals, bool
else
{
intersection = intersection ||
ll.checkSingleValue((__int128) min, (__int128) max, vals[k], colType.colDataType);
ll.checkSingleValue((int128_t) min, (int128_t) max, vals[k], colType.colDataType);
}
}

View File

@ -56,6 +56,7 @@ using namespace std;
#include <boost/regex.hpp>
#include <boost/thread.hpp>
#include "mcs_basic_types.h"
#include "idb_mysql.h"
#define NEED_CALPONT_INTERFACE
@ -145,7 +146,6 @@ namespace cal_impl_if
extern bool nonConstFunc(Item_func* ifp);
}
using int128_t = __int128;
namespace
{

View File

@ -16,9 +16,8 @@
MA 02110-1301, USA. */
#include <gtest/gtest.h> // googletest header file
#include "mcs_basic_types.h"
using int128_t = __int128;
using uint128_t = unsigned __int128;
//using CSCDataType = execplan::CalpontSystemCatalog::ColDataType;
TEST(SimpleCheck, check1)

View File

@ -42,7 +42,6 @@
#define DEBUG
#define MEMORY_LIMIT 14983602176
using int128_t = __int128;
using namespace std;
using namespace joblist;
using namespace messageqcpp;

View File

@ -26,8 +26,6 @@
#define WIDE_DEC_PRECISION 38U
#define INITIAL_ROW_OFFSET 2
using int128_t = __int128;
using uint128_t = unsigned __int128;
using CSCDataType = execplan::CalpontSystemCatalog::ColDataType;
class RowDecimalTest : public ::testing::Test

View File

@ -12,6 +12,7 @@
#include <stdint.h>
#include <stdexcept>
#include <cstring>
#include "mcs_basic_types.h"
namespace static_any
{
@ -127,8 +128,8 @@ namespace anyimpl
#define BIG_POLICY(TYPE) template<> struct \
choose_policy<TYPE> { typedef big_any_policy<TYPE> type; };
BIG_POLICY(__int128);
BIG_POLICY(unsigned __int128);
BIG_POLICY(int128_t);
BIG_POLICY(uint128_t);
/// Specializations for small types.
#define SMALL_POLICY(TYPE) template<> struct \

View File

@ -29,9 +29,7 @@
#include <stdint.h>
#include <string.h>
using int128_t = __int128;
using uint128_t = unsigned __int128;
#include "mcs_basic_types.h"
namespace utils
{

View File

@ -0,0 +1,28 @@
/*
Copyright (C) 2020 MariaDB Corporation
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA.
*/
#ifndef MCS_BASIC_TYPES_H_INCLUDED
#define MCS_BASIC_TYPES_H_INCLUDED
using int128_t = __int128;
using uint128_t = unsigned __int128;
#endif // MCS_BASIC_TYPES_H_INCLUDED
// vim:ts=2 sw=2:

View File

@ -19,9 +19,7 @@
#define WIDE_DECIMAL_UTILS_H
#include <cstdint>
using int128_t = __int128;
using uint128_t = unsigned __int128;
#include "mcs_basic_types.h"
namespace utils
{

View File

@ -160,10 +160,6 @@ const int32_t MIN_TIMESTAMP_VALUE = 0;
namespace dataconvert
{
// WIP MCOL-641
using int128_t = __int128;
using uint128_t = unsigned __int128;
enum CalpontDateTimeFormat
{
CALPONTDATE_ENUM = 1, // date format is: "YYYY-MM-DD"
@ -1474,7 +1470,7 @@ inline bool greaterThan128(int128_t a, int128_t b)
return a > b;
}
// Naive __int128 version of strtoll
// Naive int128_t version of strtoll
inline int128_t strtoll128(const char* data, bool& saturate, char** ep)
{
int128_t res = 0;

View File

@ -33,6 +33,7 @@
#include <stdint.h>
#include <cstring>
#include "mcs_basic_types.h"
#include "exceptclasses.h"
#include "serializeable.h"
#include "any.hpp"
@ -45,8 +46,6 @@ class ByteStreamTestSuite;
#define EXPORT
#endif
using int128_t = __int128;
using uint128_t = unsigned __int128;
namespace messageqcpp
{

View File

@ -238,13 +238,13 @@ const static_any::any& RowAggregation::shortTypeId((short)1);
const static_any::any& RowAggregation::intTypeId((int)1);
const static_any::any& RowAggregation::longTypeId((long)1);
const static_any::any& RowAggregation::llTypeId((long long)1);
const static_any::any& RowAggregation::int128TypeId((__int128)1);
const static_any::any& RowAggregation::int128TypeId((int128_t)1);
const static_any::any& RowAggregation::ucharTypeId((unsigned char)1);
const static_any::any& RowAggregation::ushortTypeId((unsigned short)1);
const static_any::any& RowAggregation::uintTypeId((unsigned int)1);
const static_any::any& RowAggregation::ulongTypeId((unsigned long)1);
const static_any::any& RowAggregation::ullTypeId((unsigned long long)1);
const static_any::any& RowAggregation::uint128TypeId((unsigned __int128)1);
const static_any::any& RowAggregation::uint128TypeId((uint128_t)1);
const static_any::any& RowAggregation::floatTypeId((float)1);
const static_any::any& RowAggregation::doubleTypeId((double)1);
const static_any::any& RowAggregation::longdoubleTypeId((long double)1);

View File

@ -26,8 +26,6 @@
#define WIDE_DEC_PRECISION 38U
#define INITIAL_ROW_OFFSET 2
using int128_t = __int128;
using uint128_t = unsigned __int128;
using CSCDataType = execplan::CalpontSystemCatalog::ColDataType;
class RowDecimalTest : public ::testing::Test {

View File

@ -65,9 +65,6 @@ typedef const struct charset_info_st CHARSET_INFO;
// Workaround for my_global.h #define of isnan(X) causing a std::std namespace
using int128_t = __int128;
using uint128_t = unsigned __int128;
namespace rowgroup
{

View File

@ -18,6 +18,7 @@
#include <sstream>
#include <cstring>
#include <stdexcept>
#include "mcs_basic_types.h"
#include "mcsv1_udaf.h"
#include "bytestream.h"
#include "objectreader.h"
@ -278,13 +279,13 @@ const static_any::any& mcsv1_UDAF::shortTypeId((short)1);
const static_any::any& mcsv1_UDAF::intTypeId((int)1);
const static_any::any& mcsv1_UDAF::longTypeId((long)1);
const static_any::any& mcsv1_UDAF::llTypeId((long long)1);
const static_any::any& mcsv1_UDAF::int128TypeId((__int128)1);
const static_any::any& mcsv1_UDAF::int128TypeId((int128_t)1);
const static_any::any& mcsv1_UDAF::ucharTypeId((unsigned char)1);
const static_any::any& mcsv1_UDAF::ushortTypeId((unsigned short)1);
const static_any::any& mcsv1_UDAF::uintTypeId((unsigned int)1);
const static_any::any& mcsv1_UDAF::ulongTypeId((unsigned long)1);
const static_any::any& mcsv1_UDAF::ullTypeId((unsigned long long)1);
const static_any::any& mcsv1_UDAF::uint128TypeId((unsigned __int128)1);
const static_any::any& mcsv1_UDAF::uint128TypeId((uint128_t)1);
const static_any::any& mcsv1_UDAF::floatTypeId((float)1);
const static_any::any& mcsv1_UDAF::doubleTypeId((double)1);
const static_any::any& mcsv1_UDAF::strTypeId(typeStr);

View File

@ -48,9 +48,6 @@ using namespace rowgroup;
#include "joblisttypes.h"
#include "mcs_decimal.h"
using int128_t = __int128;
#include "collation.h"
// See agg_arg_charsets in sql_type.h to see conversion rules for

View File

@ -544,13 +544,13 @@ void WF_udaf::SetUDAFValue(static_any::any& valOut, int64_t colOut,
static const static_any::any& intTypeId = (int)1;
static const static_any::any& longTypeId = (long)1;
static const static_any::any& llTypeId = (long long)1;
static const static_any::any& int128TypeId = (__int128)1;
static const static_any::any& int128TypeId = (int128_t)1;
static const static_any::any& ucharTypeId = (unsigned char)1;
static const static_any::any& ushortTypeId = (unsigned short)1;
static const static_any::any& uintTypeId = (unsigned int)1;
static const static_any::any& ulongTypeId = (unsigned long)1;
static const static_any::any& ullTypeId = (unsigned long long)1;
static const static_any::any& uint128TypeId = (unsigned __int128)1;
static const static_any::any& uint128TypeId = (uint128_t)1;
static const static_any::any& floatTypeId = (float)1;
static const static_any::any& doubleTypeId = (double)1;
static const std::string typeStr("");

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;

View File

@ -302,7 +302,7 @@ void BulkLoadBuffer::convert(char* field, int fieldLength,
int32_t iDate;
char charTmpBuf[MAX_COLUMN_BOUNDARY + 1] = {0};
long long llVal = 0, llDate = 0;
__int128 bigllVal = 0;
int128_t bigllVal = 0;
uint64_t tmp64;
uint32_t tmp32;
uint8_t ubiVal;

View File

@ -45,12 +45,12 @@ public:
int64_t satCount;
union
{
__int128 bigMinBufferVal;
int128_t bigMinBufferVal;
int64_t minBufferVal_;
};
union
{
__int128 bigMaxBufferVal;
int128_t bigMaxBufferVal;
int64_t maxBufferVal_;
};
BLBufferStats(ColDataType colDataType) : satCount(0)

View File

@ -92,7 +92,7 @@ void ColExtInf::addOrUpdateEntryTemplate( RID lastInputRow,
// If all rows had null value for this column, then minVal will be
// MAX_INT and maxVal will be MIN_INT (see getCPInfoForBRM()).
__int128 bigMinValInit;
int128_t bigMinValInit;
utils::int128Max(bigMinValInit);
if ((iter->second.fMinVal == LLONG_MIN && width <= 8) ||
(iter->second.fbigMinVal == bigMinValInit && width > 8)) // init the range
@ -124,12 +124,12 @@ void ColExtInf::addOrUpdateEntryTemplate( RID lastInputRow,
}
else
{
if (static_cast<unsigned __int128>(minVal)
< static_cast<unsigned __int128>(iter->second.fbigMinVal))
if (static_cast<uint128_t>(minVal)
< static_cast<uint128_t>(iter->second.fbigMinVal))
iter->second.fbigMinVal = minVal;
if (static_cast<unsigned __int128>(maxVal)
> static_cast<unsigned __int128>(iter->second.fbigMaxVal))
if (static_cast<uint128_t>(maxVal)
> static_cast<uint128_t>(iter->second.fbigMaxVal))
iter->second.fbigMaxVal = maxVal;
}
}
@ -214,8 +214,8 @@ void ColExtInf::getCPInfoForBRM( JobColumn column, BRMReporter& brmReporter )
// if applicable (indicating an extent with no non-NULL values).
int64_t minVal = iter->second.fMinVal;
int64_t maxVal = iter->second.fMaxVal;
__int128 bigMinVal = iter->second.fbigMinVal;
__int128 bigMaxVal = iter->second.fbigMaxVal;
int128_t bigMinVal = iter->second.fbigMinVal;
int128_t bigMaxVal = iter->second.fbigMaxVal;
if ( bIsChar )
{

View File

@ -88,7 +88,7 @@ public:
fNewExtent(true) { }
// Used to create entry for a new extent, with LBID not yet allocated
ColExtInfEntry(__int128 bigMinVal, __int128 bigMaxVal) :
ColExtInfEntry(int128_t bigMinVal, int128_t bigMaxVal) :
fLbid(INVALID_LBID),
fNewExtent(true),
fbigMinVal(bigMinVal),
@ -102,11 +102,11 @@ public:
fNewExtent(true) { }
// Used to create entry for a new extent, with LBID not yet allocated
ColExtInfEntry(unsigned __int128 bigMinVal, unsigned __int128 bigMaxVal) :
ColExtInfEntry(uint128_t bigMinVal, uint128_t bigMaxVal) :
fLbid(INVALID_LBID),
fNewExtent(true),
fbigMinVal(static_cast<__int128>(bigMinVal)),
fbigMaxVal(static_cast<__int128>(bigMaxVal)) { }
fbigMinVal(static_cast<int128_t>(bigMinVal)),
fbigMaxVal(static_cast<int128_t>(bigMaxVal)) { }
BRM::LBID_t fLbid; // LBID for an extent; should be the starting LBID
int64_t fMinVal; // minimum value for extent associated with LBID
@ -114,12 +114,12 @@ public:
bool fNewExtent;// is this a new extent
union
{
__int128 fbigMinVal;
int128_t fbigMinVal;
int64_t fMinVal_;
};
union
{
__int128 fbigMaxVal;
int128_t fbigMaxVal;
int64_t fMaxVal_;
};
};
@ -159,8 +159,8 @@ public:
int width ) { }
virtual void addOrUpdateEntry( RID lastInputRow,
__int128 minVal,
__int128 maxVal,
int128_t minVal,
int128_t maxVal,
ColDataType colDataType,
int width ) { }
@ -231,7 +231,7 @@ public:
}
virtual void addOrUpdateEntry( RID lastInputRow,
__int128 minVal, __int128 maxVal,
int128_t minVal, int128_t maxVal,
ColDataType colDataType,
int width )
{

View File

@ -57,7 +57,6 @@ typedef uint32_t FID; /** @brief File ID */
typedef uint64_t RID; /** @brief Row ID */
typedef uint32_t TxnID; /** @brief Transaction ID (New)*/
typedef uint32_t HWM; /** @brief high water mark */
typedef unsigned __int128 uint128_t;
/************************************************************************
* Type enumerations

View File

@ -56,8 +56,6 @@ struct RefcolInfo
unsigned numExtents;
};
using int128_t = __int128;
using uint128_t = unsigned __int128;
/**
* Constructor