diff --git a/dbcon/mysql/ha_mcs_impl.cpp b/dbcon/mysql/ha_mcs_impl.cpp index f80f9738b..f334a3375 100644 --- a/dbcon/mysql/ha_mcs_impl.cpp +++ b/dbcon/mysql/ha_mcs_impl.cpp @@ -820,7 +820,6 @@ int fetchNextRow(uchar* buf, cal_table_info& ti, cal_connection_info* ci, bool h dataconvert::DataConvert::decimalToString(dec, (unsigned)colType.scale, buf, sizeof(buf), colType.colDataType); - std::cout << buf << std::endl; Field_new_decimal* f2 = (Field_new_decimal*)*f; f2->store(buf, strlen(buf), f2->charset()); diff --git a/utils/funcexp/func_ceil.cpp b/utils/funcexp/func_ceil.cpp index 26200a94f..5714b2349 100644 --- a/utils/funcexp/func_ceil.cpp +++ b/utils/funcexp/func_ceil.cpp @@ -70,8 +70,8 @@ int64_t Func_ceil::getIntVal(Row& row, } break; - // ceil(decimal(38,38)) leads to this path - // otherwise Func_ceil::getDecimalVal() is called + // ceil(decimal(X,Y)) leads to this path if X, Y allows to + // downcast to INT otherwise Func_ceil::getDecimalVal() is called case execplan::CalpontSystemCatalog::DECIMAL: case execplan::CalpontSystemCatalog::UDECIMAL: { diff --git a/utils/funcexp/func_floor.cpp b/utils/funcexp/func_floor.cpp index 5116a9a54..a8afa77f1 100644 --- a/utils/funcexp/func_floor.cpp +++ b/utils/funcexp/func_floor.cpp @@ -151,6 +151,24 @@ int64_t Func_floor::getIntVal(Row& row, } break; + // floor(decimal(X,Y)) leads to this path if X, Y allows to + // downcast to INT otherwise Func_floor::getDecimalVal() is called + case CalpontSystemCatalog::DECIMAL: + case CalpontSystemCatalog::UDECIMAL: + { + IDB_Decimal tmp = getDecimalVal(row, parm, isNull, op_ct); + + if (op_ct.colWidth == datatypes::MAXDECIMALWIDTH) + { + ret = datatypes::Decimal::getInt64FromWideDecimal(tmp.s128Value); + } + else + { + ret = tmp.value; + } + break; + } + default: { std::ostringstream oss;