You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-01 06:46:55 +03:00
MCOL-898 In func_if, handle isNull better
This commit is contained in:
@ -35,9 +35,10 @@ using namespace rowgroup;
|
|||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
||||||
bool boolVal(SPTP& parm, Row& row, bool& isNull)
|
bool boolVal(SPTP& parm, Row& row)
|
||||||
{
|
{
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
|
bool isNull = false; // Keep it local. We don't want to mess with the global one here.
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ret = parm->getBoolVal(row, isNull);
|
ret = parm->getBoolVal(row, isNull);
|
||||||
@ -119,13 +120,12 @@ int64_t Func_if::getIntVal(Row& row,
|
|||||||
bool& isNull,
|
bool& isNull,
|
||||||
CalpontSystemCatalog::ColType&)
|
CalpontSystemCatalog::ColType&)
|
||||||
{
|
{
|
||||||
if (boolVal(parm[0], row, isNull) && !isNull)
|
if (boolVal(parm[0], row))
|
||||||
{
|
{
|
||||||
return parm[1]->data()->getIntVal(row, isNull);
|
return parm[1]->data()->getIntVal(row, isNull);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
isNull = false;
|
|
||||||
return parm[2]->data()->getIntVal(row, isNull);
|
return parm[2]->data()->getIntVal(row, isNull);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -137,14 +137,12 @@ string Func_if::getStrVal(Row& row,
|
|||||||
CalpontSystemCatalog::ColType&)
|
CalpontSystemCatalog::ColType&)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (boolVal(parm[0], row, isNull))
|
if (boolVal(parm[0], row))
|
||||||
{
|
{
|
||||||
isNull = false;
|
|
||||||
return parm[1]->data()->getStrVal(row, isNull);
|
return parm[1]->data()->getStrVal(row, isNull);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
isNull = false;
|
|
||||||
return parm[2]->data()->getStrVal(row, isNull);
|
return parm[2]->data()->getStrVal(row, isNull);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -155,14 +153,12 @@ IDB_Decimal Func_if::getDecimalVal(Row& row,
|
|||||||
bool& isNull,
|
bool& isNull,
|
||||||
CalpontSystemCatalog::ColType&)
|
CalpontSystemCatalog::ColType&)
|
||||||
{
|
{
|
||||||
if (boolVal(parm[0], row, isNull))
|
if (boolVal(parm[0], row))
|
||||||
{
|
{
|
||||||
isNull = false;
|
|
||||||
return parm[1]->data()->getDecimalVal(row, isNull);
|
return parm[1]->data()->getDecimalVal(row, isNull);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
isNull = false;
|
|
||||||
return parm[2]->data()->getDecimalVal(row, isNull);
|
return parm[2]->data()->getDecimalVal(row, isNull);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -173,14 +169,12 @@ double Func_if::getDoubleVal(Row& row,
|
|||||||
bool& isNull,
|
bool& isNull,
|
||||||
CalpontSystemCatalog::ColType&)
|
CalpontSystemCatalog::ColType&)
|
||||||
{
|
{
|
||||||
if (boolVal(parm[0], row, isNull))
|
if (boolVal(parm[0], row))
|
||||||
{
|
{
|
||||||
isNull = false;
|
|
||||||
return parm[1]->data()->getDoubleVal(row, isNull);
|
return parm[1]->data()->getDoubleVal(row, isNull);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
isNull = false;
|
|
||||||
return parm[2]->data()->getDoubleVal(row, isNull);
|
return parm[2]->data()->getDoubleVal(row, isNull);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -191,14 +185,12 @@ int32_t Func_if::getDateIntVal(Row& row,
|
|||||||
bool& isNull,
|
bool& isNull,
|
||||||
CalpontSystemCatalog::ColType&)
|
CalpontSystemCatalog::ColType&)
|
||||||
{
|
{
|
||||||
if (boolVal(parm[0], row, isNull))
|
if (boolVal(parm[0], row))
|
||||||
{
|
{
|
||||||
isNull = false;
|
|
||||||
return parm[1]->data()->getDateIntVal(row, isNull);
|
return parm[1]->data()->getDateIntVal(row, isNull);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
isNull = false;
|
|
||||||
return parm[2]->data()->getDateIntVal(row, isNull);
|
return parm[2]->data()->getDateIntVal(row, isNull);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -209,14 +201,12 @@ int64_t Func_if::getDatetimeIntVal(Row& row,
|
|||||||
bool& isNull,
|
bool& isNull,
|
||||||
CalpontSystemCatalog::ColType&)
|
CalpontSystemCatalog::ColType&)
|
||||||
{
|
{
|
||||||
if (boolVal(parm[0], row, isNull))
|
if (boolVal(parm[0], row))
|
||||||
{
|
{
|
||||||
isNull = false;
|
|
||||||
return parm[1]->data()->getDatetimeIntVal(row, isNull);
|
return parm[1]->data()->getDatetimeIntVal(row, isNull);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
isNull = false;
|
|
||||||
return parm[2]->data()->getDatetimeIntVal(row, isNull);
|
return parm[2]->data()->getDatetimeIntVal(row, isNull);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user