You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-29 08:21:15 +03:00
MCOL-98: Added error message for functions returning out of range values.
This commit is contained in:
@ -34,6 +34,11 @@ using namespace std;
|
||||
#include "rowgroup.h"
|
||||
using namespace execplan;
|
||||
|
||||
#include "errorcodes.h"
|
||||
#include "idberrorinfo.h"
|
||||
#include "errorids.h"
|
||||
using namespace logging;
|
||||
|
||||
#include "dataconvert.h"
|
||||
|
||||
namespace funcexp
|
||||
@ -55,7 +60,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 +83,7 @@ uint64_t Func_div::getUintVal(rowgroup::Row& row,
|
||||
if (val2 == 0)
|
||||
{
|
||||
isNull = true;
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
return val1 / val2;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -95,6 +95,8 @@
|
||||
2051 ERR_DBJ_DATA_DISTRIBUTION The data distribution in this query overflowed a disk-based join bucket. If possible, raise infinidb_diskjoin_bucketsize and try again.
|
||||
2052 INFO_SWITCHING_TO_DJS Out of UM memory, switching to disk-based join.
|
||||
|
||||
2053 ERR_FUNC_OUT_OF_RANGE_RESULT The result is out of range for function %1% using value(s): %2% %3%
|
||||
|
||||
# Sub-query errors
|
||||
3001 ERR_NON_SUPPORT_SUB_QUERY_TYPE This subquery type is not supported yet.
|
||||
3002 ERR_MORE_THAN_1_ROW Subquery returns more than 1 row.
|
||||
|
Reference in New Issue
Block a user