You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-12-24 14:20:59 +03:00
MCOL-1822 Intermediate checkin. DISTINCT not working.
This commit is contained in:
@@ -118,6 +118,12 @@ int64_t Func_floor::getIntVal(Row& row,
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::LONGDOUBLE:
|
||||
{
|
||||
ret = (int64_t) floorl(parm[0]->data()->getLongDoubleVal(row, isNull));
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::VARCHAR:
|
||||
case execplan::CalpontSystemCatalog::CHAR:
|
||||
case execplan::CalpontSystemCatalog::TEXT:
|
||||
@@ -216,6 +222,12 @@ uint64_t Func_floor::getUintVal(Row& row,
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::LONGDOUBLE:
|
||||
{
|
||||
ret = (uint64_t) floorl(parm[0]->data()->getLongDoubleVal(row, isNull));
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::VARCHAR:
|
||||
case execplan::CalpontSystemCatalog::CHAR:
|
||||
case execplan::CalpontSystemCatalog::TEXT:
|
||||
@@ -286,6 +298,10 @@ double Func_floor::getDoubleVal(Row& row,
|
||||
{
|
||||
ret = floor(parm[0]->data()->getDoubleVal(row, isNull));
|
||||
}
|
||||
else if (op_ct.colDataType == CalpontSystemCatalog::LONGDOUBLE)
|
||||
{
|
||||
ret = floorl(parm[0]->data()->getLongDoubleVal(row, isNull));
|
||||
}
|
||||
else if (op_ct.colDataType == CalpontSystemCatalog::VARCHAR ||
|
||||
op_ct.colDataType == CalpontSystemCatalog::CHAR ||
|
||||
op_ct.colDataType == CalpontSystemCatalog::TEXT)
|
||||
@@ -303,6 +319,38 @@ double Func_floor::getDoubleVal(Row& row,
|
||||
return ret;
|
||||
}
|
||||
|
||||
long double Func_floor::getLongDoubleVal(Row& row,
|
||||
FunctionParm& parm,
|
||||
bool& isNull,
|
||||
CalpontSystemCatalog::ColType& op_ct)
|
||||
{
|
||||
long double ret = 0.0;
|
||||
|
||||
if (op_ct.colDataType == CalpontSystemCatalog::LONGDOUBLE ||
|
||||
op_ct.colDataType == CalpontSystemCatalog::FLOAT)
|
||||
{
|
||||
ret = floor(parm[0]->data()->getDoubleVal(row, isNull));
|
||||
}
|
||||
else if (op_ct.colDataType == CalpontSystemCatalog::LONGDOUBLE)
|
||||
{
|
||||
ret = floorl(parm[0]->data()->getLongDoubleVal(row, isNull));
|
||||
}
|
||||
else if (op_ct.colDataType == CalpontSystemCatalog::VARCHAR ||
|
||||
op_ct.colDataType == CalpontSystemCatalog::CHAR ||
|
||||
op_ct.colDataType == CalpontSystemCatalog::TEXT)
|
||||
{
|
||||
const string& str = parm[0]->data()->getStrVal(row, isNull);
|
||||
|
||||
if (!isNull)
|
||||
ret = floor(strtod(str.c_str(), 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = (long double) getIntVal(row, parm, isNull, op_ct);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
string Func_floor::getStrVal(Row& row,
|
||||
FunctionParm& parm,
|
||||
@@ -329,6 +377,18 @@ string Func_floor::getStrVal(Row& row,
|
||||
|
||||
*d = '\0';
|
||||
}
|
||||
if (op_ct.colDataType == CalpontSystemCatalog::LONGDOUBLE)
|
||||
{
|
||||
snprintf(tmp, 511, "%Lf", getLongDoubleVal(row, parm, isNull, op_ct));
|
||||
|
||||
// remove the decimals in the oss string.
|
||||
char* d = tmp;
|
||||
|
||||
while ((*d != '.') && (*d != '\0'))
|
||||
d++;
|
||||
|
||||
*d = '\0';
|
||||
}
|
||||
else if (isUnsigned(op_ct.colDataType))
|
||||
{
|
||||
#ifndef __LP64__
|
||||
|
||||
Reference in New Issue
Block a user