You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
clang format apply
This commit is contained in:
@ -16,10 +16,10 @@
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
/****************************************************************************
|
||||
* $Id: func_div.cpp 3921 2013-06-19 18:59:56Z bwilkinson $
|
||||
*
|
||||
*
|
||||
****************************************************************************/
|
||||
* $Id: func_div.cpp 3921 2013-06-19 18:59:56Z bwilkinson $
|
||||
*
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
@ -38,27 +38,25 @@ using namespace execplan;
|
||||
|
||||
namespace funcexp
|
||||
{
|
||||
|
||||
CalpontSystemCatalog::ColType Func_div::operationType( FunctionParm& fp, CalpontSystemCatalog::ColType& resultType )
|
||||
CalpontSystemCatalog::ColType Func_div::operationType(FunctionParm& fp,
|
||||
CalpontSystemCatalog::ColType& resultType)
|
||||
{
|
||||
return resultType;
|
||||
return resultType;
|
||||
}
|
||||
|
||||
int64_t Func_div::getIntVal(rowgroup::Row& row,
|
||||
FunctionParm& parm,
|
||||
bool& isNull,
|
||||
int64_t Func_div::getIntVal(rowgroup::Row& row, FunctionParm& parm, bool& isNull,
|
||||
CalpontSystemCatalog::ColType& op_ct)
|
||||
{
|
||||
double val1 = parm[0]->data()->getDoubleVal(row, isNull);
|
||||
double val2 = parm[1]->data()->getDoubleVal(row, isNull);
|
||||
|
||||
if (val2 == 0 || val2 == NAN)
|
||||
{
|
||||
isNull = true;
|
||||
return 0;
|
||||
}
|
||||
// MCOL-179 InnoDB doesn't round or convert to int before dividing.
|
||||
return static_cast<int64_t>(val1 / val2);
|
||||
double val1 = parm[0]->data()->getDoubleVal(row, isNull);
|
||||
double val2 = parm[1]->data()->getDoubleVal(row, isNull);
|
||||
|
||||
if (val2 == 0 || val2 == NAN)
|
||||
{
|
||||
isNull = true;
|
||||
return 0;
|
||||
}
|
||||
// MCOL-179 InnoDB doesn't round or convert to int before dividing.
|
||||
return static_cast<int64_t>(val1 / val2);
|
||||
|
||||
#if 0
|
||||
int64_t int_val2 = (int64_t)(val2 > 0 ? val2 + 0.5 : val2 - 0.5);
|
||||
@ -79,45 +77,35 @@ int64_t Func_div::getIntVal(rowgroup::Row& row,
|
||||
}
|
||||
|
||||
return int_val1 / int_val2;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
uint64_t Func_div::getUintVal(rowgroup::Row& row,
|
||||
FunctionParm& parm,
|
||||
bool& isNull,
|
||||
uint64_t Func_div::getUintVal(rowgroup::Row& row, FunctionParm& parm, bool& isNull,
|
||||
CalpontSystemCatalog::ColType& op_ct)
|
||||
{
|
||||
uint64_t val1 = parm[0]->data()->getUintVal(row, isNull);
|
||||
uint64_t val2 = parm[1]->data()->getUintVal(row, isNull);
|
||||
uint64_t val1 = parm[0]->data()->getUintVal(row, isNull);
|
||||
uint64_t val2 = parm[1]->data()->getUintVal(row, isNull);
|
||||
|
||||
if (val2 == 0)
|
||||
{
|
||||
isNull = true;
|
||||
return 0;
|
||||
}
|
||||
if (val2 == 0)
|
||||
{
|
||||
isNull = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return val1 / val2;
|
||||
return val1 / val2;
|
||||
}
|
||||
|
||||
|
||||
double Func_div::getDoubleVal(rowgroup::Row& row,
|
||||
FunctionParm& parm,
|
||||
bool& isNull,
|
||||
double Func_div::getDoubleVal(rowgroup::Row& row, FunctionParm& parm, bool& isNull,
|
||||
execplan::CalpontSystemCatalog::ColType& ct)
|
||||
{
|
||||
return getIntVal(row, parm, isNull, ct);
|
||||
return getIntVal(row, parm, isNull, ct);
|
||||
}
|
||||
|
||||
|
||||
string Func_div::getStrVal(rowgroup::Row& row,
|
||||
FunctionParm& parm,
|
||||
bool& isNull,
|
||||
string Func_div::getStrVal(rowgroup::Row& row, FunctionParm& parm, bool& isNull,
|
||||
CalpontSystemCatalog::ColType& ct)
|
||||
{
|
||||
return intToString(getIntVal(row, parm, isNull, ct));
|
||||
return intToString(getIntVal(row, parm, isNull, ct));
|
||||
}
|
||||
|
||||
|
||||
} // namespace funcexp
|
||||
} // namespace funcexp
|
||||
// vim:ts=4 sw=4:
|
||||
|
Reference in New Issue
Block a user