1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

fix(MCOL-5386): Bitwise aggregation functions do not work with wide decimals (updated previous PR) (#3522)

* fix(MCOL-5386): Bitwise aggregation functions do not work with wide decimals (updated previous PR)

* MCOL-5386: Added test for Decimal(18)
This commit is contained in:
Akhmad O.
2025-05-19 21:41:28 +02:00
committed by GitHub
parent a4b138625e
commit e0f3bf8322
4 changed files with 25 additions and 11 deletions

View File

@ -1538,21 +1538,24 @@ void RowAggregation::doBitOp(const Row& rowIn, int64_t colIn, int64_t colOut, in
case execplan::CalpontSystemCatalog::MEDINT:
case execplan::CalpontSystemCatalog::INT:
case execplan::CalpontSystemCatalog::BIGINT:
{
valIn = rowIn.getIntField(colIn);
break;
}
// According to SQL specification, the result must fit in int64_t,
// therefore, the upper 8 bytes for data types >= 8 bytes are ignored
case execplan::CalpontSystemCatalog::DECIMAL:
case execplan::CalpontSystemCatalog::UDECIMAL:
{
valIn = rowIn.getIntField(colIn);
valIn = rowIn.getIntField<8>(colIn);
if ((fRowGroupIn.getScale())[colIn] != 0)
{
valIn = rowIn.getIntField(colIn);
valIn /= IDB_pow[fRowGroupIn.getScale()[colIn] - 1];
if (valIn > 0)
valIn += 5;
else if (valIn < 0)
valIn -= 5;
valIn /= 10;
}