You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
fix(utils): MCOL-4605 handle negative decimals in FROM_UNIXTIME (#3466)
This commit is contained in:
@ -51,6 +51,12 @@ DateTime getDateTime(rowgroup::Row& row, FunctionParm& parm, bool& isNull)
|
||||
case execplan::CalpontSystemCatalog::DOUBLE:
|
||||
{
|
||||
double value = parm[0]->data()->getDoubleVal(row, isNull);
|
||||
if (value < 0)
|
||||
{
|
||||
isNull = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
double fracpart, intpart;
|
||||
fracpart = modf(value, &intpart);
|
||||
val = (int64_t)intpart;
|
||||
@ -62,6 +68,12 @@ DateTime getDateTime(rowgroup::Row& row, FunctionParm& parm, bool& isNull)
|
||||
{
|
||||
IDB_Decimal dec = parm[0]->data()->getDecimalVal(row, isNull);
|
||||
|
||||
if (dec.value < 0)
|
||||
{
|
||||
isNull = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (parm[0]->data()->resultType().colWidth == datatypes::MAXDECIMALWIDTH)
|
||||
{
|
||||
auto integralAndFractional = dec.getIntegralAndFractional();
|
||||
|
Reference in New Issue
Block a user