You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-01 06:46:55 +03:00
MCOL-3423 Don't move decimal for LONG DOUBLE. Clear long double extra bits after copy, not before.
This commit is contained in:
@ -1036,12 +1036,13 @@ 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)
|
||||||
{
|
{
|
||||||
|
uint8_t* p = &data[offsets[colIndex]];
|
||||||
|
*((long double*)p) = val;
|
||||||
if (sizeof(long double) == 16)
|
if (sizeof(long double) == 16)
|
||||||
{
|
{
|
||||||
// zero out the unused portion as there may be garbage there.
|
// zero out the unused portion as there may be garbage there.
|
||||||
*((uint64_t*)&val+1) &= 0x000000000000FFFFULL;
|
*((uint64_t*)p+1) &= 0x000000000000FFFFULL;
|
||||||
}
|
}
|
||||||
*((long double*) &data[offsets[colIndex]]) = val;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Row::setVarBinaryField(const std::string& val, uint32_t colIndex)
|
inline void Row::setVarBinaryField(const std::string& val, uint32_t colIndex)
|
||||||
|
@ -140,6 +140,7 @@ void WF_stats<T>::resetData()
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
void WF_stats<T>::operator()(int64_t b, int64_t e, int64_t c)
|
void WF_stats<T>::operator()(int64_t b, int64_t e, int64_t c)
|
||||||
{
|
{
|
||||||
|
CDT cdt;
|
||||||
if ((fFrameUnit == WF__FRAME_ROWS) ||
|
if ((fFrameUnit == WF__FRAME_ROWS) ||
|
||||||
(fPrev == -1) ||
|
(fPrev == -1) ||
|
||||||
(!fPeer->operator()(getPointer(fRowData->at(c)), getPointer(fRowData->at(fPrev)))))
|
(!fPeer->operator()(getPointer(fRowData->at(c)), getPointer(fRowData->at(fPrev)))))
|
||||||
@ -163,7 +164,7 @@ void WF_stats<T>::operator()(int64_t b, int64_t e, int64_t c)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
T valIn;
|
T valIn;
|
||||||
getValue(colIn, valIn);
|
getValue(colIn, valIn, &cdt);
|
||||||
long double val = (long double) valIn;
|
long double val = (long double) valIn;
|
||||||
|
|
||||||
fSum1 += val;
|
fSum1 += val;
|
||||||
@ -177,7 +178,9 @@ void WF_stats<T>::operator()(int64_t b, int64_t e, int64_t c)
|
|||||||
int scale = fRow.getScale(colIn);
|
int scale = fRow.getScale(colIn);
|
||||||
long double factor = pow(10.0, scale);
|
long double factor = pow(10.0, scale);
|
||||||
|
|
||||||
if (scale != 0) // adjust the scale if necessary
|
// adjust the scale if necessary
|
||||||
|
if (scale != 0 &&
|
||||||
|
cdt != CalpontSystemCatalog::LONGDOUBLE)
|
||||||
{
|
{
|
||||||
fSum1 /= factor;
|
fSum1 /= factor;
|
||||||
fSum2 /= factor * factor;
|
fSum2 /= factor * factor;
|
||||||
|
@ -264,13 +264,15 @@ void WF_sum_avg<T>::operator()(int64_t b, int64_t e, int64_t c)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
T valIn;
|
T valIn;
|
||||||
getValue(colIn, valIn);
|
CDT cdt;
|
||||||
|
getValue(colIn, valIn, &cdt);
|
||||||
// checkSumLimit(fSum, valIn);
|
// checkSumLimit(fSum, valIn);
|
||||||
|
|
||||||
if ((!fDistinct) || (fSet.find(valIn) == fSet.end()))
|
if ((!fDistinct) || (fSet.find(valIn) == fSet.end()))
|
||||||
{
|
{
|
||||||
long double val = valIn;
|
long double val = valIn;
|
||||||
if (scale)
|
if (scale &&
|
||||||
|
cdt != CalpontSystemCatalog::LONGDOUBLE)
|
||||||
{
|
{
|
||||||
val /= pow(10.0, scale);
|
val /= pow(10.0, scale);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user