1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

MCOL-1822 add LONG DOUBLE support

This commit is contained in:
David Hall
2019-01-29 09:55:43 -06:00
parent ee2cb7b0de
commit c5b9ae11e5
40 changed files with 746 additions and 38 deletions

View File

@ -174,7 +174,6 @@ int DoubleCompare::operator()(IdbCompare* l, Row::Pointer r1, Row::Pointer r2)
return ret;
}
int FloatCompare::operator()(IdbCompare* l, Row::Pointer r1, Row::Pointer r2)
{
l->row1().setData(r1);
@ -206,6 +205,37 @@ int FloatCompare::operator()(IdbCompare* l, Row::Pointer r1, Row::Pointer r2)
return ret;
}
int LongDoubleCompare::operator()(IdbCompare* l, Row::Pointer r1, Row::Pointer r2)
{
l->row1().setData(r1);
l->row2().setData(r2);
bool b1 = l->row1().isNullValue(fSpec.fIndex);
bool b2 = l->row2().isNullValue(fSpec.fIndex);
int ret = 0;
if (b1 == true || b2 == true)
{
if (b1 == false && b2 == true)
ret = fSpec.fNf;
else if (b1 == true && b2 == false)
ret = -fSpec.fNf;
}
else
{
long double v1 = l->row1().getLongDoubleField(fSpec.fIndex);
long double v2 = l->row2().getLongDoubleField(fSpec.fIndex);
if (v1 > v2)
ret = fSpec.fAsc;
else if (v1 < v2)
ret = -fSpec.fAsc;
}
return ret;
}
bool CompareRule::less(Row::Pointer r1, Row::Pointer r2)
{
@ -279,6 +309,13 @@ void CompareRule::compileRules(const std::vector<IdbSortSpec>& spec, const rowgr
break;
}
case CalpontSystemCatalog::LONGDOUBLE:
{
Compare* c = new LongDoubleCompare(*i);
fCompares.push_back(c);
break;
}
case CalpontSystemCatalog::DATE:
case CalpontSystemCatalog::DATETIME:
case CalpontSystemCatalog::TIME:
@ -442,6 +479,12 @@ bool EqualCompData::operator()(Row::Pointer a, Row::Pointer b)
break;
}
case CalpontSystemCatalog::LONGDOUBLE:
{
eq = (fRow1.getLongDoubleField(*i) == fRow2.getLongDoubleField(*i));
break;
}
default:
{
eq = false;