diff --git a/datatypes/mcs_datatype.cpp b/datatypes/mcs_datatype.cpp index 6dbef71b2..9a0a3d5fd 100644 --- a/datatypes/mcs_datatype.cpp +++ b/datatypes/mcs_datatype.cpp @@ -1573,6 +1573,7 @@ boost::any TypeHandlerEnum::convertFromString(const SystemCatalog::TypeAttribute } } + // Nedeljko TO DO boost::any value = val; return value; diff --git a/dbcon/ddlpackageproc/ddlindexpopulator.cpp b/dbcon/ddlpackageproc/ddlindexpopulator.cpp index ea73bb55d..1bc3c210f 100644 --- a/dbcon/ddlpackageproc/ddlindexpopulator.cpp +++ b/dbcon/ddlpackageproc/ddlindexpopulator.cpp @@ -463,7 +463,7 @@ bool DDLIndexPopulator::checkNotNull(const IdxTuple& data, const CalpontSystemCa case execplan::CalpontSystemCatalog::ENUM: isNull = (any_cast(data.data) == any_cast(nullvalue)) || - (any_cast(data.data)==colType.enumVals.size()); + (any_cast(data.data)==USMALLINTNULL); break; case execplan::CalpontSystemCatalog::TINYINT: diff --git a/dbcon/execplan/aggregatecolumn.cpp b/dbcon/execplan/aggregatecolumn.cpp index 508138e4a..2317459ca 100644 --- a/dbcon/execplan/aggregatecolumn.cpp +++ b/dbcon/execplan/aggregatecolumn.cpp @@ -488,6 +488,7 @@ void AggregateColumn::evaluate(Row& row, bool& isNull) break; case CalpontSystemCatalog::ENUM: + // Nedeljko TO DO if ((row.equals<2>(USMALLINTNULL, fInputIndex)) || (row.getUintField<2>(fInputIndex) == USMALLINTNULL)) isNull = true; else diff --git a/dbcon/execplan/calpontsystemcatalog.h b/dbcon/execplan/calpontsystemcatalog.h index dee640c3e..ac92f25a1 100644 --- a/dbcon/execplan/calpontsystemcatalog.h +++ b/dbcon/execplan/calpontsystemcatalog.h @@ -1172,6 +1172,8 @@ inline bool isNull(int64_t val, const execplan::CalpontSystemCatalog::ColType& c break; } + // Nedeljko TO DO + case execplan::CalpontSystemCatalog::ENUM: case execplan::CalpontSystemCatalog::USMALLINT: { if (joblist::USMALLINTNULL == (uint16_t)val) diff --git a/dbcon/execplan/treenode.h b/dbcon/execplan/treenode.h index 52ae19498..c8da260a8 100644 --- a/dbcon/execplan/treenode.h +++ b/dbcon/execplan/treenode.h @@ -476,7 +476,8 @@ inline const utils::NullString& TreeNode::getStrVal(const long timeZone) { case CalpontSystemCatalog::ENUM: - if (fResult.uintVal(anyVal); break; + case CalpontSystemCatalog::ENUM: case CalpontSystemCatalog::USMALLINT: n = boost::any_cast(anyVal); break; case CalpontSystemCatalog::MEDINT: @@ -346,6 +347,7 @@ void convertValueNum(const string& str, const CalpontSystemCatalog::ColType& ct, } break; + case CalpontSystemCatalog::ENUM: case CalpontSystemCatalog::CHAR: case CalpontSystemCatalog::VARCHAR: case CalpontSystemCatalog::VARBINARY: @@ -1723,6 +1725,7 @@ const JobStepVector doSimpleFilter(SimpleFilter* sf, JobInfo& jobInfo) { switch (ct.colDataType) { + case CalpontSystemCatalog::ENUM: case CalpontSystemCatalog::TINYINT: case CalpontSystemCatalog::SMALLINT: case CalpontSystemCatalog::MEDINT: diff --git a/dbcon/joblist/jlf_subquery.cpp b/dbcon/joblist/jlf_subquery.cpp index b94381756..8805cff24 100644 --- a/dbcon/joblist/jlf_subquery.cpp +++ b/dbcon/joblist/jlf_subquery.cpp @@ -106,6 +106,7 @@ void getColumnValue(ConstantColumn** cc, uint64_t i, const Row& row, const long } break; + // Nedeljko TO DO case CalpontSystemCatalog::UTINYINT: case CalpontSystemCatalog::USMALLINT: case CalpontSystemCatalog::UMEDINT: diff --git a/dbcon/joblist/lbidlist.cpp b/dbcon/joblist/lbidlist.cpp index 5afe32135..1b31afa37 100644 --- a/dbcon/joblist/lbidlist.cpp +++ b/dbcon/joblist/lbidlist.cpp @@ -531,6 +531,7 @@ bool LBIDList::CasualPartitionDataType(const CalpontSystemCatalog::ColDataType t case CalpontSystemCatalog::BLOB: case CalpontSystemCatalog::TEXT: return size <= 8; + case CalpontSystemCatalog::ENUM: case CalpontSystemCatalog::TINYINT: case CalpontSystemCatalog::SMALLINT: case CalpontSystemCatalog::MEDINT: diff --git a/dbcon/joblist/pcolscan.cpp b/dbcon/joblist/pcolscan.cpp index f2cdf26a1..721cc23ef 100644 --- a/dbcon/joblist/pcolscan.cpp +++ b/dbcon/joblist/pcolscan.cpp @@ -321,6 +321,7 @@ bool pColScanStep::isEmptyVal(const uint8_t* val8) const return (*val8 == joblist::UTINYINTEMPTYROW); } + case CalpontSystemCatalog::ENUM: case CalpontSystemCatalog::USMALLINT: { const uint16_t* val16 = reinterpret_cast(val8); diff --git a/dbcon/joblist/rowestimator.cpp b/dbcon/joblist/rowestimator.cpp index 57b7100ba..59816d7bf 100644 --- a/dbcon/joblist/rowestimator.cpp +++ b/dbcon/joblist/rowestimator.cpp @@ -136,6 +136,8 @@ uint32_t RowEstimator::estimateDistinctValues(const execplan::CalpontSystemCatal { case CalpontSystemCatalog::BIT: return 2; + case CalpontSystemCatalog::ENUM: return ct.enumVals.size(); + // Return limit/2 for integers where limit is number of possible values. case CalpontSystemCatalog::TINYINT: return (1 << 8) / 2; diff --git a/dbcon/joblist/tupleaggregatestep.cpp b/dbcon/joblist/tupleaggregatestep.cpp index 0473ee23b..d877239c5 100644 --- a/dbcon/joblist/tupleaggregatestep.cpp +++ b/dbcon/joblist/tupleaggregatestep.cpp @@ -152,6 +152,8 @@ inline string colTypeIdString(CalpontSystemCatalog::ColDataType type) { case CalpontSystemCatalog::BIT: return string("BIT"); + case CalpontSystemCatalog::ENUM: return string("ENUM"); + case CalpontSystemCatalog::TINYINT: return string("TINYINT"); case CalpontSystemCatalog::CHAR: return string("CHAR"); diff --git a/dbcon/joblist/tupleunion.cpp b/dbcon/joblist/tupleunion.cpp index cde15c308..837dd17a8 100644 --- a/dbcon/joblist/tupleunion.cpp +++ b/dbcon/joblist/tupleunion.cpp @@ -736,6 +736,7 @@ namespace break; } + case CalpontSystemCatalog::ENUM: case CalpontSystemCatalog::UTINYINT: case CalpontSystemCatalog::USMALLINT: case CalpontSystemCatalog::UMEDINT: @@ -810,6 +811,7 @@ namespace break; + case CalpontSystemCatalog::ENUM: case CalpontSystemCatalog::UTINYINT: case CalpontSystemCatalog::USMALLINT: case CalpontSystemCatalog::UMEDINT: @@ -835,6 +837,7 @@ namespace break; } + case CalpontSystemCatalog::ENUM: case CalpontSystemCatalog::UTINYINT: case CalpontSystemCatalog::USMALLINT: case CalpontSystemCatalog::UMEDINT: @@ -1042,6 +1045,7 @@ namespace break; } + case CalpontSystemCatalog::ENUM: case CalpontSystemCatalog::UTINYINT: case CalpontSystemCatalog::USMALLINT: case CalpontSystemCatalog::UMEDINT: @@ -1759,6 +1763,8 @@ void TupleUnion::writeNull(Row* out, uint32_t col) case CalpontSystemCatalog::UTINYINT: out->setUintField<1>(joblist::UTINYINTNULL, col); break; + case CalpontSystemCatalog::ENUM: out->setUintField<1>(joblist::USMALLINTNULL, col); break; + case CalpontSystemCatalog::USMALLINT: out->setUintField<1>(joblist::USMALLINTNULL, col); break; case CalpontSystemCatalog::DECIMAL: diff --git a/dbcon/joblist/windowfunctionstep.cpp b/dbcon/joblist/windowfunctionstep.cpp index 055ad29ad..4b2962126 100644 --- a/dbcon/joblist/windowfunctionstep.cpp +++ b/dbcon/joblist/windowfunctionstep.cpp @@ -1193,6 +1193,7 @@ boost::shared_ptr WindowFunctionStep::parseFrameBoundRows(const exec break; } + case execplan::CalpontSystemCatalog::ENUM: case execplan::CalpontSystemCatalog::UTINYINT: case execplan::CalpontSystemCatalog::USMALLINT: case execplan::CalpontSystemCatalog::UMEDINT: @@ -1344,6 +1345,7 @@ boost::shared_ptr WindowFunctionStep::parseFrameBoundRange(const exe break; } + // Nedeljko TO DO case execplan::CalpontSystemCatalog::UTINYINT: case execplan::CalpontSystemCatalog::USMALLINT: case execplan::CalpontSystemCatalog::UMEDINT: diff --git a/primitives/linux-port/column.cpp b/primitives/linux-port/column.cpp index dbb82f54e..6a423c1a6 100644 --- a/primitives/linux-port/column.cpp +++ b/primitives/linux-port/column.cpp @@ -257,6 +257,7 @@ inline bool isMinMaxValid(const NewColRequestHeader* in) case CalpontSystemCatalog::BLOB: case CalpontSystemCatalog::TEXT: return (in->colType.DataSize < 8); + // Nedeljko TO DO case CalpontSystemCatalog::TINYINT: case CalpontSystemCatalog::SMALLINT: case CalpontSystemCatalog::MEDINT: @@ -495,6 +496,7 @@ T getEmptyValue(uint8_t type) case CalpontSystemCatalog::TIMESTAMP: case CalpontSystemCatalog::TIME: return joblist::CHAR2EMPTYROW; + case CalpontSystemCatalog::ENUM: case CalpontSystemCatalog::USMALLINT: return joblist::USMALLINTEMPTYROW; default: return joblist::SMALLINTEMPTYROW; diff --git a/utils/funcexp/func_date.cpp b/utils/funcexp/func_date.cpp index dd1aa04b2..744df0204 100644 --- a/utils/funcexp/func_date.cpp +++ b/utils/funcexp/func_date.cpp @@ -104,6 +104,7 @@ int64_t Func_date::getIntVal(rowgroup::Row& row, FunctionParm& parm, bool& isNul break; } + case execplan::CalpontSystemCatalog::ENUM: case execplan::CalpontSystemCatalog::BIGINT: case execplan::CalpontSystemCatalog::INT: case execplan::CalpontSystemCatalog::MEDINT: diff --git a/utils/funcexp/func_decode_oracle.cpp b/utils/funcexp/func_decode_oracle.cpp index 25cc79e35..9c33cf37f 100644 --- a/utils/funcexp/func_decode_oracle.cpp +++ b/utils/funcexp/func_decode_oracle.cpp @@ -139,6 +139,7 @@ inline uint64_t simple_case_cmp(Row& row, FunctionParm& parm, bool& isNull, break; } + case execplan::CalpontSystemCatalog::ENUM: case execplan::CalpontSystemCatalog::UBIGINT: case execplan::CalpontSystemCatalog::UINT: case execplan::CalpontSystemCatalog::UMEDINT: diff --git a/utils/funcexp/func_floor.cpp b/utils/funcexp/func_floor.cpp index f25716ade..ab916be36 100644 --- a/utils/funcexp/func_floor.cpp +++ b/utils/funcexp/func_floor.cpp @@ -63,6 +63,7 @@ int64_t Func_floor::getIntVal(Row& row, FunctionParm& parm, bool& isNull, } break; + case execplan::CalpontSystemCatalog::ENUM: case execplan::CalpontSystemCatalog::UBIGINT: case execplan::CalpontSystemCatalog::UINT: case execplan::CalpontSystemCatalog::UMEDINT: @@ -165,6 +166,7 @@ uint64_t Func_floor::getUintVal(Row& row, FunctionParm& parm, bool& isNull, } break; + case execplan::CalpontSystemCatalog::ENUM: case execplan::CalpontSystemCatalog::UBIGINT: case execplan::CalpontSystemCatalog::UINT: case execplan::CalpontSystemCatalog::UMEDINT: diff --git a/utils/funcexp/func_in.cpp b/utils/funcexp/func_in.cpp index 3f3b9aaa0..7e1816049 100644 --- a/utils/funcexp/func_in.cpp +++ b/utils/funcexp/func_in.cpp @@ -83,6 +83,7 @@ inline bool getBoolForIn(rowgroup::Row& row, funcexp::FunctionParm& pm, bool& is return false; } + case execplan::CalpontSystemCatalog::ENUM: case execplan::CalpontSystemCatalog::UBIGINT: case execplan::CalpontSystemCatalog::UINT: case execplan::CalpontSystemCatalog::UMEDINT: diff --git a/utils/libmarias3/libmarias3 b/utils/libmarias3/libmarias3 index d9cb536a5..f74150b05 160000 --- a/utils/libmarias3/libmarias3 +++ b/utils/libmarias3/libmarias3 @@ -1 +1 @@ -Subproject commit d9cb536a532ef6e71df66d99e95562e1169ec93f +Subproject commit f74150b05693440d35f93c43e2d2411cc66fee19 diff --git a/utils/rowgroup/rowaggregation.cpp b/utils/rowgroup/rowaggregation.cpp index 631c58284..3fe5719d0 100644 --- a/utils/rowgroup/rowaggregation.cpp +++ b/utils/rowgroup/rowaggregation.cpp @@ -175,6 +175,7 @@ inline uint64_t getUintNullValue(int colType, int colWidth = 0) return joblist::UTINYINTNULL; } + case execplan::CalpontSystemCatalog::ENUM: case execplan::CalpontSystemCatalog::USMALLINT: { return joblist::USMALLINTNULL; @@ -399,6 +400,7 @@ inline bool RowAggregation::isNull(const RowGroup* pRowGroup, const Row& row, in break; } + case execplan::CalpontSystemCatalog::ENUM: case execplan::CalpontSystemCatalog::USMALLINT: { ret = ((uint16_t)row.getIntField(col) == joblist::USMALLINTNULL); diff --git a/utils/rowgroup/rowgroup.cpp b/utils/rowgroup/rowgroup.cpp index cfc2aa770..2c1882245 100644 --- a/utils/rowgroup/rowgroup.cpp +++ b/utils/rowgroup/rowgroup.cpp @@ -879,6 +879,7 @@ void Row::setToNull(uint32_t colIndex) case CalpontSystemCatalog::UTINYINT: data[offsets[colIndex]] = joblist::UTINYINTNULL; break; + case CalpontSystemCatalog::ENUM: case CalpontSystemCatalog::USMALLINT: *((uint16_t*)&data[offsets[colIndex]]) = joblist::USMALLINTNULL; break; @@ -1047,6 +1048,7 @@ bool Row::isNullValue(uint32_t colIndex) const case CalpontSystemCatalog::UTINYINT: return (data[offsets[colIndex]] == joblist::UTINYINTNULL); + case CalpontSystemCatalog::ENUM: case CalpontSystemCatalog::USMALLINT: return (*((uint16_t*)&data[offsets[colIndex]]) == joblist::USMALLINTNULL); diff --git a/utils/udfsdk/mcsv1_udaf.cpp b/utils/udfsdk/mcsv1_udaf.cpp index 291998103..f0b486e0e 100644 --- a/utils/udfsdk/mcsv1_udaf.cpp +++ b/utils/udfsdk/mcsv1_udaf.cpp @@ -81,6 +81,7 @@ int32_t mcsv1Context::getColWidth() case execplan::CalpontSystemCatalog::UTINYINT: case execplan::CalpontSystemCatalog::CHAR: fColWidth = 1; break; + case execplan::CalpontSystemCatalog::ENUM: case execplan::CalpontSystemCatalog::SMALLINT: case execplan::CalpontSystemCatalog::USMALLINT: fColWidth = 2; break; diff --git a/utils/windowfunction/wf_lead_lag.cpp b/utils/windowfunction/wf_lead_lag.cpp index ce61d20eb..e668fa655 100644 --- a/utils/windowfunction/wf_lead_lag.cpp +++ b/utils/windowfunction/wf_lead_lag.cpp @@ -66,6 +66,7 @@ boost::shared_ptr WF_lead_lag::makeFunction(int id, const break; } + case CalpontSystemCatalog::ENUM: case CalpontSystemCatalog::UTINYINT: case CalpontSystemCatalog::USMALLINT: case CalpontSystemCatalog::UMEDINT: diff --git a/utils/windowfunction/wf_min_max.cpp b/utils/windowfunction/wf_min_max.cpp index 7f6af5aab..906db5460 100644 --- a/utils/windowfunction/wf_min_max.cpp +++ b/utils/windowfunction/wf_min_max.cpp @@ -57,6 +57,7 @@ boost::shared_ptr WF_min_max::makeFunction(int id, const break; } + case CalpontSystemCatalog::ENUM: case CalpontSystemCatalog::UTINYINT: case CalpontSystemCatalog::USMALLINT: case CalpontSystemCatalog::UMEDINT: diff --git a/utils/windowfunction/wf_stats.cpp b/utils/windowfunction/wf_stats.cpp index c24abdf47..8d78016ff 100644 --- a/utils/windowfunction/wf_stats.cpp +++ b/utils/windowfunction/wf_stats.cpp @@ -62,6 +62,7 @@ boost::shared_ptr WF_stats::makeFunction(int id, const st break; } + case CalpontSystemCatalog::ENUM: case CalpontSystemCatalog::UTINYINT: case CalpontSystemCatalog::USMALLINT: case CalpontSystemCatalog::UMEDINT: