You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-05 15:41:14 +03:00
MCOL-4263 return int for func_floor on datetime
For TIMESTAMP, it should do similar. However, it didn't work. For some reason, MDB has the function set as DATETIME, which for cs, isn't the same thing. Added a kludge to ha_mcs_execplan.cpp to handle it.
This commit is contained in:
@ -4149,6 +4149,14 @@ ReturnedColumn* buildFunctionColumn(
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
fc->operationType(functor->operationType(funcParms, fc->resultType()));
|
fc->operationType(functor->operationType(funcParms, fc->resultType()));
|
||||||
|
// For some reason, MDB has MYSQL_TYPE_DATETIME2 for functions on a TIMESTAMP
|
||||||
|
if (fc->operationType().colDataType == CalpontSystemCatalog::TIMESTAMP)
|
||||||
|
{
|
||||||
|
CalpontSystemCatalog::ColType ct = fc->resultType();
|
||||||
|
ct.colDataType = CalpontSystemCatalog::TIMESTAMP;
|
||||||
|
ct.colWidth = 8;
|
||||||
|
fc->resultType(ct);
|
||||||
|
}
|
||||||
fc->expressionId(ci->expressionId++);
|
fc->expressionId(ci->expressionId++);
|
||||||
// A few functions use a different collation than that found in
|
// A few functions use a different collation than that found in
|
||||||
// the base ifp class
|
// the base ifp class
|
||||||
|
@ -114,27 +114,14 @@ int64_t Func_floor::getIntVal(Row& row,
|
|||||||
|
|
||||||
case execplan::CalpontSystemCatalog::DATETIME:
|
case execplan::CalpontSystemCatalog::DATETIME:
|
||||||
{
|
{
|
||||||
string str =
|
ret = parm[0]->data()->getDatetimeIntVal(row, isNull);
|
||||||
DataConvert::datetimeToString1(parm[0]->data()->getDatetimeIntVal(row, isNull));
|
|
||||||
|
|
||||||
// strip off micro seconds
|
|
||||||
str = str.substr(0, 14);
|
|
||||||
|
|
||||||
if (!isNull)
|
|
||||||
ret = atoll(str.c_str());
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case execplan::CalpontSystemCatalog::TIMESTAMP:
|
case execplan::CalpontSystemCatalog::TIMESTAMP:
|
||||||
{
|
{
|
||||||
string str =
|
ret = parm[0]->data()->getTimestampIntVal(row, isNull);
|
||||||
DataConvert::timestampToString1(parm[0]->data()->getTimestampIntVal(row, isNull), timeZone());
|
|
||||||
|
|
||||||
// strip off micro seconds
|
|
||||||
str = str.substr(0, 14);
|
|
||||||
|
|
||||||
if (!isNull)
|
|
||||||
ret = atoll(str.c_str());
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user