diff --git a/datatypes/mcs_datatype.cpp b/datatypes/mcs_datatype.cpp index 14020b5e1..39eff198d 100644 --- a/datatypes/mcs_datatype.cpp +++ b/datatypes/mcs_datatype.cpp @@ -371,7 +371,6 @@ TypeHandler::find(SystemCatalog::ColDataType typeCode, case SystemCatalog::NUM_OF_COL_DATA_TYPE: case SystemCatalog::STRINT: case SystemCatalog::UNDEFINED: - case SystemCatalog::BINARY: break; } return NULL; @@ -452,7 +451,6 @@ TypeHandler::find_by_ddltype(const ddlpackage::ColumnType &ct) case ddlpackage::DDL_UNSIGNED_FLOAT: return &mcs_type_handler_ufloat; case ddlpackage::DDL_UNSIGNED_DOUBLE: return &mcs_type_handler_udouble; - case ddlpackage::DDL_BINARY: //return &mcs_type_handler_binary; case ddlpackage::DDL_INVALID_DATATYPE: break; } diff --git a/datatypes/mcs_datatype.h b/datatypes/mcs_datatype.h index 470950960..1ca250a82 100644 --- a/datatypes/mcs_datatype.h +++ b/datatypes/mcs_datatype.h @@ -154,7 +154,6 @@ public: LONGDOUBLE, /* @bug3241, dev and variance calculation only */ STRINT, /* @bug3532, string as int for fast comparison */ UNDEFINED, /*!< Undefined - used in UDAF API */ - BINARY, /*!< BINARY type */ }; class TypeAttributesStd diff --git a/datatypes/mcs_decimal.h b/datatypes/mcs_decimal.h index 67867f944..a2981b7dd 100644 --- a/datatypes/mcs_decimal.h +++ b/datatypes/mcs_decimal.h @@ -178,45 +178,24 @@ class Decimal static inline bool isWideDecimalNullValue(const int128_t& val) { - const uint64_t* ptr = reinterpret_cast(&val); - return (ptr[0] == utils::BINARYNULLVALUELOW && ptr[1] == utils::BINARYNULLVALUEHIGH); + return (val == TSInt128::NullValue); } static inline bool isWideDecimalEmptyValue(const int128_t& val) { - const uint64_t* ptr = reinterpret_cast(&val); - return (ptr[0] == utils::BINARYEMPTYVALUELOW && ptr[1] == utils::BINARYEMPTYVALUEHIGH); + return (val == TSInt128::EmptyValue); } static inline void setWideDecimalNullValue(int128_t& val) { - uint64_t* ptr = reinterpret_cast(&val); - ptr[0] = utils::BINARYNULLVALUELOW; - ptr[1] = utils::BINARYNULLVALUEHIGH; + val = TSInt128::NullValue; } static inline void setWideDecimalEmptyValue(int128_t& val) { - uint64_t* ptr = reinterpret_cast(&val); - ptr[0] = utils::BINARYEMPTYVALUELOW; - ptr[1] = utils::BINARYEMPTYVALUEHIGH; + val = TSInt128::EmptyValue; } - static inline void setWideDecimalNullValue(int128_t* val) - { - uint64_t* ptr = reinterpret_cast(val); - ptr[0] = utils::BINARYNULLVALUELOW; - ptr[1] = utils::BINARYNULLVALUEHIGH; - } - - static inline void setWideDecimalEmptyValue(int128_t* val) - { - uint64_t* ptr = reinterpret_cast(val); - ptr[0] = utils::BINARYEMPTYVALUELOW; - ptr[1] = utils::BINARYEMPTYVALUEHIGH; - } - - static constexpr int128_t minInt128 = int128_t(0x8000000000000000LL) << 64; static constexpr int128_t maxInt128 = (int128_t(0x7FFFFFFFFFFFFFFFLL) << 64) + 0xFFFFFFFFFFFFFFFFLL; diff --git a/dbcon/ddlpackage/ddlpkg.cpp b/dbcon/ddlpackage/ddlpkg.cpp index 90bfa45a9..21c4822cc 100644 --- a/dbcon/ddlpackage/ddlpkg.cpp +++ b/dbcon/ddlpackage/ddlpkg.cpp @@ -187,7 +187,7 @@ void ColumnDef::convertDecimal() } else if (fType->fPrecision > 18 && fType->fPrecision < 39) { - fType->fType = DDL_BINARY; + fType->fType = DDL_DECIMAL; fType->fLength = 16; } } diff --git a/dbcon/ddlpackage/ddlpkg.h b/dbcon/ddlpackage/ddlpkg.h index 821efa440..7a5a787e6 100644 --- a/dbcon/ddlpackage/ddlpkg.h +++ b/dbcon/ddlpackage/ddlpkg.h @@ -238,7 +238,6 @@ enum DDL_DATATYPES DDL_TEXT, DDL_TIME, DDL_TIMESTAMP, - DDL_BINARY, DDL_INVALID_DATATYPE }; @@ -278,7 +277,6 @@ const std::string DDLDatatypeString[] = "text", "time", "timestamp", - "binary", "" }; diff --git a/dbcon/ddlpackageproc/altertableprocessor.cpp b/dbcon/ddlpackageproc/altertableprocessor.cpp index 1e0fa76e2..743779c68 100644 --- a/dbcon/ddlpackageproc/altertableprocessor.cpp +++ b/dbcon/ddlpackageproc/altertableprocessor.cpp @@ -247,11 +247,6 @@ bool typesAreSame(const CalpontSystemCatalog::ColType& colType, const ColumnType break; - case (CalpontSystemCatalog::BINARY): - if (newType.fType == DDL_BINARY && colType.colWidth == newType.fLength) return true; - - break; - default: break; } diff --git a/dbcon/ddlpackageproc/ddlpackageprocessor.cpp b/dbcon/ddlpackageproc/ddlpackageprocessor.cpp index 0f21db9cb..fb3e1e78e 100644 --- a/dbcon/ddlpackageproc/ddlpackageprocessor.cpp +++ b/dbcon/ddlpackageproc/ddlpackageprocessor.cpp @@ -253,10 +253,6 @@ execplan::CalpontSystemCatalog::ColDataType DDLPackageProcessor::convertDataType colDataType = CalpontSystemCatalog::TEXT; break; - case ddlpackage::DDL_BINARY: - colDataType = CalpontSystemCatalog::BINARY; - break; - default: throw runtime_error("Unsupported datatype!"); diff --git a/dbcon/execplan/calpontsystemcatalog.cpp b/dbcon/execplan/calpontsystemcatalog.cpp index 18b0fb7c5..96f43d8d0 100644 --- a/dbcon/execplan/calpontsystemcatalog.cpp +++ b/dbcon/execplan/calpontsystemcatalog.cpp @@ -227,10 +227,6 @@ const string colDataTypeToString(CalpontSystemCatalog::ColDataType cdt) return "udouble"; break; - case CalpontSystemCatalog::BINARY: - return "binary"; - break; - default: break; } diff --git a/dbcon/execplan/calpontsystemcatalog.h b/dbcon/execplan/calpontsystemcatalog.h index 10ca7ddbe..7cfec11d0 100644 --- a/dbcon/execplan/calpontsystemcatalog.h +++ b/dbcon/execplan/calpontsystemcatalog.h @@ -1076,13 +1076,6 @@ inline bool isNull(int64_t val, const execplan::CalpontSystemCatalog::ColType& c break; } - case execplan::CalpontSystemCatalog::BINARY: - { - ret = false; - - break; - } - default: break; } diff --git a/dbcon/execplan/simplecolumn.cpp b/dbcon/execplan/simplecolumn.cpp index 64620cb15..cdccb399f 100644 --- a/dbcon/execplan/simplecolumn.cpp +++ b/dbcon/execplan/simplecolumn.cpp @@ -703,15 +703,6 @@ void SimpleColumn::evaluate(Row& row, bool& isNull) break; } - case CalpontSystemCatalog::BINARY: - - { - // WIP MCOL-641 Binary representation could contain \0. - std::string value(row.getBinaryField(fInputIndex)); - fResult.strVal.swap(value); - break; - } - default: // treat as int64 { fResult.intVal = row.getUintField<8>(fInputIndex); diff --git a/dbcon/execplan/simplefilter.cpp b/dbcon/execplan/simplefilter.cpp index f394f5e51..3fcc8fcd6 100644 --- a/dbcon/execplan/simplefilter.cpp +++ b/dbcon/execplan/simplefilter.cpp @@ -219,7 +219,6 @@ const string SimpleFilter::data() const fRhs->resultType().colDataType == CalpontSystemCatalog::DATE || fRhs->resultType().colDataType == CalpontSystemCatalog::DATETIME || fRhs->resultType().colDataType == CalpontSystemCatalog::TIMESTAMP || - fRhs->resultType().colDataType == CalpontSystemCatalog::BINARY || fRhs->resultType().colDataType == CalpontSystemCatalog::TIME)) rhs = "'" + SimpleFilter::escapeString(fRhs->data()) + "'"; else @@ -234,7 +233,6 @@ const string SimpleFilter::data() const fLhs->resultType().colDataType == CalpontSystemCatalog::DATE || fLhs->resultType().colDataType == CalpontSystemCatalog::TIME || fLhs->resultType().colDataType == CalpontSystemCatalog::TIMESTAMP || - fLhs->resultType().colDataType == CalpontSystemCatalog::BINARY || fLhs->resultType().colDataType == CalpontSystemCatalog::DATETIME)) lhs = "'" + SimpleFilter::escapeString(fLhs->data()) + "'"; else diff --git a/dbcon/execplan/treenode.h b/dbcon/execplan/treenode.h index e52f986a5..113aa3970 100644 --- a/dbcon/execplan/treenode.h +++ b/dbcon/execplan/treenode.h @@ -666,10 +666,6 @@ inline const std::string& TreeNode::getStrVal(const std::string& timeZone) break; } - case CalpontSystemCatalog::BINARY: - { - break; - } default: throw logging::InvalidConversionExcept("TreeNode::getStrVal: Invalid conversion."); } @@ -1027,7 +1023,6 @@ inline IDB_Decimal TreeNode::getDecimalVal() case CalpontSystemCatalog::VARBINARY: case CalpontSystemCatalog::BLOB: - case CalpontSystemCatalog::BINARY: throw logging::InvalidConversionExcept("TreeNode::getDecimalVal: non-support conversion from binary string"); case CalpontSystemCatalog::BIGINT: diff --git a/dbcon/joblist/jlf_common.cpp b/dbcon/joblist/jlf_common.cpp index 794ed4c07..4dabc57f3 100644 --- a/dbcon/joblist/jlf_common.cpp +++ b/dbcon/joblist/jlf_common.cpp @@ -333,8 +333,7 @@ string extractTableAlias(const SSC& sc) //------------------------------------------------------------------------------ CalpontSystemCatalog::OID isDictCol(const CalpontSystemCatalog::ColType& colType) { - if (colType.isWideDecimalType() || - colType.colDataType == CalpontSystemCatalog::BINARY) return 0; + if (colType.isWideDecimalType()) return 0; if (colType.colWidth > 8) return colType.ddn.dictOID; diff --git a/dbcon/joblist/joblisttypes.h b/dbcon/joblist/joblisttypes.h index ccdf13228..6d5664c57 100644 --- a/dbcon/joblist/joblisttypes.h +++ b/dbcon/joblist/joblisttypes.h @@ -83,12 +83,6 @@ const uint16_t NULL_UINT16 = USMALLINTNULL; const uint32_t NULL_UINT32 = UINTNULL; const uint64_t NULL_UINT64 = UBIGINTNULL; -const uint64_t BINARYNULLVALUELOW = 0ULL; -const uint64_t BINARYNULLVALUEHIGH = 0x8000000000000000ULL; -const uint64_t BINARYEMPTYVALUELOW = 1ULL; -const uint64_t BINARYEMPTYVALUEHIGH = 0x8000000000000000ULL; -const uint64_t BINARYEMPTYROW = 0ULL; - const std::string CPNULLSTRMARK("_CpNuLl_"); const std::string CPSTRNOTFOUND("_CpNoTf_"); diff --git a/dbcon/joblist/pcolscan.cpp b/dbcon/joblist/pcolscan.cpp index c870eca56..d7453cca9 100644 --- a/dbcon/joblist/pcolscan.cpp +++ b/dbcon/joblist/pcolscan.cpp @@ -175,7 +175,6 @@ pColScanStep::pColScanStep( } // MCOL-641 WIP else if (fColType.colWidth > 8 - && fColType.colDataType != CalpontSystemCatalog::BINARY && fColType.colDataType != CalpontSystemCatalog::DECIMAL && fColType.colDataType != CalpontSystemCatalog::UDECIMAL) { diff --git a/dbcon/joblist/pcolstep.cpp b/dbcon/joblist/pcolstep.cpp index 722fb57ce..edaa51af6 100644 --- a/dbcon/joblist/pcolstep.cpp +++ b/dbcon/joblist/pcolstep.cpp @@ -179,7 +179,6 @@ pColStep::pColStep( } // WIP MCOL-641 else if (fColType.colWidth > 8 - && fColType.colDataType != CalpontSystemCatalog::BINARY && fColType.colDataType != CalpontSystemCatalog::DECIMAL && fColType.colDataType != CalpontSystemCatalog::UDECIMAL) { diff --git a/primitives/linux-port/pp-scan-unittest.cpp b/primitives/linux-port/pp-scan-unittest.cpp index 0d80141a5..72483bc9e 100644 --- a/primitives/linux-port/pp-scan-unittest.cpp +++ b/primitives/linux-port/pp-scan-unittest.cpp @@ -164,7 +164,7 @@ class PrimTest : public CppUnit::TestFixture // binary data type CPPUNIT_TEST(p_Col_bin_16); - CPPUNIT_TEST(p_Col_bin_32); +// CPPUNIT_TEST(p_Col_bin_32); CPPUNIT_TEST_SUITE_END(); @@ -3801,7 +3801,7 @@ public: args = reinterpret_cast(&input[sizeof(NewColRequestHeader)]); in->DataSize = sizeof(binary16); - in->DataType = execplan::CalpontSystemCatalog::BINARY; + in->DataType = execplan::CalpontSystemCatalog::DECIMAL; in->OutputType = OT_DATAVALUE; in->NOPS = 3; in->BOP = BOP_OR; diff --git a/utils/common/emptyvaluemanip.cpp b/utils/common/emptyvaluemanip.cpp index 3300bc690..1abb40c33 100644 --- a/utils/common/emptyvaluemanip.cpp +++ b/utils/common/emptyvaluemanip.cpp @@ -83,10 +83,6 @@ void getEmptyRowValue(const execplan::CalpontSystemCatalog::ColDataType colDataT datatypes::Decimal::setWideDecimalEmptyValue(*(reinterpret_cast(emptyVal))); break; - //case CalpontSystemCatalog::BINARY: - // emptyVal = joblist::BINARYEMPTYROW; - // break; - case execplan::CalpontSystemCatalog::CHAR: case execplan::CalpontSystemCatalog::VARCHAR: case execplan::CalpontSystemCatalog::DATE: diff --git a/utils/common/nullvaluemanip.cpp b/utils/common/nullvaluemanip.cpp index adb8e108d..46ccc5abd 100644 --- a/utils/common/nullvaluemanip.cpp +++ b/utils/common/nullvaluemanip.cpp @@ -126,9 +126,6 @@ uint64_t getNullValue(CalpontSystemCatalog::ColDataType t, uint32_t colWidth) case CalpontSystemCatalog::UBIGINT: return joblist::UBIGINTNULL; - case CalpontSystemCatalog::BINARY: - return joblist::BINARYNULLVALUELOW; - case CalpontSystemCatalog::VARBINARY: default: ostringstream os; @@ -247,9 +244,6 @@ int64_t getSignedNullValue(CalpontSystemCatalog::ColDataType t, uint32_t colWidt case CalpontSystemCatalog::LONGDOUBLE: return (int64_t)joblist::LONGDOUBLENULL; - case CalpontSystemCatalog::BINARY: - return (int64_t)joblist::BINARYNULLVALUELOW; - case CalpontSystemCatalog::VARBINARY: default: ostringstream os; diff --git a/utils/common/widedecimalutils.h b/utils/common/widedecimalutils.h index 7e931d7fe..ae70d275c 100644 --- a/utils/common/widedecimalutils.h +++ b/utils/common/widedecimalutils.h @@ -23,11 +23,6 @@ namespace utils { - const uint64_t BINARYNULLVALUELOW = 0ULL; - const uint64_t BINARYNULLVALUEHIGH = 0x8000000000000000ULL; - const uint64_t BINARYEMPTYVALUELOW = 1ULL; - const uint64_t BINARYEMPTYVALUEHIGH = 0x8000000000000000ULL; - const int128_t minInt128 = int128_t(0x8000000000000000LL) << 64; const int128_t maxInt128 = (int128_t(0x7FFFFFFFFFFFFFFFLL) << 64) + 0xFFFFFFFFFFFFFFFFLL; diff --git a/utils/funcexp/func_hex.cpp b/utils/funcexp/func_hex.cpp index b45f6b52a..3c3664d5c 100644 --- a/utils/funcexp/func_hex.cpp +++ b/utils/funcexp/func_hex.cpp @@ -131,15 +131,6 @@ string Func_hex::getStrVal(rowgroup::Row& row, return string(hexPtr.get(), hexLen); } - case CalpontSystemCatalog::BINARY: - { - const string& arg = parm[0]->data()->getStrVal(row, isNull); - uint64_t hexLen = arg.size() * 2; - scoped_array hexPtr(new char[hexLen + 1]); // "+ 1" for the last \0 - octet2hex(hexPtr.get(), arg.data(), arg.size()); - return string(hexPtr.get(), hexLen); - } - default: { dec = (uint64_t)parm[0]->data()->getIntVal(row, isNull); diff --git a/utils/rowgroup/rowgroup.cpp b/utils/rowgroup/rowgroup.cpp index d477bafc3..d2382c484 100644 --- a/utils/rowgroup/rowgroup.cpp +++ b/utils/rowgroup/rowgroup.cpp @@ -632,10 +632,7 @@ string Row::toString() const os << " " << dec; break; } - // WIP MCOL-641 - case CalpontSystemCatalog::BINARY: - std::cout << __FILE__<< ":" <<__LINE__ << " Fix for 16 Bytes ?" << std::endl; - break; + case CalpontSystemCatalog::DECIMAL: case CalpontSystemCatalog::UDECIMAL: if (colWidths[i] == datatypes::MAXDECIMALWIDTH) @@ -709,9 +706,6 @@ string Row::toCSV() const os << dec; break; } - case CalpontSystemCatalog::BINARY: - std::cout << __FILE__<< __LINE__ << ":" << "toCSV"<< std::endl; - //fallthrough default: os << getIntField(i); @@ -876,11 +870,6 @@ void Row::initToNull() case CalpontSystemCatalog::UBIGINT: *((uint64_t*) &data[offsets[i]]) = joblist::UBIGINTNULL; break; - case CalpontSystemCatalog::BINARY: - { - datatypes::Decimal::setWideDecimalNullValue(reinterpret_cast(data[offsets[i]])); - } - break; default: ostringstream os; @@ -903,29 +892,6 @@ inline bool Row::isNullValue_offset(uint32_t offset) const throw logic_error(os.str()); } -// WIP Method template resolution could impose some perf degradation -// Compare perf with switch-case -template<> -inline bool -Row::isNullValue_offset( - uint32_t offset) const -{ - const uint64_t *intPtr = reinterpret_cast(&data[offset]); - return ((intPtr[0] == static_cast(utils::BINARYNULLVALUELOW)) && - (intPtr[1] == static_cast(utils::BINARYNULLVALUELOW)) && - (intPtr[2] == static_cast(utils::BINARYNULLVALUELOW)) && - (intPtr[3] == static_cast(utils::BINARYEMPTYVALUEHIGH))); -} - -template<> -inline bool -Row::isNullValue_offset( - uint32_t offset) const -{ - const int128_t *intPtr = reinterpret_cast(&data[offset]); - return datatypes::Decimal::isWideDecimalNullValue (*intPtr); -} - template<> inline bool Row::isNullValue_offset( @@ -1114,15 +1080,6 @@ bool Row::isNullValue(uint32_t colIndex) const return (*((long double*) &data[offsets[colIndex]]) == joblist::LONGDOUBLENULL); break; - case CalpontSystemCatalog::BINARY: - { - const uint32_t len = 16; - uint32_t* lenPtr = const_cast(&len); - *lenPtr = getColumnWidth(colIndex); - return isNullValue_offset - (offsets[colIndex]); - } - default: { ostringstream os; @@ -1787,9 +1744,6 @@ void RowGroup::addToSysDataList(execplan::CalpontSystemCatalog::NJLSysDataList& cr->PutData(row.getUintField<4>(j)); break; - case CalpontSystemCatalog::BINARY: - std::cout << __FILE__<< __LINE__ << __func__<< std::endl; - //fallthrough default: cr->PutData(row.getIntField<8>(j)); } diff --git a/utils/windowfunction/wf_count.cpp b/utils/windowfunction/wf_count.cpp index 67bc82ed4..48fe3da25 100644 --- a/utils/windowfunction/wf_count.cpp +++ b/utils/windowfunction/wf_count.cpp @@ -69,12 +69,6 @@ boost::shared_ptr WF_count::makeFunction(int id, const st break; } - case CalpontSystemCatalog::BINARY: - { - std::cout << __FILE__<< ":" <<__LINE__ << " Fix for 16 Bytes ?" << std::endl; - break; - } - case CalpontSystemCatalog::DECIMAL: case CalpontSystemCatalog::UDECIMAL: { diff --git a/utils/windowfunction/wf_udaf.cpp b/utils/windowfunction/wf_udaf.cpp index b68173850..537cb6be4 100644 --- a/utils/windowfunction/wf_udaf.cpp +++ b/utils/windowfunction/wf_udaf.cpp @@ -491,9 +491,7 @@ bool WF_udaf::dropValues(int64_t b, int64_t e) datum.columnData = valIn; break; } - case CalpontSystemCatalog::BINARY: - cout << __FILE__<< ":" <<__LINE__ << " Fix for 16 Bytes ?" << endl; - //fallthrough + default: { string errStr = "(" + colType2String[(int)datum.dataType] + ")"; @@ -768,9 +766,7 @@ void WF_udaf::SetUDAFValue(static_any::any& valOut, int64_t colOut, setValue(colDataType, b, e, c, &strOut); } break; - case CalpontSystemCatalog::BINARY: - cout << __FILE__<< ":" <<__LINE__ << " Fix for 16 Bytes ?" << endl; - //fallthrough + default: { std::ostringstream errmsg; @@ -1150,9 +1146,7 @@ void WF_udaf::operator()(int64_t b, int64_t e, int64_t c) datum.columnData = valIn; break; } - case CalpontSystemCatalog::BINARY: - cout << __FILE__<< ":" <<__LINE__ << " Fix for 16 Bytes ?" << endl; - //fallthrough + default: { string errStr = "(" + colType2String[(int)datum.dataType] + ")"; diff --git a/utils/windowfunction/windowfunctiontype.cpp b/utils/windowfunction/windowfunctiontype.cpp index d5bb92047..9eb92480d 100644 --- a/utils/windowfunction/windowfunctiontype.cpp +++ b/utils/windowfunction/windowfunctiontype.cpp @@ -800,9 +800,7 @@ void* WindowFunctionType::getNullValueByType(int ct, int pos) case CalpontSystemCatalog::LONGDOUBLE: v = &longDoubleNull; break; - case CalpontSystemCatalog::BINARY: - cout << __FILE__<< ":" <<__LINE__ << " Fix for 16 Bytes ?" << endl; - //fallthrough + case CalpontSystemCatalog::VARBINARY: default: std::ostringstream oss; diff --git a/writeengine/server/we_ddlcommandproc.cpp b/writeengine/server/we_ddlcommandproc.cpp index d60ff033f..ad2238a6f 100644 --- a/writeengine/server/we_ddlcommandproc.cpp +++ b/writeengine/server/we_ddlcommandproc.cpp @@ -510,16 +510,6 @@ uint8_t WE_DDLCommandProc::writeCreateSyscolumn(ByteStream& bs, std::string& err throw std::runtime_error(os.str()); } - else if (dataType == CalpontSystemCatalog::BINARY - && ! (colDefPtr->fType->fLength == 16 - || colDefPtr->fType->fLength == 32)) - { - ostringstream os; - os << "binary length may not be other than 16 or 32"; - throw std::runtime_error(os.str()); - } - - unsigned int i = 0; column_iterator = columns.begin(); @@ -871,10 +861,10 @@ uint8_t WE_DDLCommandProc::writeSyscolumn(ByteStream& bs, std::string& err) if (dataType == CalpontSystemCatalog::DECIMAL || dataType == CalpontSystemCatalog::UDECIMAL) { - if (colDefPtr->fType->fPrecision > 18) //@Bug 5717 precision cannot be over 18. + if (colDefPtr->fType->fPrecision > 38) //@Bug 5717 precision cannot be over 38. { ostringstream os; - os << "Syntax error: The maximum precision (total number of digits) that can be specified is 18"; + os << "Syntax error: The maximum precision (total number of digits) that can be specified is 38"; throw std::runtime_error(os.str()); } else if (colDefPtr->fType->fPrecision < colDefPtr->fType->fScale) diff --git a/writeengine/server/we_ddlcommon.h b/writeengine/server/we_ddlcommon.h index b1741a440..24f611b70 100644 --- a/writeengine/server/we_ddlcommon.h +++ b/writeengine/server/we_ddlcommon.h @@ -263,10 +263,6 @@ inline int convertDataType(int dataType) calpontDataType = execplan::CalpontSystemCatalog::UDOUBLE; break; - case ddlpackage::DDL_BINARY: - calpontDataType = execplan::CalpontSystemCatalog::BINARY; - break; - default: throw runtime_error("Unsupported datatype!"); diff --git a/writeengine/shared/shared_components_tests.cpp b/writeengine/shared/shared_components_tests.cpp index db2f9d48c..6ba4ca229 100644 --- a/writeengine/shared/shared_components_tests.cpp +++ b/writeengine/shared/shared_components_tests.cpp @@ -91,7 +91,7 @@ CPPUNIT_TEST(setUp); // Extent & dict related testing CPPUNIT_TEST( testExtensionWOPrealloc ); CPPUNIT_TEST( testDictExtensionWOPrealloc ); - CPPUNIT_TEST( testExtentCrWOPreallocBin ); +// CPPUNIT_TEST( testExtentCrWOPreallocBin ); // Semaphore related testing // CPPUNIT_TEST( testSem ); @@ -1571,7 +1571,6 @@ public: fileOp.deleteFile(fileName); CPPUNIT_ASSERT(fileOp.exists(fileName) == false); - //binary16 emptyVal = blockOp.getEmptyBinRowValue( execplan::CalpontSystemCatalog::BINARY, 16 ); uint64_t emptyVal = blockOp.getEmptyRowValue(execplan::CalpontSystemCatalog::BIGINT, 8); int width = blockOp.getCorrectRowWidth(execplan::CalpontSystemCatalog::BINARY, sizeof (binary16)); int nBlocks = INITIAL_EXTENT_ROWS_TO_DISK / BYTE_PER_BLOCK * width; diff --git a/writeengine/shared/we_brm.cpp b/writeengine/shared/we_brm.cpp index c1c6bcafb..3a2d49f89 100644 --- a/writeengine/shared/we_brm.cpp +++ b/writeengine/shared/we_brm.cpp @@ -953,7 +953,7 @@ int BRMWrapper::rollBack(const VER_t transID, int sessionId) CalpontSystemCatalog::ColDataType colDataType = colType.colDataType; ColType weColType; - Convertor::convertColType(colDataType, weColType); + Convertor::convertColType(colDataType, colType.colWidth, weColType); column.colWidth = Convertor::getCorrectRowWidth(colDataType, colType.colWidth); column.colType = weColType; column.colDataType = colDataType; @@ -1240,7 +1240,7 @@ int BRMWrapper::rollBackBlocks(const VER_t transID, int sessionId) CalpontSystemCatalog::ColDataType colDataType = colType.colDataType; ColType weColType; - Convertor::convertColType(colDataType, weColType); + Convertor::convertColType(colDataType, colType.colWidth, weColType); column.colWidth = Convertor::getCorrectRowWidth(colDataType, colType.colWidth); column.colType = weColType; column.colDataType = colDataType; diff --git a/writeengine/shared/we_convertor.cpp b/writeengine/shared/we_convertor.cpp index 77fa8128d..41dedfc01 100644 --- a/writeengine/shared/we_convertor.cpp +++ b/writeengine/shared/we_convertor.cpp @@ -328,9 +328,8 @@ void Convertor::mapErrnoToString(int errNum, std::string& errString) * none ******************************************************************************/ /* static */ -// TODO MCOL-641 void Convertor::convertColType(CalpontSystemCatalog::ColDataType dataType, - ColType& internalType, bool isToken) + int colWidth, ColType& internalType, bool isToken) { if (isToken) { @@ -382,6 +381,36 @@ void Convertor::convertColType(CalpontSystemCatalog::ColDataType dataType, internalType = WriteEngine::WR_DOUBLE; break; + // Map DECIMAL to applicable integer type + case CalpontSystemCatalog::DECIMAL : + case CalpontSystemCatalog::UDECIMAL : + { + switch (colWidth) + { + case 1 : + internalType = WriteEngine::WR_BYTE; + break; + + case 2 : + internalType = WriteEngine::WR_SHORT; + break; + + case 4 : + internalType = WriteEngine::WR_INT; + break; + + case 8: + internalType = WriteEngine::WR_LONGLONG; + break; + + default: + internalType = WriteEngine::WR_BINARY; + break; + } + + break; + } + // Map BLOB to WR_BLOB case CalpontSystemCatalog::BLOB : internalType = WriteEngine::WR_BLOB; @@ -397,13 +426,6 @@ void Convertor::convertColType(CalpontSystemCatalog::ColDataType dataType, internalType = WriteEngine::WR_VARBINARY; break; - // Map DECIMAL to applicable WR_CHAR - // We can't map them to their proper int size, since in this version - // of convertColType(), we don't know what that is. Hopefully - // this is never used for DECIMAL. - case CalpontSystemCatalog::DECIMAL : - case CalpontSystemCatalog::UDECIMAL: - // Map CHAR, VARCHAR, and CLOB to WR_CHAR case CalpontSystemCatalog::CHAR : case CalpontSystemCatalog::VARCHAR : @@ -436,11 +458,6 @@ void Convertor::convertColType(CalpontSystemCatalog::ColDataType dataType, internalType = WriteEngine::WR_ULONGLONG; break; - // Map BINARY to WR_BINARY - case CalpontSystemCatalog::BINARY: - internalType = WriteEngine::WR_BINARY; - break; - default: internalType = WriteEngine::WR_CHAR; break; @@ -693,11 +710,6 @@ void Convertor::convertColType(ColStruct* curStruct) *internalType = WriteEngine::WR_ULONGLONG; break; - // Map BINARY to WR_BINARY - case CalpontSystemCatalog::BINARY: - *internalType = WriteEngine::WR_BINARY; - break; - default: *internalType = WriteEngine::WR_CHAR; break; @@ -783,10 +795,6 @@ int Convertor::getCorrectRowWidth(CalpontSystemCatalog::ColDataType dataType, in newWidth = 8; break; - case CalpontSystemCatalog::BINARY: - newWidth = width; - break; - case CalpontSystemCatalog::CHAR: case CalpontSystemCatalog::VARCHAR: case CalpontSystemCatalog::VARBINARY: // treat same as varchar for now diff --git a/writeengine/shared/we_convertor.h b/writeengine/shared/we_convertor.h index 8ecbab20f..5bec87434 100644 --- a/writeengine/shared/we_convertor.h +++ b/writeengine/shared/we_convertor.h @@ -98,7 +98,8 @@ public: */ //BUG931 EXPORT static void convertColType(execplan::CalpontSystemCatalog::ColDataType dataType, - ColType& internalType, bool isToken = false); + int colWidth, ColType& internalType, + bool isToken = false); /** * @brief Convert specified internal storage type (ColType) to * ColDataType diff --git a/writeengine/wrapper/writeengine.cpp b/writeengine/wrapper/writeengine.cpp index de9853f5d..f965a6485 100644 --- a/writeengine/wrapper/writeengine.cpp +++ b/writeengine/wrapper/writeengine.cpp @@ -397,17 +397,8 @@ void WriteEngineWrapper::convertValue(const execplan::CalpontSystemCatalog::ColT case WriteEngine::WR_BINARY: { size = cscColType.colWidth; - if (cscColType.colDataType == CalpontSystemCatalog::DECIMAL || - cscColType.colDataType == CalpontSystemCatalog::UDECIMAL) - { - int128_t val = boost::any_cast(data); - memcpy(value, &val, size); - } - else // for CalpontSystemCatalog::BINARY - { - char val = boost::any_cast(data); - memcpy(value, &val, size); - } + int128_t val = boost::any_cast(data); + memcpy(value, &val, size); } break; @@ -515,21 +506,10 @@ void WriteEngineWrapper::convertValue(const CalpontSystemCatalog::ColType& cscCo ((Token*)valArray)[pos] = boost::any_cast(data); break; - // WIP MCOL-641 case WriteEngine::WR_BINARY: size_t size = cscColType.colWidth; - if (cscColType.colDataType == CalpontSystemCatalog::DECIMAL || - cscColType.colDataType == CalpontSystemCatalog::UDECIMAL) - { - int128_t val = boost::any_cast(data); - memcpy((uint8_t*)valArray + pos * size, &val, size); - } - else // for CalpontSystemCatalog::BINARY - { - char val = boost::any_cast(data); - memcpy((uint8_t*)valArray + pos * size, &val, size); - } - + int128_t val = boost::any_cast(data); + memcpy((uint8_t*)valArray + pos * size, &val, size); break; } // end of switch (colType) } @@ -596,23 +576,11 @@ void WriteEngineWrapper::convertValue(const CalpontSystemCatalog::ColType& cscCo case WriteEngine::WR_TOKEN: data = ((Token*)valArray)[pos]; break; - // WIP MCOL-641 - case WriteEngine::WR_BINARY : - if (cscColType.colDataType == CalpontSystemCatalog::DECIMAL || - cscColType.colDataType == CalpontSystemCatalog::UDECIMAL) - { - data = ((int128_t*)valArray)[pos]; - } - else // for CalpontSystemCatalog::BINARY - { - // WIP do we need tmp here? - size_t size = cscColType.colWidth; - char *tmp = (char*) alloca (sizeof(char) * size); - memcpy(tmp, (uint8_t*)valArray + pos * size, size); - curStr = tmp; - data = curStr; - } - break; + + case WriteEngine::WR_BINARY: + data = ((int128_t*)valArray)[pos]; + break; + } // end of switch (colType) } // end of if } @@ -709,7 +677,7 @@ int WriteEngineWrapper::fillColumn(const TxnID& txnid, const OID& dataOid, isToken = true; } - Convertor::convertColType(colType.colDataType, newColType, isToken); + Convertor::convertColType(colType.colDataType, colType.colWidth, newColType, isToken); // WIP // replace with isDictCol @@ -729,7 +697,7 @@ int WriteEngineWrapper::fillColumn(const TxnID& txnid, const OID& dataOid, newDataWidth >>= 1; } - Convertor::convertColType(refColDataType, refColType, isToken); + Convertor::convertColType(refColDataType, refColWidth, refColType, isToken); refColOp->setColParam(refCol, 0, refColOp->getCorrectRowWidth(refColDataType, refColWidth), refColDataType, refColType, (FID)refColOID, refCompressionType, dbRoot); colOpNewCol->setColParam(newCol, 0, newDataWidth,