1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-01 06:46:55 +03:00

MCOL-944 Fix aggregate type switch

Aggregates could switch from unsigned to signed prior to execution. This
causes issues with NULL values since signed and unsigned NULLs are
different.
This commit is contained in:
Andrew Hutchings
2017-10-02 11:47:56 +01:00
parent de457bfe4b
commit 0b45e3042b

View File

@ -3445,13 +3445,21 @@ void TupleAggregateStep::prep2PhasesDistinctAggregate(
if (typeProj[colProj] != CalpontSystemCatalog::DOUBLE &&
typeProj[colProj] != CalpontSystemCatalog::FLOAT)
{
typeAggPm.push_back(CalpontSystemCatalog::BIGINT);
if (isUnsigned(typeProj[colProj]))
{
typeAggPm.push_back(CalpontSystemCatalog::UBIGINT);
precisionAggPm.push_back(20);
}
else
{
typeAggPm.push_back(CalpontSystemCatalog::BIGINT);
precisionAggPm.push_back(19);
}
uint32_t scale = scaleProj[colProj];
// for int average, FE expects a decimal
if (aggOp == ROWAGG_AVG)
scale = jobInfo.scaleOfAvg[aggKey]; // scale += 4;
scaleAggPm.push_back(scale);
precisionAggPm.push_back(19);
widthAggPm.push_back(bigIntWidth);
}
else