You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-29 08:21:15 +03:00
MCOL-265 Add support for TIMESTAMP data type
This commit is contained in:
@ -491,6 +491,52 @@ IDB_Decimal Func_truncate::getDecimalVal(Row& row,
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::TIMESTAMP:
|
||||
{
|
||||
int32_t s = 0;
|
||||
int64_t x = 0;
|
||||
|
||||
string value =
|
||||
DataConvert::timestampToString1(parm[0]->data()->getTimestampIntVal(row, isNull), fTimeZone);
|
||||
|
||||
s = parm[1]->data()->getIntVal(row, isNull);
|
||||
|
||||
if (!isNull)
|
||||
{
|
||||
//strip off micro seconds
|
||||
value = value.substr(0, 14);
|
||||
x = atoll(value.c_str());
|
||||
|
||||
if ( s > 5 )
|
||||
s = 0;
|
||||
|
||||
if ( s > 0 )
|
||||
{
|
||||
x *= helpers::powerOf10_c[s];
|
||||
}
|
||||
else if (s < 0)
|
||||
{
|
||||
s = -s;
|
||||
|
||||
if ( s >= (int32_t) value.size() )
|
||||
{
|
||||
x = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
x /= helpers::powerOf10_c[s];
|
||||
x *= helpers::powerOf10_c[s];
|
||||
}
|
||||
|
||||
s = 0;
|
||||
}
|
||||
}
|
||||
|
||||
decimal.value = x;
|
||||
decimal.scale = s;
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::TIME:
|
||||
{
|
||||
int32_t s = 0;
|
||||
|
Reference in New Issue
Block a user