diff --git a/datatypes/mcs_datatype.h b/datatypes/mcs_datatype.h index 9820eb68c..2b3194a1c 100644 --- a/datatypes/mcs_datatype.h +++ b/datatypes/mcs_datatype.h @@ -1191,14 +1191,13 @@ class TypeHandlerEnum : public TypeHandler } boost::any getNullValueForType(const SystemCatalog::TypeAttributesStd& /*attr*/) const override { - // TODO: How to communicate with write engine? return {}; } boost::any convertFromString(const SystemCatalog::TypeAttributesStd& /*colType*/, const ConvertFromStringParam& /*prm*/, const std::string& /*str*/, bool& /*pushWarning*/) const override; -const uint8_t* getEmptyValueForType(const SystemCatalog::TypeAttributesStd& /*attr*/) const override + const uint8_t* getEmptyValueForType(const SystemCatalog::TypeAttributesStd& /*attr*/) const override { idbassert(0); return nullptr; diff --git a/dbcon/ddlpackageproc/ddlindexpopulator.cpp b/dbcon/ddlpackageproc/ddlindexpopulator.cpp index 2a00dc03b..ea73bb55d 100644 --- a/dbcon/ddlpackageproc/ddlindexpopulator.cpp +++ b/dbcon/ddlpackageproc/ddlindexpopulator.cpp @@ -314,12 +314,7 @@ boost::any DDLIndexPopulator::convertData(const CalpontSystemCatalog::ColType& c switch (colType.colDataType) { case CalpontSystemCatalog::BIT: - case CalpontSystemCatalog::ENUM: - { - string strData(colType.fEnumValues[data]); - - return *reinterpret_cast(&strData); - } + case CalpontSystemCatalog::ENUM: return colType.fEnumValues[data]; case execplan::CalpontSystemCatalog::TINYINT: return *reinterpret_cast(&data); case execplan::CalpontSystemCatalog::SMALLINT: return *reinterpret_cast(&data); @@ -467,7 +462,8 @@ bool DDLIndexPopulator::checkNotNull(const IdxTuple& data, const CalpontSystemCa case CalpontSystemCatalog::BIT: break; case execplan::CalpontSystemCatalog::ENUM: - isNull = any_cast(data.data) == any_cast(nullvalue); + isNull = (any_cast(data.data) == any_cast(nullvalue)) || + (any_cast(data.data)==colType.enumVals.size()); break; case execplan::CalpontSystemCatalog::TINYINT: diff --git a/dbcon/execplan/aggregatecolumn.cpp b/dbcon/execplan/aggregatecolumn.cpp index 24dbb6f71..508138e4a 100644 --- a/dbcon/execplan/aggregatecolumn.cpp +++ b/dbcon/execplan/aggregatecolumn.cpp @@ -479,7 +479,7 @@ void AggregateColumn::evaluate(Row& row, bool& isNull) break; - case CalpontSystemCatalog::USMALLINT: + case CalpontSystemCatalog::USMALLINT: if (row.equals<2>(USMALLINTNULL, fInputIndex)) isNull = true; else @@ -487,6 +487,14 @@ void AggregateColumn::evaluate(Row& row, bool& isNull) break; + case CalpontSystemCatalog::ENUM: + if ((row.equals<2>(USMALLINTNULL, fInputIndex)) || (row.getUintField<2>(fInputIndex) == USMALLINTNULL)) + isNull = true; + else + fResult.uintVal = row.getUintField<2>(fInputIndex); + + break; + case CalpontSystemCatalog::TINYINT: if (row.equals<1>(TINYINTNULL, fInputIndex)) isNull = true; diff --git a/dbcon/execplan/arithmeticoperator.h b/dbcon/execplan/arithmeticoperator.h index b080291a5..b817ee7b9 100644 --- a/dbcon/execplan/arithmeticoperator.h +++ b/dbcon/execplan/arithmeticoperator.h @@ -289,6 +289,8 @@ inline void ArithmeticOperator::evaluate(rowgroup::Row& row, bool& isNull, Parse fResult.uintVal = static_cast(result); } break; + + case execplan::CalpontSystemCatalog::ENUM: case execplan::CalpontSystemCatalog::UINT: case execplan::CalpontSystemCatalog::UMEDINT: case execplan::CalpontSystemCatalog::USMALLINT: diff --git a/dbcon/execplan/simplecolumn.cpp b/dbcon/execplan/simplecolumn.cpp index a68fd6d02..b974b14f0 100644 --- a/dbcon/execplan/simplecolumn.cpp +++ b/dbcon/execplan/simplecolumn.cpp @@ -731,6 +731,7 @@ void SimpleColumn::evaluate(Row& row, bool& isNull) break; } + case CalpontSystemCatalog::ENUM: case CalpontSystemCatalog::USMALLINT: { fResult.uintVal = row.getUintField<2>(fInputIndex); diff --git a/dbcon/execplan/treenode.h b/dbcon/execplan/treenode.h index a86cb4b07..52ae19498 100644 --- a/dbcon/execplan/treenode.h +++ b/dbcon/execplan/treenode.h @@ -474,6 +474,16 @@ inline const utils::NullString& TreeNode::getStrVal(const long timeZone) { switch (fResultType.colDataType) { + case CalpontSystemCatalog::ENUM: + + if (fResult.uintVal(USMALLINTNULL, fInputIndex)) diff --git a/dbcon/joblist/crossenginestep.cpp b/dbcon/joblist/crossenginestep.cpp index d3dc6a494..05c9a9d6a 100644 --- a/dbcon/joblist/crossenginestep.cpp +++ b/dbcon/joblist/crossenginestep.cpp @@ -250,6 +250,7 @@ T CrossEngineStep::convertValueNum(const char* str, const CalpontSystemCatalog:: case CalpontSystemCatalog::SMALLINT: rv = boost::any_cast(anyVal); break; + case CalpontSystemCatalog::ENUM: case CalpontSystemCatalog::USMALLINT: rv = boost::any_cast(anyVal); break; case CalpontSystemCatalog::MEDINT: diff --git a/dbcon/joblist/joblisttypes.h b/dbcon/joblist/joblisttypes.h index cda4397d1..eb6b7e5f3 100644 --- a/dbcon/joblist/joblisttypes.h +++ b/dbcon/joblist/joblisttypes.h @@ -29,7 +29,6 @@ namespace joblist { -const uint64_t ENUMNULL = 0xffff; const uint64_t BIGINTNULL = 0x8000000000000000ULL; const uint64_t BIGINTEMPTYROW = 0x8000000000000001ULL; const uint32_t INTNULL = 0x80000000;