1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

Merge pull request #37 from mariadb-corporation/MCOL-98

MCOL-98
This commit is contained in:
Andrew Hutchings
2016-10-11 09:37:14 +00:00
committed by GitHub
5 changed files with 33 additions and 5 deletions

View File

@ -55,7 +55,7 @@ int64_t Func_div::getIntVal(rowgroup::Row& row,
if (int_val2 == 0)
{
isNull = true;
return 0;
return NULL;
}
int64_t int_val1 = (int64_t)(val1 > 0 ? val1 + 0.5 : val1 - 0.5);
// MCOL-176 If abs(int_val2) is small enough (like -1), then, this may cause overflow.
@ -78,7 +78,7 @@ uint64_t Func_div::getUintVal(rowgroup::Row& row,
if (val2 == 0)
{
isNull = true;
return 0;
return NULL;
}
return val1 / val2;
}

View File

@ -33,6 +33,11 @@ using namespace execplan;
#include "rowgroup.h"
using namespace rowgroup;
#include "errorcodes.h"
#include "idberrorinfo.h"
#include "errorids.h"
using namespace logging;
namespace funcexp
{
@ -58,7 +63,14 @@ double Func_exp::getDoubleVal(Row& row,
if (errno == ERANGE) // display NULL for out range value
{
if (x > 0)
{
isNull = true;
Message::Args args;
args.add("exp");
args.add(x);
unsigned errcode = ERR_FUNC_OUT_OF_RANGE_RESULT;
throw IDBExcept(IDBErrorInfo::instance()->errorMsg(errcode, args), errcode);
}
else
ret = 0.0;
}

View File

@ -497,7 +497,7 @@ double Func_cot::getDoubleVal(Row& row,
Message::Args args;
args.add("cot");
args.add(value);
unsigned errcode = ERR_INCORRECT_VALUE;
unsigned errcode = ERR_FUNC_OUT_OF_RANGE_RESULT;
throw IDBExcept(IDBErrorInfo::instance()->errorMsg(errcode, args), errcode);
}
if (isNull)
@ -518,7 +518,7 @@ double Func_cot::getDoubleVal(Row& row,
Message::Args args;
args.add("cot");
args.add(value);
unsigned errcode = ERR_INCORRECT_VALUE;
unsigned errcode = ERR_FUNC_OUT_OF_RANGE_RESULT;
throw IDBExcept(IDBErrorInfo::instance()->errorMsg(errcode, args), errcode);
}
@ -540,7 +540,7 @@ double Func_cot::getDoubleVal(Row& row,
Message::Args args;
args.add("cot");
args.add((uint64_t)value);
unsigned errcode = ERR_INCORRECT_VALUE;
unsigned errcode = ERR_FUNC_OUT_OF_RANGE_RESULT;
throw IDBExcept(IDBErrorInfo::instance()->errorMsg(errcode, args), errcode);
}
if (isNull)

View File

@ -37,6 +37,11 @@ using namespace execplan;
#include "rowgroup.h"
using namespace rowgroup;
#include "errorcodes.h"
#include "idberrorinfo.h"
#include "errorids.h"
using namespace logging;
namespace funcexp
{
@ -65,7 +70,16 @@ double Func_pow::getDoubleVal(Row& row,
// @bug3490, 4461, rule out domain error, pole error and overflow range error.
if (!isfinite(x))
{
isNull = true;
Message::Args args;
args.add("pow");
args.add(base);
args.add(exponent);
unsigned errcode = ERR_FUNC_OUT_OF_RANGE_RESULT;
throw IDBExcept(IDBErrorInfo::instance()->errorMsg(errcode, args), errcode);
}
return x;
}