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

@ -142,6 +142,14 @@ double Func_mod::getDoubleVal(Row& row,
}
break;
case execplan::CalpontSystemCatalog::LONGDOUBLE:
{
long double value = parm[0]->data()->getLongDoubleVal(row, isNull);
mod = (double)fmodl(value, div);
}
break;
case execplan::CalpontSystemCatalog::FLOAT:
case execplan::CalpontSystemCatalog::UFLOAT:
{
@ -181,6 +189,110 @@ double Func_mod::getDoubleVal(Row& row,
return mod;
}
long double Func_mod::getLongDoubleVal(Row& row,
FunctionParm& parm,
bool& isNull,
CalpontSystemCatalog::ColType& operationColType)
{
if ( parm.size() < 2 )
{
isNull = true;
return 0;
}
int64_t div = parm[1]->data()->getIntVal(row, isNull);
if ( div == 0 )
{
isNull = true;
return 0;
}
long double mod = 0;
switch (parm[0]->data()->resultType().colDataType)
{
case execplan::CalpontSystemCatalog::BIGINT:
case execplan::CalpontSystemCatalog::INT:
case execplan::CalpontSystemCatalog::MEDINT:
case execplan::CalpontSystemCatalog::TINYINT:
case execplan::CalpontSystemCatalog::SMALLINT:
{
int64_t value = parm[0]->data()->getIntVal(row, isNull);
mod = value % div;
}
break;
case execplan::CalpontSystemCatalog::UBIGINT:
case execplan::CalpontSystemCatalog::UINT:
case execplan::CalpontSystemCatalog::UMEDINT:
case execplan::CalpontSystemCatalog::UTINYINT:
case execplan::CalpontSystemCatalog::USMALLINT:
{
uint64_t udiv = parm[1]->data()->getIntVal(row, isNull);
uint64_t uvalue = parm[0]->data()->getUintVal(row, isNull);
mod = uvalue % udiv;
}
break;
case execplan::CalpontSystemCatalog::DOUBLE:
case execplan::CalpontSystemCatalog::UDOUBLE:
{
double value = parm[0]->data()->getDoubleVal(row, isNull);
mod = fmod(value, div);
}
break;
case execplan::CalpontSystemCatalog::FLOAT:
case execplan::CalpontSystemCatalog::UFLOAT:
{
float value = parm[0]->data()->getFloatVal(row, isNull);
mod = fmod(value, div);
}
break;
case execplan::CalpontSystemCatalog::LONGDOUBLE:
{
long double value = parm[0]->data()->getLongDoubleVal(row, isNull);
mod = fmodl(value, div);
}
break;
case execplan::CalpontSystemCatalog::DECIMAL:
case execplan::CalpontSystemCatalog::UDECIMAL:
{
IDB_Decimal d = parm[0]->data()->getDecimalVal(row, isNull);
int64_t value = d.value / helpers::power(d.scale);
mod = value % div;
}
break;
case execplan::CalpontSystemCatalog::CHAR:
case execplan::CalpontSystemCatalog::VARCHAR:
case execplan::CalpontSystemCatalog::TEXT:
{
double value = parm[0]->data()->getDoubleVal(row, isNull);
mod = fmod(value, div);
break;
}
default:
{
std::ostringstream oss;
oss << "mod: datatype of " << execplan::colDataTypeToString(parm[0]->data()->resultType().colDataType);
throw logging::IDBExcept(oss.str(), ERR_DATATYPE_NOT_SUPPORT);
}
}
return mod;
}
int64_t Func_mod::getIntVal(Row& row,
FunctionParm& parm,
bool& isNull,
@ -250,6 +362,14 @@ int64_t Func_mod::getIntVal(Row& row,
}
break;
case execplan::CalpontSystemCatalog::LONGDOUBLE:
{
long double value = parm[0]->data()->getLongDoubleVal(row, isNull);
mod = fmodl(value, div);
}
break;
case execplan::CalpontSystemCatalog::DECIMAL:
case execplan::CalpontSystemCatalog::UDECIMAL:
{
@ -340,6 +460,14 @@ uint64_t Func_mod::getUIntVal(Row& row,
}
break;
case execplan::CalpontSystemCatalog::LONGDOUBLE:
{
long double value = parm[0]->data()->getLongDoubleVal(row, isNull);
mod = fmodl(value, div);
}
break;
case execplan::CalpontSystemCatalog::DECIMAL:
case execplan::CalpontSystemCatalog::UDECIMAL:
{
@ -387,6 +515,10 @@ std::string Func_mod::getStrVal(Row& row,
return intToString(getIntVal(row, fp, isNull, op_ct));
break;
case execplan::CalpontSystemCatalog::LONGDOUBLE:
return longDoubleToString(getLongDoubleVal(row, fp, isNull, op_ct));
break;
default:
return doubleToString(getDoubleVal(row, fp, isNull, op_ct));
break;