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

MCOL-1822 Intermediate checkin. DISTINCT not working.

This commit is contained in:
David Hall
2019-02-25 14:54:46 -06:00
parent ab931e7c51
commit a2aa4b8479
67 changed files with 2391 additions and 1018 deletions

View File

@ -219,6 +219,12 @@ uint64_t Func_ceil::getUintVal(Row& row,
}
break;
case CalpontSystemCatalog::LONGDOUBLE:
{
ret = (uint64_t) ceill(parm[0]->data()->getLongDoubleVal(row, isNull));
}
break;
case CalpontSystemCatalog::VARCHAR:
case CalpontSystemCatalog::CHAR:
case CalpontSystemCatalog::TEXT:
@ -293,6 +299,52 @@ double Func_ceil::getDoubleVal(Row& row,
if (!isNull)
ret = ceil(strtod(str.c_str(), 0));
}
else if (op_ct.colDataType == CalpontSystemCatalog::LONGDOUBLE)
{
ret = (double)ceill(parm[0]->data()->getLongDoubleVal(row, isNull));
}
else
{
if (isUnsigned(op_ct.colDataType))
{
ret = (double) getUintVal(row, parm, isNull, op_ct);
}
else
{
ret = (double) getIntVal(row, parm, isNull, op_ct);
}
}
return ret;
}
long double Func_ceil::getLongDoubleVal(Row& row,
FunctionParm& parm,
bool& isNull,
CalpontSystemCatalog::ColType& op_ct)
{
long double ret = 0.0;
if (op_ct.colDataType == CalpontSystemCatalog::LONGDOUBLE)
{
ret = ceill(parm[0]->data()->getLongDoubleVal(row, isNull));
}
else if (op_ct.colDataType == CalpontSystemCatalog::DOUBLE ||
op_ct.colDataType == CalpontSystemCatalog::UDOUBLE ||
op_ct.colDataType == CalpontSystemCatalog::FLOAT ||
op_ct.colDataType == CalpontSystemCatalog::UFLOAT)
{
ret = ceil(parm[0]->data()->getDoubleVal(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 = ceil(strtod(str.c_str(), 0));
}
else
{
if (isUnsigned(op_ct.colDataType))
@ -334,6 +386,18 @@ string Func_ceil::getStrVal(Row& row,
*d = '\0';
}
else 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__