From 6e41b416372cc5db259039b72cb583c08070eb3f Mon Sep 17 00:00:00 2001 From: David Hall Date: Fri, 8 Jan 2021 15:00:31 -0600 Subject: [PATCH] MCOL-4472 Fix up floor() for the new format MariaDB 10.5 In 105, MariaDB expects a new format from floor() --- utils/funcexp/func_floor.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/utils/funcexp/func_floor.cpp b/utils/funcexp/func_floor.cpp index 98ca9d10f..42a79f45f 100644 --- a/utils/funcexp/func_floor.cpp +++ b/utils/funcexp/func_floor.cpp @@ -105,10 +105,12 @@ int64_t Func_floor::getIntVal(Row& row, case execplan::CalpontSystemCatalog::DATE: { - string str = DataConvert::dateToString1(parm[0]->data()->getDateIntVal(row, isNull)); - + // For some reason, MDB doesn't return this as a date, + // but datetime is returned as a datetime. Expect + // this to change in the future. + Date d (parm[0]->data()->getDateIntVal(row, isNull)); if (!isNull) - ret = atoll(str.c_str()); + ret = d.convertToMySQLint(); } break; @@ -127,14 +129,7 @@ int64_t Func_floor::getIntVal(Row& row, case execplan::CalpontSystemCatalog::TIME: { - string str = - DataConvert::timeToString1(parm[0]->data()->getTimeIntVal(row, isNull)); - - // strip off micro seconds - str = str.substr(0, 14); - - if (!isNull) - ret = atoll(str.c_str()); + ret = parm[0]->data()->getTimeIntVal(row, isNull); } break;