1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-07 03:22:57 +03:00

MCOL-3839 Update fix to work with NULLs and other constants

This commit is contained in:
Jose
2020-04-24 20:16:12 +00:00
parent 06312f4a3f
commit 08d9d40c6a

View File

@@ -112,6 +112,25 @@ void WF_count<T>::operator()(int64_t b, int64_t e, int64_t c)
// for count(*), the column is optimized out, index[1] does not exist.
int64_t colIn = (fFunctionId == WF__COUNT_ASTERISK) ? 0 : fFieldIndex[1];
// constant param will have fFieldIndex[1] of -1. Get value of constant param
if (colIn == -1)
{
ConstantColumn* cc = static_cast<ConstantColumn*>(fConstantParms[0].get());
if (cc)
{
bool isNull = false;
int val = cc->getIntVal(fRow, isNull);
if (!isNull)
{
fCount = val;
}
}
}
else
{
for (int64_t i = b; i <= e; i++)
{
if (i % 1000 == 0 && fStep->cancelled())
@@ -125,7 +144,7 @@ void WF_count<T>::operator()(int64_t b, int64_t e, int64_t c)
fRow.setData(getPointer(fRowData->at(i)));
if (colIn == -1 || fRow.isNullValue(colIn) == true)
if (fRow.isNullValue(colIn) == true)
continue;
if (fFunctionId != WF__COUNT_DISTINCT)
@@ -147,6 +166,7 @@ void WF_count<T>::operator()(int64_t b, int64_t e, int64_t c)
}
}
}
}
setValue(CalpontSystemCatalog::BIGINT, b, e, c, &fCount);