1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-12-24 14:20:59 +03:00

MCOL-641 Fix regression in aggregate distinct on narrow decimal.

The else if block in Row::equals() was incorrectly getting triggered
for narrow decimals earlier. We now specifically check if the column
is a wide decimal. Furthermore, we need to dereference the int128_t
pointers for equality comparison.
This commit is contained in:
Gagan Goel
2020-10-29 16:04:34 -04:00
committed by Roman Nozdrin
parent 1f4a781704
commit 68244ab957

View File

@@ -1203,9 +1203,9 @@ bool Row::equals(const Row& r2, const std::vector<uint32_t>& keyCols) const
if (getLongDoubleField(col) != r2.getLongDoubleField(col))
return false;
}
else if (UNLIKELY(execplan::isDecimal(columnType)))
else if (UNLIKELY(datatypes::Decimal::isWideDecimalType(columnType, colWidths[col])))
{
if (getBinaryField<int128_t>(col) != r2.getBinaryField<int128_t>(col))
if (*getBinaryField<int128_t>(col) != *r2.getBinaryField<int128_t>(col))
return false;
}
else if (getUintField(col) != r2.getUintField(col))
@@ -1217,6 +1217,7 @@ bool Row::equals(const Row& r2, const std::vector<uint32_t>& keyCols) const
return true;
}
bool Row::equals(const Row& r2, uint32_t lastCol) const
{
// This check fires with empty r2 only.
@@ -1261,9 +1262,9 @@ bool Row::equals(const Row& r2, uint32_t lastCol) const
if (getLongDoubleField(col) != r2.getLongDoubleField(col))
return false;
}
else if (UNLIKELY(execplan::isDecimal(columnType)))
else if (UNLIKELY(datatypes::Decimal::isWideDecimalType(columnType, colWidths[col])))
{
if (getBinaryField<int128_t>(col) != r2.getBinaryField<int128_t>(col))
if (*getBinaryField<int128_t>(col) != *r2.getBinaryField<int128_t>(col))
return false;
}
else if (getUintField(col) != r2.getUintField(col))
@@ -1651,8 +1652,8 @@ void applyMapping(const int* mapping, const Row& in, Row* out)
// WIP this doesn't look right b/c we can pushdown colType
// Migrate to offset based methods here
// code precision 2 width convertor
else if (UNLIKELY(execplan::isDecimal(in.getColTypes()[i])
&& in.getColumnWidth(i) == 16))
else if (UNLIKELY(datatypes::Decimal::isWideDecimalType(in.getColTypes()[i],
in.getColumnWidth(i))))
out->setBinaryField_offset(in.getBinaryField<int128_t>(i), 16,
out->getOffset(mapping[i]));
else if (in.isUnsigned(i))