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:
@ -155,6 +155,20 @@ double Func_acos::getDoubleVal(Row& row,
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::TIMESTAMP:
|
||||
{
|
||||
int64_t value = parm[0]->data()->getTimestampIntVal(row, isNull);
|
||||
|
||||
if (isNull || (value < -1.0 || value > 1.0))
|
||||
{
|
||||
isNull = true;
|
||||
return doubleNullVal();
|
||||
}
|
||||
|
||||
return acos((double)value);
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::TIME:
|
||||
{
|
||||
int64_t value = parm[0]->data()->getTimeIntVal(row, isNull);
|
||||
@ -259,6 +273,20 @@ double Func_asin::getDoubleVal(Row& row,
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::TIMESTAMP:
|
||||
{
|
||||
int64_t value = parm[0]->data()->getTimestampIntVal(row, isNull);
|
||||
|
||||
if (isNull || (value < -1.0 || value > 1.0))
|
||||
{
|
||||
isNull = true;
|
||||
return doubleNullVal();
|
||||
}
|
||||
|
||||
return asin((double)value);
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::TIME:
|
||||
{
|
||||
int64_t value = parm[0]->data()->getTimeIntVal(row, isNull);
|
||||
@ -402,6 +430,33 @@ double Func_atan::getDoubleVal(Row& row,
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::TIMESTAMP:
|
||||
{
|
||||
int64_t value = parm[0]->data()->getTimestampIntVal(row, isNull);
|
||||
|
||||
if (isNull)
|
||||
{
|
||||
isNull = true;
|
||||
return doubleNullVal();
|
||||
}
|
||||
|
||||
if (parm.size() > 1 )
|
||||
{
|
||||
double value2 = parm[1]->data()->getDoubleVal(row, isNull);
|
||||
|
||||
if (isNull)
|
||||
{
|
||||
isNull = true;
|
||||
return doubleNullVal();
|
||||
}
|
||||
|
||||
return atan2(value, value2);
|
||||
}
|
||||
|
||||
return atan((double)value);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case execplan::CalpontSystemCatalog::TIME:
|
||||
{
|
||||
@ -519,6 +574,20 @@ double Func_cos::getDoubleVal(Row& row,
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::TIMESTAMP:
|
||||
{
|
||||
int64_t value = parm[0]->data()->getTimestampIntVal(row, isNull);
|
||||
|
||||
if (isNull)
|
||||
{
|
||||
isNull = true;
|
||||
return doubleNullVal();
|
||||
}
|
||||
|
||||
return cos((double)value);
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::TIME:
|
||||
{
|
||||
int64_t value = parm[0]->data()->getTimeIntVal(row, isNull);
|
||||
@ -649,6 +718,29 @@ double Func_cot::getDoubleVal(Row& row,
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::TIMESTAMP:
|
||||
{
|
||||
int64_t value = parm[0]->data()->getTimestampIntVal(row, isNull);
|
||||
|
||||
if (value == 0)
|
||||
{
|
||||
Message::Args args;
|
||||
args.add("cot");
|
||||
args.add((uint64_t)value);
|
||||
unsigned errcode = ERR_FUNC_OUT_OF_RANGE_RESULT;
|
||||
throw IDBExcept(IDBErrorInfo::instance()->errorMsg(errcode, args), errcode);
|
||||
}
|
||||
|
||||
if (isNull)
|
||||
{
|
||||
isNull = true;
|
||||
return doubleNullVal();
|
||||
}
|
||||
|
||||
return 1.0 / tan((double)value);
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::TIME:
|
||||
{
|
||||
int64_t value = parm[0]->data()->getTimeIntVal(row, isNull);
|
||||
@ -798,6 +890,33 @@ double Func_log::getDoubleVal(Row& row,
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::TIMESTAMP:
|
||||
{
|
||||
int64_t value = parm[0]->data()->getTimestampIntVal(row, isNull);
|
||||
|
||||
if (isNull || value <= 0.0)
|
||||
{
|
||||
isNull = true;
|
||||
return doubleNullVal();
|
||||
}
|
||||
|
||||
if (parm.size() > 1 )
|
||||
{
|
||||
double value2 = parm[1]->data()->getDoubleVal(row, isNull);
|
||||
|
||||
if (isNull || (value2 <= 0.0 || value == 1.0) )
|
||||
{
|
||||
isNull = true;
|
||||
return doubleNullVal();
|
||||
}
|
||||
|
||||
return log(value2) / log((double)value);
|
||||
}
|
||||
|
||||
return log((double)value);
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::TIME:
|
||||
{
|
||||
int64_t value = parm[0]->data()->getTimeIntVal(row, isNull);
|
||||
@ -919,6 +1038,20 @@ double Func_log2::getDoubleVal(Row& row,
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::TIMESTAMP:
|
||||
{
|
||||
int64_t value = parm[0]->data()->getTimestampIntVal(row, isNull);
|
||||
|
||||
if (isNull || value <= 0.0)
|
||||
{
|
||||
isNull = true;
|
||||
return doubleNullVal();
|
||||
}
|
||||
|
||||
return log2(value);
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::TIME:
|
||||
{
|
||||
int64_t value = parm[0]->data()->getTimeIntVal(row, isNull);
|
||||
@ -1027,6 +1160,20 @@ double Func_log10::getDoubleVal(Row& row,
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::TIMESTAMP:
|
||||
{
|
||||
int64_t value = parm[0]->data()->getTimestampIntVal(row, isNull);
|
||||
|
||||
if (isNull || value <= 0.0)
|
||||
{
|
||||
isNull = true;
|
||||
return doubleNullVal();
|
||||
}
|
||||
|
||||
return log10((double)value);
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::TIME:
|
||||
{
|
||||
int64_t value = parm[0]->data()->getTimeIntVal(row, isNull);
|
||||
@ -1138,6 +1285,20 @@ double Func_sin::getDoubleVal(Row& row,
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::TIMESTAMP:
|
||||
{
|
||||
int64_t value = parm[0]->data()->getTimestampIntVal(row, isNull);
|
||||
|
||||
if (isNull)
|
||||
{
|
||||
isNull = true;
|
||||
return doubleNullVal();
|
||||
}
|
||||
|
||||
return sin((double)value);
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::TIME:
|
||||
{
|
||||
int64_t value = parm[0]->data()->getTimeIntVal(row, isNull);
|
||||
@ -1241,6 +1402,20 @@ double Func_sqrt::getDoubleVal(Row& row,
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::TIMESTAMP:
|
||||
{
|
||||
int64_t value = parm[0]->data()->getTimestampIntVal(row, isNull);
|
||||
|
||||
if (isNull || value < 0)
|
||||
{
|
||||
isNull = true;
|
||||
return doubleNullVal();
|
||||
}
|
||||
|
||||
return sqrt((double)value);
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::TIME:
|
||||
{
|
||||
int64_t value = parm[0]->data()->getTimeIntVal(row, isNull);
|
||||
@ -1344,6 +1519,20 @@ double Func_tan::getDoubleVal(Row& row,
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::TIMESTAMP:
|
||||
{
|
||||
int64_t value = parm[0]->data()->getTimestampIntVal(row, isNull);
|
||||
|
||||
if (isNull)
|
||||
{
|
||||
isNull = true;
|
||||
return doubleNullVal();
|
||||
}
|
||||
|
||||
return tan((double)value);
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::TIME:
|
||||
{
|
||||
int64_t value = parm[0]->data()->getTimeIntVal(row, isNull);
|
||||
@ -1445,6 +1634,12 @@ string Func_format::getStrVal(Row& row,
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::TIMESTAMP:
|
||||
{
|
||||
value = dataconvert::DataConvert::timestampToString1(parm[0]->data()->getTimestampIntVal(row, isNull), fTimeZone);
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::TIME:
|
||||
{
|
||||
value = dataconvert::DataConvert::timeToString1(parm[0]->data()->getTimeIntVal(row, isNull));
|
||||
@ -1692,6 +1887,20 @@ double Func_radians::getDoubleVal(Row& row,
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::TIMESTAMP:
|
||||
{
|
||||
int64_t value = parm[0]->data()->getTimestampIntVal(row, isNull);
|
||||
|
||||
if (isNull)
|
||||
{
|
||||
isNull = true;
|
||||
return doubleNullVal();
|
||||
}
|
||||
|
||||
return radians((double)value);
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::TIME:
|
||||
{
|
||||
int64_t value = parm[0]->data()->getTimeIntVal(row, isNull);
|
||||
@ -1795,6 +2004,20 @@ double Func_degrees::getDoubleVal(Row& row,
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::TIMESTAMP:
|
||||
{
|
||||
int64_t value = parm[0]->data()->getTimestampIntVal(row, isNull);
|
||||
|
||||
if (isNull)
|
||||
{
|
||||
isNull = true;
|
||||
return doubleNullVal();
|
||||
}
|
||||
|
||||
return degrees((double)value);
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::TIME:
|
||||
{
|
||||
int64_t value = parm[0]->data()->getTimeIntVal(row, isNull);
|
||||
|
Reference in New Issue
Block a user