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
MCOL-23 Fix from_unixtime and nullif
This commit is contained in:
@ -145,6 +145,7 @@ int64_t Func_from_unixtime::getIntVal(rowgroup::Row& row,
|
|||||||
bool& isNull,
|
bool& isNull,
|
||||||
CalpontSystemCatalog::ColType& ct)
|
CalpontSystemCatalog::ColType& ct)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
DateTime dt = getDateTime(row, parm, isNull);
|
DateTime dt = getDateTime(row, parm, isNull);
|
||||||
if (*reinterpret_cast<int64_t*>(&dt) == 0)
|
if (*reinterpret_cast<int64_t*>(&dt) == 0)
|
||||||
{
|
{
|
||||||
@ -156,7 +157,8 @@ int64_t Func_from_unixtime::getIntVal(rowgroup::Row& row,
|
|||||||
dt.year, dt.month, dt.day, dt.hour,
|
dt.year, dt.month, dt.day, dt.hour,
|
||||||
dt.minute, dt.second );
|
dt.minute, dt.second );
|
||||||
return atoll(buf);
|
return atoll(buf);
|
||||||
// return getDatetimeIntVal(row, parm, isNull, ct);
|
#endif
|
||||||
|
return getDatetimeIntVal(row, parm, isNull, ct);
|
||||||
}
|
}
|
||||||
|
|
||||||
double Func_from_unixtime::getDoubleVal(rowgroup::Row& row,
|
double Func_from_unixtime::getDoubleVal(rowgroup::Row& row,
|
||||||
|
@ -91,8 +91,18 @@ int64_t Func_nullif::getIntVal(rowgroup::Row& row,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case execplan::CalpontSystemCatalog::DATE:
|
case execplan::CalpontSystemCatalog::DATE:
|
||||||
|
{
|
||||||
|
if (parm[0]->data()->resultType().colDataType ==
|
||||||
|
execplan::CalpontSystemCatalog::DATETIME)
|
||||||
|
{
|
||||||
|
// If we're comparing to a datetime field, promote.
|
||||||
|
exp2 = parm[0]->data()->getDatetimeIntVal(row, isNull);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
exp2 = parm[1]->data()->getDateIntVal(row, isNull);
|
exp2 = parm[1]->data()->getDateIntVal(row, isNull);
|
||||||
|
}
|
||||||
|
|
||||||
if (isNull) {
|
if (isNull) {
|
||||||
isNull = false;
|
isNull = false;
|
||||||
return exp1;
|
return exp1;
|
||||||
@ -104,6 +114,20 @@ int64_t Func_nullif::getIntVal(rowgroup::Row& row,
|
|||||||
case execplan::CalpontSystemCatalog::DATETIME:
|
case execplan::CalpontSystemCatalog::DATETIME:
|
||||||
{
|
{
|
||||||
exp2 = parm[1]->data()->getDatetimeIntVal(row, isNull);
|
exp2 = parm[1]->data()->getDatetimeIntVal(row, isNull);
|
||||||
|
if (parm[0]->data()->resultType().colDataType ==
|
||||||
|
execplan::CalpontSystemCatalog::DATE)
|
||||||
|
{
|
||||||
|
// When comparing exp1 as a Date, we can't simply promote. We have
|
||||||
|
// to be careful of the return value in case of not null return.
|
||||||
|
int64_t exp1 = parm[0]->data()->getDatetimeIntVal(row, isNull);
|
||||||
|
if ( exp1 == exp2 )
|
||||||
|
{
|
||||||
|
isNull = true;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
// since exp1 here is inside the block, when we leave the block, the
|
||||||
|
// original (Date) value is restored.
|
||||||
|
}
|
||||||
if (isNull) {
|
if (isNull) {
|
||||||
isNull = false;
|
isNull = false;
|
||||||
return exp1;
|
return exp1;
|
||||||
|
Reference in New Issue
Block a user