From 3fac7b1e199272afea4ab6b6e3d791c466127207 Mon Sep 17 00:00:00 2001 From: David Hall Date: Thu, 13 Sep 2018 14:12:10 -0500 Subject: [PATCH] MCOL-521 more multi-param work with constant NULL --- utils/rowgroup/rowaggregation.cpp | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/utils/rowgroup/rowaggregation.cpp b/utils/rowgroup/rowaggregation.cpp index f9db8b266..d08781c07 100644 --- a/utils/rowgroup/rowaggregation.cpp +++ b/utils/rowgroup/rowaggregation.cpp @@ -2015,18 +2015,9 @@ void RowAggregation::doUDAF(const Row& rowIn, int64_t colIn, int64_t colOut, for (uint32_t i = 0; i < paramCount; ++i) { - // If UDAF_IGNORE_NULLS is on, bIsNull gets set the first time - // we find a null. We still need to eat the rest of the parameters - // to sync updateEntry - if (bIsNull) - { - ++funcColsIdx; - continue; - } - SP_ROWAGG_FUNC_t pFunctionCol = fFunctionCols[funcColsIdx]; mcsv1sdk::ColumnDatum& datum = valsIn[i]; - // Turn on NULL flags + // Turn on NULL flags based on the data dataFlags[i] = 0; // If this particular parameter is a constant, then we need @@ -2043,9 +2034,11 @@ void RowAggregation::doUDAF(const Row& rowIn, int64_t colIn, int64_t colOut, { if (fRGContext.getRunFlag(mcsv1sdk::UDAF_IGNORE_NULLS)) { - bIsNull = true; - ++funcColsIdx; - continue; + // When Ignore nulls, if there are multiple parameters and any + // one of them is NULL, we ignore the entry. We need to increment + // funcColsIdx the number of extra parameters. + funcColsIdx += paramCount - i - 1; + return; } dataFlags[i] |= mcsv1sdk::PARAM_IS_NULL;