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-289 Fix MCOL(0) handling
Now throws an error instead of returning NULL to align with MariaDB
This commit is contained in:
@ -469,7 +469,7 @@ double Func_cot::getDoubleVal(Row& row,
|
||||
bool& isNull,
|
||||
CalpontSystemCatalog::ColType&)
|
||||
{
|
||||
switch (parm[0]->data()->resultType().colDataType)
|
||||
switch (parm[0]->data()->resultType().colDataType)
|
||||
{
|
||||
case execplan::CalpontSystemCatalog::BIGINT:
|
||||
case execplan::CalpontSystemCatalog::INT:
|
||||
@ -492,6 +492,14 @@ double Func_cot::getDoubleVal(Row& row,
|
||||
{
|
||||
// null value is indicated by isNull
|
||||
double value = parm[0]->data()->getDoubleVal(row, isNull);
|
||||
if (value == 0)
|
||||
{
|
||||
Message::Args args;
|
||||
args.add("cot");
|
||||
args.add(value);
|
||||
unsigned errcode = ERR_INCORRECT_VALUE;
|
||||
throw IDBExcept(IDBErrorInfo::instance()->errorMsg(errcode, args), errcode);
|
||||
}
|
||||
if (isNull)
|
||||
{
|
||||
isNull = true;
|
||||
@ -505,6 +513,15 @@ double Func_cot::getDoubleVal(Row& row,
|
||||
case execplan::CalpontSystemCatalog::DATE:
|
||||
{
|
||||
int32_t value = parm[0]->data()->getDateIntVal(row, isNull);
|
||||
if (value == 0)
|
||||
{
|
||||
Message::Args args;
|
||||
args.add("cot");
|
||||
args.add(value);
|
||||
unsigned errcode = ERR_INCORRECT_VALUE;
|
||||
throw IDBExcept(IDBErrorInfo::instance()->errorMsg(errcode, args), errcode);
|
||||
}
|
||||
|
||||
if (isNull)
|
||||
{
|
||||
isNull = true;
|
||||
@ -518,6 +535,14 @@ double Func_cot::getDoubleVal(Row& row,
|
||||
case execplan::CalpontSystemCatalog::DATETIME:
|
||||
{
|
||||
int64_t value = parm[0]->data()->getDatetimeIntVal(row, isNull);
|
||||
if (value == 0)
|
||||
{
|
||||
Message::Args args;
|
||||
args.add("cot");
|
||||
args.add((uint64_t)value);
|
||||
unsigned errcode = ERR_INCORRECT_VALUE;
|
||||
throw IDBExcept(IDBErrorInfo::instance()->errorMsg(errcode, args), errcode);
|
||||
}
|
||||
if (isNull)
|
||||
{
|
||||
isNull = true;
|
||||
@ -530,7 +555,7 @@ double Func_cot::getDoubleVal(Row& row,
|
||||
|
||||
default:
|
||||
{
|
||||
std::ostringstream oss;
|
||||
std::ostringstream oss;
|
||||
oss << "cot: datatype of " << execplan::colDataTypeToString(parm[0]->data()->resultType().colDataType);
|
||||
throw logging::IDBExcept(oss.str(), ERR_DATATYPE_NOT_SUPPORT);
|
||||
}
|
||||
|
Reference in New Issue
Block a user