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:
@@ -139,6 +139,26 @@ int64_t Func_cast_signed::getIntVal(Row& row,
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::LONGDOUBLE:
|
||||
{
|
||||
long double value = parm[0]->data()->getLongDoubleVal(row, isNull);
|
||||
|
||||
if (value > 0)
|
||||
value += 0.5;
|
||||
else if (value < 0)
|
||||
value -= 0.5;
|
||||
|
||||
int64_t ret = (int64_t) value;
|
||||
|
||||
if (value > (long double) numeric_limits<int64_t>::max())
|
||||
ret = numeric_limits<int64_t>::max();
|
||||
else if (value < (long double) (numeric_limits<int64_t>::min() + 2))
|
||||
ret = numeric_limits<int64_t>::min() + 2; // IDB min for bigint
|
||||
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::VARCHAR:
|
||||
case execplan::CalpontSystemCatalog::CHAR:
|
||||
case execplan::CalpontSystemCatalog::TEXT:
|
||||
@@ -266,6 +286,26 @@ uint64_t Func_cast_unsigned::getUintVal(Row& row,
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::LONGDOUBLE:
|
||||
{
|
||||
long double value = parm[0]->data()->getLongDoubleVal(row, isNull);
|
||||
|
||||
if (value > 0)
|
||||
value += 0.5;
|
||||
else if (value < 0)
|
||||
value -= 0.5;
|
||||
|
||||
uint64_t ret = (uint64_t) value;
|
||||
|
||||
if (value > (long double) numeric_limits<uint64_t>::max() - 2)
|
||||
ret = numeric_limits<int64_t>::max();
|
||||
else if (value < 0)
|
||||
ret = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::VARCHAR:
|
||||
case execplan::CalpontSystemCatalog::CHAR:
|
||||
case execplan::CalpontSystemCatalog::TEXT:
|
||||
@@ -391,6 +431,12 @@ string Func_cast_char::getStrVal(Row& row,
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::LONGDOUBLE:
|
||||
{
|
||||
return helpers::longDoubleToString(parm[0]->data()->getLongDoubleVal(row, isNull)).substr(0, length);
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::FLOAT:
|
||||
case execplan::CalpontSystemCatalog::UFLOAT:
|
||||
{
|
||||
@@ -526,6 +572,17 @@ double Func_cast_date::getDoubleVal(Row& row,
|
||||
operationColType);
|
||||
}
|
||||
|
||||
long double Func_cast_date::getLongDoubleVal(Row& row,
|
||||
FunctionParm& parm,
|
||||
bool& isNull,
|
||||
CalpontSystemCatalog::ColType& operationColType)
|
||||
{
|
||||
return (long double) Func_cast_date::getDatetimeIntVal(row,
|
||||
parm,
|
||||
isNull,
|
||||
operationColType);
|
||||
}
|
||||
|
||||
|
||||
int32_t Func_cast_date::getDateIntVal(rowgroup::Row& row,
|
||||
FunctionParm& parm,
|
||||
@@ -795,6 +852,17 @@ double Func_cast_datetime::getDoubleVal(Row& row,
|
||||
operationColType);
|
||||
}
|
||||
|
||||
long double Func_cast_datetime::getLongDoubleVal(Row& row,
|
||||
FunctionParm& parm,
|
||||
bool& isNull,
|
||||
CalpontSystemCatalog::ColType& operationColType)
|
||||
{
|
||||
return (long double) Func_cast_datetime::getDatetimeIntVal(row,
|
||||
parm,
|
||||
isNull,
|
||||
operationColType);
|
||||
}
|
||||
|
||||
int64_t Func_cast_datetime::getDatetimeIntVal(rowgroup::Row& row,
|
||||
FunctionParm& parm,
|
||||
bool& isNull,
|
||||
@@ -1099,6 +1167,26 @@ IDB_Decimal Func_cast_decimal::getDecimalVal(Row& row,
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::LONGDOUBLE:
|
||||
{
|
||||
long double value = parm[0]->data()->getLongDoubleVal(row, isNull);
|
||||
|
||||
if (value > 0)
|
||||
decimal.value = (int64_t) (value * helpers::powerOf10_c[decimals] + 0.5);
|
||||
else if (value < 0)
|
||||
decimal.value = (int64_t) (value * helpers::powerOf10_c[decimals] - 0.5);
|
||||
else
|
||||
decimal.value = 0;
|
||||
|
||||
decimal.scale = decimals;
|
||||
|
||||
if ( value > max_number_decimal )
|
||||
decimal.value = max_number_decimal;
|
||||
else if ( value < -max_number_decimal )
|
||||
decimal.value = -max_number_decimal;
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::DECIMAL:
|
||||
case execplan::CalpontSystemCatalog::UDECIMAL:
|
||||
{
|
||||
@@ -1426,6 +1514,12 @@ double Func_cast_double::getDoubleVal(Row& row,
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::LONGDOUBLE:
|
||||
{
|
||||
dblval = static_cast<double>(parm[0]->data()->getLongDoubleVal(row, isNull));
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::DECIMAL:
|
||||
case execplan::CalpontSystemCatalog::UDECIMAL:
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user