1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

fix(funcexp): MCOL-5237 Proper handle DATETIME column for "ifnull" function. (#3196)

This commit is contained in:
Denis Khalikov
2024-06-17 14:09:14 +03:00
committed by GitHub
parent 113d9873a3
commit b1045d27b6
3 changed files with 51 additions and 1 deletions

View File

@ -25,6 +25,7 @@
#include <string>
using namespace std;
#include "constantcolumn.h"
#include "functor_all.h"
#include "functioncolumn.h"
using namespace execplan;
@ -60,7 +61,14 @@ int64_t Func_ifnull::getIntVal(Row& row, FunctionParm& parm, bool& isNull, Calpo
if (isNull)
{
isNull = false;
return parm[1]->data()->getIntVal(row, isNull);
r = parm[1]->data()->getIntVal(row, isNull);
// MCOL-5237 In case we substitude a null value for `DATETIME` column with a value from `ConstantColumn`
// we have to convert the value into the `DATETIME` format for `int64_t` type.
if (parm[0]->data()->resultType().colDataType == CalpontSystemCatalog::DATETIME &&
dynamic_cast<ConstantColumn*>(parm[1]->data()))
{
r = r << 48;
}
}
return r;