You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-29 08:21:15 +03:00
MCOL-1822 interim checkin
This commit is contained in:
@ -123,6 +123,11 @@ public:
|
|||||||
evaluate(row, isNull, lop, rop);
|
evaluate(row, isNull, lop, rop);
|
||||||
return TreeNode::getDoubleVal();
|
return TreeNode::getDoubleVal();
|
||||||
}
|
}
|
||||||
|
virtual long double getLongDoubleVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop)
|
||||||
|
{
|
||||||
|
evaluate(row, isNull, lop, rop);
|
||||||
|
return TreeNode::getLongDoubleVal();
|
||||||
|
}
|
||||||
virtual IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop)
|
virtual IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop)
|
||||||
{
|
{
|
||||||
evaluate(row, isNull, lop, rop);
|
evaluate(row, isNull, lop, rop);
|
||||||
@ -194,9 +199,15 @@ inline void ArithmeticOperator::evaluate(rowgroup::Row& row, bool& isNull, Parse
|
|||||||
|
|
||||||
case execplan::CalpontSystemCatalog::DOUBLE:
|
case execplan::CalpontSystemCatalog::DOUBLE:
|
||||||
case execplan::CalpontSystemCatalog::FLOAT:
|
case execplan::CalpontSystemCatalog::FLOAT:
|
||||||
|
case execplan::CalpontSystemCatalog::UDOUBLE:
|
||||||
|
case execplan::CalpontSystemCatalog::UFLOAT:
|
||||||
fResult.doubleVal = execute(lop->getDoubleVal(row, isNull), rop->getDoubleVal(row, isNull), isNull);
|
fResult.doubleVal = execute(lop->getDoubleVal(row, isNull), rop->getDoubleVal(row, isNull), isNull);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case execplan::CalpontSystemCatalog::LONGDOUBLE:
|
||||||
|
fResult.longDoubleVal = execute(lop->getLongDoubleVal(row, isNull), rop->getLongDoubleVal(row, isNull), isNull);
|
||||||
|
break;
|
||||||
|
|
||||||
case execplan::CalpontSystemCatalog::DECIMAL:
|
case execplan::CalpontSystemCatalog::DECIMAL:
|
||||||
case execplan::CalpontSystemCatalog::UDECIMAL:
|
case execplan::CalpontSystemCatalog::UDECIMAL:
|
||||||
execute (fResult.decimalVal, lop->getDecimalVal(row, isNull), rop->getDecimalVal(row, isNull), isNull);
|
execute (fResult.decimalVal, lop->getDecimalVal(row, isNull), rop->getDecimalVal(row, isNull), isNull);
|
||||||
|
@ -300,6 +300,12 @@ public:
|
|||||||
return TreeNode::getDoubleVal();
|
return TreeNode::getDoubleVal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual long double getLongDoubleVal(rowgroup::Row& row, bool& isNull)
|
||||||
|
{
|
||||||
|
evaluate(row, isNull);
|
||||||
|
return TreeNode::getLongDoubleVal();
|
||||||
|
}
|
||||||
|
|
||||||
virtual IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull)
|
virtual IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull)
|
||||||
{
|
{
|
||||||
evaluate(row, isNull);
|
evaluate(row, isNull);
|
||||||
|
@ -76,6 +76,7 @@ public:
|
|||||||
virtual inline int64_t getIntVal(rowgroup::Row& row, bool& isNull);
|
virtual inline int64_t getIntVal(rowgroup::Row& row, bool& isNull);
|
||||||
virtual inline float getFloatVal(rowgroup::Row& row, bool& isNull);
|
virtual inline float getFloatVal(rowgroup::Row& row, bool& isNull);
|
||||||
virtual inline double getDoubleVal(rowgroup::Row& row, bool& isNull);
|
virtual inline double getDoubleVal(rowgroup::Row& row, bool& isNull);
|
||||||
|
virtual inline long double getLongDoubleVal(rowgroup::Row& row, bool& isNull);
|
||||||
virtual inline IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull);
|
virtual inline IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull);
|
||||||
|
|
||||||
/** The serialize interface */
|
/** The serialize interface */
|
||||||
@ -180,6 +181,15 @@ inline double SimpleColumn_Decimal<len>::getDoubleVal(rowgroup::Row& row, bool&
|
|||||||
return (row.getIntField<len>(fInputIndex) / pow((double)10, fResultType.scale));
|
return (row.getIntField<len>(fInputIndex) / pow((double)10, fResultType.scale));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<int len>
|
||||||
|
inline long double SimpleColumn_Decimal<len>::getLongDoubleVal(rowgroup::Row& row, bool& isNull)
|
||||||
|
{
|
||||||
|
if (row.equals<len>(fNullVal, fInputIndex))
|
||||||
|
isNull = true;
|
||||||
|
|
||||||
|
return (row.getIntField<len>(fInputIndex) / pow((double)10, fResultType.scale));
|
||||||
|
}
|
||||||
|
|
||||||
template<int len>
|
template<int len>
|
||||||
inline IDB_Decimal SimpleColumn_Decimal<len>::getDecimalVal(rowgroup::Row& row, bool& isNull)
|
inline IDB_Decimal SimpleColumn_Decimal<len>::getDecimalVal(rowgroup::Row& row, bool& isNull)
|
||||||
{
|
{
|
||||||
|
@ -75,6 +75,7 @@ public:
|
|||||||
virtual inline uint64_t getUintVal(rowgroup::Row& row, bool& isNull);
|
virtual inline uint64_t getUintVal(rowgroup::Row& row, bool& isNull);
|
||||||
virtual inline float getFloatVal(rowgroup::Row& row, bool& isNull);
|
virtual inline float getFloatVal(rowgroup::Row& row, bool& isNull);
|
||||||
virtual inline double getDoubleVal(rowgroup::Row& row, bool& isNull);
|
virtual inline double getDoubleVal(rowgroup::Row& row, bool& isNull);
|
||||||
|
virtual inline long double getLongDoubleVal(rowgroup::Row& row, bool& isNull);
|
||||||
virtual inline IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull);
|
virtual inline IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull);
|
||||||
|
|
||||||
/** The serialize interface */
|
/** The serialize interface */
|
||||||
@ -198,6 +199,15 @@ inline double SimpleColumn_INT<len>::getDoubleVal(rowgroup::Row& row, bool& isNu
|
|||||||
return (double)row.getIntField<len>(fInputIndex);
|
return (double)row.getIntField<len>(fInputIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<int len>
|
||||||
|
inline long double SimpleColumn_INT<len>::getLongDoubleVal(rowgroup::Row& row, bool& isNull)
|
||||||
|
{
|
||||||
|
if (row.equals<len>(fNullVal, fInputIndex))
|
||||||
|
isNull = true;
|
||||||
|
|
||||||
|
return (long double)row.getIntField<len>(fInputIndex);
|
||||||
|
}
|
||||||
|
|
||||||
template<int len>
|
template<int len>
|
||||||
inline IDB_Decimal SimpleColumn_INT<len>::getDecimalVal(rowgroup::Row& row, bool& isNull)
|
inline IDB_Decimal SimpleColumn_INT<len>::getDecimalVal(rowgroup::Row& row, bool& isNull)
|
||||||
{
|
{
|
||||||
|
@ -75,6 +75,7 @@ public:
|
|||||||
virtual inline uint64_t getUintVal(rowgroup::Row& row, bool& isNull);
|
virtual inline uint64_t getUintVal(rowgroup::Row& row, bool& isNull);
|
||||||
virtual inline float getFloatVal(rowgroup::Row& row, bool& isNull);
|
virtual inline float getFloatVal(rowgroup::Row& row, bool& isNull);
|
||||||
virtual inline double getDoubleVal(rowgroup::Row& row, bool& isNull);
|
virtual inline double getDoubleVal(rowgroup::Row& row, bool& isNull);
|
||||||
|
virtual inline long double getLongDoubleVal(rowgroup::Row& row, bool& isNull);
|
||||||
virtual inline IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull);
|
virtual inline IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull);
|
||||||
|
|
||||||
/** The serialize interface */
|
/** The serialize interface */
|
||||||
@ -198,6 +199,15 @@ inline double SimpleColumn_UINT<len>::getDoubleVal(rowgroup::Row& row, bool& isN
|
|||||||
return (double)row.getUintField<len>(fInputIndex);
|
return (double)row.getUintField<len>(fInputIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<int len>
|
||||||
|
inline long double SimpleColumn_UINT<len>::getLongDoubleVal(rowgroup::Row& row, bool& isNull)
|
||||||
|
{
|
||||||
|
if (row.equals<len>(fNullVal, fInputIndex))
|
||||||
|
isNull = true;
|
||||||
|
|
||||||
|
return (long double)row.getUintField<len>(fInputIndex);
|
||||||
|
}
|
||||||
|
|
||||||
template<int len>
|
template<int len>
|
||||||
inline IDB_Decimal SimpleColumn_UINT<len>::getDecimalVal(rowgroup::Row& row, bool& isNull)
|
inline IDB_Decimal SimpleColumn_UINT<len>::getDecimalVal(rowgroup::Row& row, bool& isNull)
|
||||||
{
|
{
|
||||||
|
@ -212,6 +212,7 @@ public:
|
|||||||
inline virtual bool getBoolVal(rowgroup::Row& row, bool& isNull);
|
inline virtual bool getBoolVal(rowgroup::Row& row, bool& isNull);
|
||||||
inline virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull);
|
inline virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull);
|
||||||
inline virtual double getDoubleVal(rowgroup::Row& row, bool& isNull);
|
inline virtual double getDoubleVal(rowgroup::Row& row, bool& isNull);
|
||||||
|
inline virtual long double getLongDoubleVal(rowgroup::Row& row, bool& isNull);
|
||||||
|
|
||||||
// get all simple columns involved in this column
|
// get all simple columns involved in this column
|
||||||
const std::vector<SimpleColumn*>& simpleColumnList();
|
const std::vector<SimpleColumn*>& simpleColumnList();
|
||||||
@ -253,6 +254,11 @@ inline double SimpleFilter::getDoubleVal(rowgroup::Row& row, bool& isNull)
|
|||||||
return getIntVal(row, isNull);
|
return getIntVal(row, isNull);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline long double SimpleFilter::getLongDoubleVal(rowgroup::Row& row, bool& isNull)
|
||||||
|
{
|
||||||
|
return getIntVal(row, isNull);
|
||||||
|
}
|
||||||
|
|
||||||
typedef boost::shared_ptr<SimpleFilter> SSFP;
|
typedef boost::shared_ptr<SimpleFilter> SSFP;
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& output, const SimpleFilter& rhs);
|
std::ostream& operator<<(std::ostream& output, const SimpleFilter& rhs);
|
||||||
|
@ -513,16 +513,12 @@ void TupleUnion::normalize(const Row& in, Row* out)
|
|||||||
case CalpontSystemCatalog::LONGDOUBLE:
|
case CalpontSystemCatalog::LONGDOUBLE:
|
||||||
{
|
{
|
||||||
int scale = in.getScale(i);
|
int scale = in.getScale(i);
|
||||||
|
long double d = in.getIntField(i);
|
||||||
if (scale != 0)
|
if (scale != 0)
|
||||||
{
|
{
|
||||||
long double d = in.getIntField(i);
|
|
||||||
d /= (uint64_t) pow(10.0, scale);
|
d /= (uint64_t) pow(10.0, scale);
|
||||||
out->setLongDoubleField(d, i);
|
|
||||||
}
|
}
|
||||||
else
|
out->setLongDoubleField(d, i);
|
||||||
out->setLongDoubleField(in.getIntField(i), i);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -743,7 +743,6 @@ int fetchNextRow(uchar* buf, cal_table_info& ti, cal_connection_info* ci, bool h
|
|||||||
{
|
{
|
||||||
f2->dec = row.getScale(s);
|
f2->dec = row.getScale(s);
|
||||||
}
|
}
|
||||||
dl /= pow(10.0, (double)f2->dec);
|
|
||||||
|
|
||||||
f2->store(static_cast<double>(dl));
|
f2->store(static_cast<double>(dl));
|
||||||
if ((*f)->null_ptr)
|
if ((*f)->null_ptr)
|
||||||
|
@ -1297,8 +1297,8 @@ void RowAggregation::doMinMax(const Row& rowIn, int64_t colIn, int64_t colOut, i
|
|||||||
|
|
||||||
case execplan::CalpontSystemCatalog::LONGDOUBLE:
|
case execplan::CalpontSystemCatalog::LONGDOUBLE:
|
||||||
{
|
{
|
||||||
long double valIn = rowIn.getDoubleField(colIn);
|
long double valIn = rowIn.getLongDoubleField(colIn);
|
||||||
long double valOut = fRow.getDoubleField(colOut);
|
long double valOut = fRow.getLongDoubleField(colOut);
|
||||||
updateLongDoubleMinMax(valIn, valOut, colOut, funcType);
|
updateLongDoubleMinMax(valIn, valOut, colOut, funcType);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3186,6 +3186,10 @@ void RowAggregationUM::doNullConstantAggregate(const ConstantAggData& aggData, u
|
|||||||
{
|
{
|
||||||
case ROWAGG_MIN:
|
case ROWAGG_MIN:
|
||||||
case ROWAGG_MAX:
|
case ROWAGG_MAX:
|
||||||
|
case ROWAGG_AVG:
|
||||||
|
case ROWAGG_SUM:
|
||||||
|
case ROWAGG_DISTINCT_AVG:
|
||||||
|
case ROWAGG_DISTINCT_SUM:
|
||||||
case ROWAGG_STATS:
|
case ROWAGG_STATS:
|
||||||
{
|
{
|
||||||
switch (colDataType)
|
switch (colDataType)
|
||||||
@ -3258,15 +3262,6 @@ void RowAggregationUM::doNullConstantAggregate(const ConstantAggData& aggData, u
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ROWAGG_AVG:
|
|
||||||
case ROWAGG_SUM:
|
|
||||||
case ROWAGG_DISTINCT_AVG:
|
|
||||||
case ROWAGG_DISTINCT_SUM:
|
|
||||||
{
|
|
||||||
fRow.setLongDoubleField(getLongDoubleNullValue(), colOut);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ROWAGG_COUNT_COL_NAME:
|
case ROWAGG_COUNT_COL_NAME:
|
||||||
case ROWAGG_COUNT_DISTINCT_COL_NAME:
|
case ROWAGG_COUNT_DISTINCT_COL_NAME:
|
||||||
{
|
{
|
||||||
|
@ -1036,6 +1036,11 @@ inline void Row::setFloatField(float val, uint32_t colIndex)
|
|||||||
|
|
||||||
inline void Row::setLongDoubleField(long double val, uint32_t colIndex)
|
inline void Row::setLongDoubleField(long double val, uint32_t colIndex)
|
||||||
{
|
{
|
||||||
|
if (sizeof(long double) == 16)
|
||||||
|
{
|
||||||
|
// zero out the unused portion as there may be garbage there.
|
||||||
|
*((uint64_t*)&val+1) &= 0x000000000000FFFFULL;
|
||||||
|
}
|
||||||
*((long double*) &data[offsets[colIndex]]) = val;
|
*((long double*) &data[offsets[colIndex]]) = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user