diff --git a/.drone.jsonnet b/.drone.jsonnet index 882c3d70a..399ba1549 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -25,9 +25,9 @@ local platformMap(branch, platform) = }; local platform_map = { - 'opensuse/leap:15': 'zypper ' + rpm_build_deps + ' cmake libboost_system-devel libboost_filesystem-devel libboost_thread-devel libboost_regex-devel libboost_date_time-devel libboost_chrono-devel libboost_atomic-devel libquadmath0 && cmake ' + cmakeflags + branch_cmakeflags_map[branch] + ' -DRPM=sles15 && make -j$(nproc) package', - 'centos:7': 'yum install -y epel-release && yum install -y cmake3 && ln -s /usr/bin/cmake3 /usr/bin/cmake && yum ' + rpm_build_deps + ' libquadmath && cmake ' + cmakeflags + branch_cmakeflags_map[branch] + ' -DRPM=centos7 && make -j$(nproc) package', - 'centos:8': "yum install -y libgcc && sed -i 's/enabled=0/enabled=1/' /etc/yum.repos.d/CentOS-PowerTools.repo && yum " + rpm_build_deps + ' cmake libquadmath && cmake ' + cmakeflags + branch_cmakeflags_map[branch] + ' -DRPM=centos8 && make -j$(nproc) package', + 'opensuse/leap:15': 'zypper ' + rpm_build_deps + ' cmake libboost_system-devel libboost_filesystem-devel libboost_thread-devel libboost_regex-devel libboost_date_time-devel libboost_chrono-devel libboost_atomic-devel gcc-fortran && cmake ' + cmakeflags + branch_cmakeflags_map[branch] + ' -DRPM=sles15 && make -j$(nproc) package', + 'centos:7': 'yum install -y epel-release && yum install -y cmake3 && ln -s /usr/bin/cmake3 /usr/bin/cmake && yum ' + rpm_build_deps + ' libquadmath libquadmath-devel && cmake ' + cmakeflags + branch_cmakeflags_map[branch] + ' -DRPM=centos7 && make -j$(nproc) package', + 'centos:8': "yum install -y libgcc && sed -i 's/enabled=0/enabled=1/' /etc/yum.repos.d/CentOS-PowerTools.repo && yum " + rpm_build_deps + ' cmake libquadmath libquadmath-devel && cmake ' + cmakeflags + branch_cmakeflags_map[branch] + ' -DRPM=centos8 && make -j$(nproc) package', 'debian:9': deb_build_deps + " && CMAKEFLAGS='" + cmakeflags + branch_cmakeflags_map[branch] + " -DDEB=stretch' debian/autobake-deb.sh", 'debian:10': deb_build_deps + " && CMAKEFLAGS='" + cmakeflags + branch_cmakeflags_map[branch] + " -DDEB=buster' debian/autobake-deb.sh", 'ubuntu:16.04': deb_build_deps + " && CMAKEFLAGS='" + cmakeflags + branch_cmakeflags_map[branch] + " -DDEB=xenial' debian/autobake-deb.sh", diff --git a/datatypes/mcs_datatype.cpp b/datatypes/mcs_datatype.cpp index fdbf149f4..493d64fd9 100644 --- a/datatypes/mcs_datatype.cpp +++ b/datatypes/mcs_datatype.cpp @@ -346,13 +346,13 @@ TypeHandler::find(SystemCatalog::ColDataType typeCode, case SystemCatalog::UDOUBLE: return &mcs_type_handler_udouble; case SystemCatalog::DECIMAL: - if (ct.colWidth < datatypes::MAXDECIMALWIDTH) + if (static_cast(ct.colWidth) < datatypes::MAXDECIMALWIDTH) return &mcs_type_handler_sdecimal64; else return &mcs_type_handler_sdecimal128; case SystemCatalog::UDECIMAL: - if (ct.colWidth < datatypes::MAXDECIMALWIDTH) + if (static_cast(ct.colWidth) < datatypes::MAXDECIMALWIDTH) return &mcs_type_handler_udecimal64; else return &mcs_type_handler_udecimal128; @@ -1303,7 +1303,7 @@ TypeHandlerStr::toSimpleValue(const SessionParam &sp, /****************************************************************************/ MinMaxPartitionInfo::MinMaxPartitionInfo(const BRM::EMEntry &entry) - :m_status(entry.status == BRM::EXTENTOUTOFSERVICE ? ET_DISABLED : 0) + :m_status(entry.status == BRM::EXTENTOUTOFSERVICE ? ET_DISABLED : EXPL_NULL) { } diff --git a/datatypes/mcs_datatype.h b/datatypes/mcs_datatype.h index a84bcce05..470950960 100644 --- a/datatypes/mcs_datatype.h +++ b/datatypes/mcs_datatype.h @@ -582,6 +582,7 @@ class MinMaxPartitionInfo: public MinMaxInfo { enum status_flag_t : uint64_t { + EXPL_NULL = 0x0000, ET_DISABLED = 0x0002, CPINVALID = 0x0004 }; diff --git a/datatypes/mcs_int128.h b/datatypes/mcs_int128.h index 1bab9171c..3d508420a 100644 --- a/datatypes/mcs_int128.h +++ b/datatypes/mcs_int128.h @@ -72,6 +72,7 @@ namespace datatypes { using int128_t = __int128; +using uint128_t = unsigned __int128; // Type traits @@ -90,6 +91,26 @@ struct is_allowed_numeric { static const bool value = true; }; +template +struct is_int128_t { + static const bool value = false; +}; + +template<> +struct is_int128_t { + static const bool value = true; +}; + +template +struct is_uint128_t { + static const bool value = false; +}; + +template<> +struct is_uint128_t { + static const bool value = true; +}; + // The method converts a __float128 s128Value to a double. static inline double getDoubleFromFloat128(const __float128& value) { diff --git a/dbcon/execplan/arithmeticoperator.h b/dbcon/execplan/arithmeticoperator.h index 96c7ad75c..042d47cd1 100644 --- a/dbcon/execplan/arithmeticoperator.h +++ b/dbcon/execplan/arithmeticoperator.h @@ -196,7 +196,7 @@ public: return TreeNode::getBoolVal(); } void adjustResultType(const CalpontSystemCatalog::ColType& m); - const inline bool getOverflowCheck() const + inline bool getOverflowCheck() const { return fDecimalOverflowCheck; } diff --git a/dbcon/execplan/calpontsystemcatalog.cpp b/dbcon/execplan/calpontsystemcatalog.cpp index 7ead90f9d..18b0fb7c5 100644 --- a/dbcon/execplan/calpontsystemcatalog.cpp +++ b/dbcon/execplan/calpontsystemcatalog.cpp @@ -6119,6 +6119,26 @@ CalpontSystemCatalog::ColType::ColType(const ColType& rhs) cs = rhs.cs; } +CalpontSystemCatalog::ColType& CalpontSystemCatalog::ColType::operator=(const ColType& rhs) +{ + TypeHolderStd::operator=(rhs); + constraintType = rhs.constraintType; + ddn = rhs.ddn; + defaultValue = rhs.defaultValue; + colPosition = rhs.colPosition; + compressionType = rhs.compressionType; + columnOID = rhs.columnOID; + autoincrement = rhs.autoincrement; + nextvalue = rhs.nextvalue; + charsetNumber = rhs.charsetNumber; + cs = rhs.cs; + + return *this; +} + + + + CHARSET_INFO* CalpontSystemCatalog::ColType::getCharset() { if (!cs) diff --git a/dbcon/execplan/treenode.h b/dbcon/execplan/treenode.h index 1b7fd316c..3d94a6e09 100644 --- a/dbcon/execplan/treenode.h +++ b/dbcon/execplan/treenode.h @@ -60,8 +60,7 @@ typedef execplan::CalpontSystemCatalog::ColType Type; class IDB_Decimal: public datatypes::VDecimal { public: - using datatypes::VDecimal::VDecimal; - + IDB_Decimal() = default; IDB_Decimal(int64_t val, int8_t s, uint8_t p, const int128_t &val128 = 0) : VDecimal(val, s, p, val128) {} diff --git a/dbcon/joblist/rowestimator.cpp b/dbcon/joblist/rowestimator.cpp index 78ef9c1bf..d40d15248 100644 --- a/dbcon/joblist/rowestimator.cpp +++ b/dbcon/joblist/rowestimator.cpp @@ -303,7 +303,7 @@ float RowEstimator::estimateRowReturnFactor(const BRM::EMEntry& emEntry, float factor = 1.0; float tempFactor = 1.0; - uint64_t adjustedMin, adjustedMax; + uint64_t adjustedMin = 0, adjustedMax = 0; uint128_t adjustedBigMin, adjustedBigMax; uint32_t distinctValuesEstimate; diff --git a/dbcon/joblist/tuple-bps.cpp b/dbcon/joblist/tuple-bps.cpp index ceee3e8f0..2d91f87de 100644 --- a/dbcon/joblist/tuple-bps.cpp +++ b/dbcon/joblist/tuple-bps.cpp @@ -1584,7 +1584,8 @@ bool TupleBPS::processSingleFilterString(int8_t BOP, int8_t colWidth, T val, con throw logic_error("invalid column width"); } - if (colWidth < datatypes::MAXDECIMALWIDTH) + // Assumption is that colWidth > 0 + if (static_cast(colWidth) < datatypes::MAXDECIMALWIDTH) thisPredicate = compareSingleValue(COP, (int64_t) val, val2); else thisPredicate = compareSingleValue(COP, (int128_t) val, bigVal2); diff --git a/debian/mariadb-plugin-columnstore.install b/debian/mariadb-plugin-columnstore.install index 3f4cc792b..b74b47b8f 100644 --- a/debian/mariadb-plugin-columnstore.install +++ b/debian/mariadb-plugin-columnstore.install @@ -121,6 +121,7 @@ usr/lib/*/libwindowfunction.so usr/lib/*/libwriteengine.so usr/lib/*/libwriteengineclient.so usr/lib/*/libwriteengineredistribute.so +usr/lib/*/libdatatypes.so usr/lib/mysql/plugin/ha_columnstore.so usr/lib/mysql/plugin/libregr_mysql.so usr/lib/mysql/plugin/libudf_mysql.so diff --git a/utils/common/checks.h b/utils/common/checks.h index 36b87312e..fb4a94e94 100644 --- a/utils/common/checks.h +++ b/utils/common/checks.h @@ -18,25 +18,33 @@ #define UTILS_COMMON_CHECKS_H #include +#include "mcs_int128.h" namespace utils { template -typename std::enable_if::value, bool>::type is_nonnegative(T) -{ return true; }; +typename std::enable_if::value || + datatypes::is_uint128_t::value, + bool>::type +is_nonnegative(T) { return true; }; template -typename std::enable_if::value, bool>::type is_nonnegative(T v) -{ return v >= 0; }; - +typename std::enable_if::value || + datatypes::is_int128_t::value, + bool>::type +is_nonnegative(T v) { return v >= 0; }; template -typename std::enable_if::value, bool>::type is_negative(T) -{ return false; }; +typename std::enable_if::value || + datatypes::is_uint128_t::value, + bool>::type +is_negative(T) { return false; }; template -typename std::enable_if::value, bool>::type is_negative(T v) -{ return v < 0; }; +typename std::enable_if::value || + datatypes::is_int128_t::value, + bool>::type +is_negative(T v) { return v < 0; }; } // namespace utils diff --git a/utils/funcexp/func_cast.cpp b/utils/funcexp/func_cast.cpp index aa0212a48..ef36bb320 100644 --- a/utils/funcexp/func_cast.cpp +++ b/utils/funcexp/func_cast.cpp @@ -383,7 +383,7 @@ uint64_t Func_cast_unsigned::getUintVal(Row& row, uint128_t tmpval = d.s128Value / scaleDivisor; int128_t lefto = (d.s128Value - tmpval * scaleDivisor) / scaleDivisor2; - if (tmpval >= 0 && lefto > 4) + if (utils::is_nonnegative(tmpval) && lefto > 4) tmpval++; if (tmpval > static_cast(UINT64_MAX)) @@ -404,7 +404,9 @@ uint64_t Func_cast_unsigned::getUintVal(Row& row, int lefto = (d.value - value * pow(10.0, dscale)) / pow(10.0, dscale - 1); if ( utils::is_nonnegative(value) && lefto > 4 ) + { value++; + } return value; } diff --git a/utils/funcexp/func_elt.cpp b/utils/funcexp/func_elt.cpp index b3bf6a3b3..c9c811d6c 100644 --- a/utils/funcexp/func_elt.cpp +++ b/utils/funcexp/func_elt.cpp @@ -86,10 +86,10 @@ string Func_elt::getStrVal(rowgroup::Row& row, int128_t tmpval = d.s128Value / scaleDivisor; int128_t lefto = (d.s128Value - tmpval * scaleDivisor) / scaleDivisor2; - if (utils::is_nonnegative(tmpval) >= 0 && lefto > 4) + if (utils::is_nonnegative(tmpval) && lefto > 4) tmpval++; - if (utils::is_negative(tmpval) < 0 && lefto < -4) + if (utils::is_negative(tmpval) && lefto < -4) tmpval--; number = datatypes::Decimal::getInt64FromWideDecimal(tmpval);