1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-01 06:46:55 +03:00

MCOL-1433 Fix some functions for TIME

Fixes the following:

* CAST() (as DATE/DATETIME)
* DATE()
* DATE_FORMAT()
* MAKEDATE()
* NULLIF()
* TIMEDIFF()
* TO_DAYS() / DATEDIFF()
This commit is contained in:
Andrew Hutchings
2018-07-12 15:13:43 +01:00
parent 1fa2537575
commit fb8aab959d
7 changed files with 134 additions and 1 deletions

View File

@ -146,11 +146,26 @@ uint64_t makedate(rowgroup::Row& row,
break;
}
case CalpontSystemCatalog::TIME:
{
std::ostringstream ss;
Time aTime = parm[1]->data()->getTimeIntVal(row, isNull);
ss << aTime.hour << aTime.minute << aTime.second;
dayofyear = ss.str();
break;
}
default:
isNull = true;
return 0;
}
if (atoi(dayofyear.c_str()) == 0)
{
isNull = true;
return 0;
}
// convert the year to a date in our internal format, then subtract
// one since we are about to add the day of year back in
Date d(year, 1, 1);