From 30b4edb0cdf91bdd4783d3da04782b6e13bad2dd Mon Sep 17 00:00:00 2001 From: David Hall Date: Fri, 2 Feb 2018 15:30:12 -0600 Subject: [PATCH] MCOL-1178 Add bool processing to CASE --- utils/funcexp/func_case.cpp | 26 ++++++++++++++++++++++++++ utils/funcexp/functor_all.h | 10 ++++++++++ 2 files changed, 36 insertions(+) diff --git a/utils/funcexp/func_case.cpp b/utils/funcexp/func_case.cpp index fc82ae771..7cc033f85 100644 --- a/utils/funcexp/func_case.cpp +++ b/utils/funcexp/func_case.cpp @@ -343,6 +343,20 @@ CalpontSystemCatalog::ColType Func_simple_case::operationType(FunctionParm& fp, } +bool Func_simple_case::getBoolVal(Row& row, + FunctionParm& parm, + bool& isNull, + CalpontSystemCatalog::ColType& operationColType) +{ + uint64_t i = simple_case_cmp(row, parm, isNull, operationColType); + + if (isNull) + return joblist::BIGINTNULL; + + return parm[i+1]->data()->getBoolVal(row, isNull); +} + + int64_t Func_simple_case::getIntVal(Row& row, FunctionParm& parm, bool& isNull, @@ -446,6 +460,18 @@ CalpontSystemCatalog::ColType Func_searched_case::operationType(FunctionParm& fp return caseOperationType(fp, resultType, false); } +bool Func_searched_case::getBoolVal(Row& row, + FunctionParm& parm, + bool& isNull, + CalpontSystemCatalog::ColType&) +{ + uint64_t i = searched_case_cmp(row, parm, isNull); + + if (isNull) + return joblist::BIGINTNULL; + + return parm[i+1]->data()->getBoolVal(row, isNull); +} int64_t Func_searched_case::getIntVal(Row& row, FunctionParm& parm, diff --git a/utils/funcexp/functor_all.h b/utils/funcexp/functor_all.h index db7b8a491..84a951269 100644 --- a/utils/funcexp/functor_all.h +++ b/utils/funcexp/functor_all.h @@ -70,6 +70,11 @@ public: execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType); + bool getBoolVal(rowgroup::Row& row, + FunctionParm& fp, + bool& isNull, + execplan::CalpontSystemCatalog::ColType& op_ct); + int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, @@ -112,6 +117,11 @@ public: execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType); + bool getBoolVal(rowgroup::Row& row, + FunctionParm& fp, + bool& isNull, + execplan::CalpontSystemCatalog::ColType& op_ct); + int64_t getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull,