From 06312f4a3f75d2b8b0e09719517db62d855e67ed Mon Sep 17 00:00:00 2001 From: Jose Date: Fri, 24 Apr 2020 16:05:08 +0000 Subject: [PATCH] MCOL-3839 Count as window function doesn't work with NULLs' --- utils/windowfunction/wf_count.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/windowfunction/wf_count.cpp b/utils/windowfunction/wf_count.cpp index eb7b98def..a37ad996d 100644 --- a/utils/windowfunction/wf_count.cpp +++ b/utils/windowfunction/wf_count.cpp @@ -110,7 +110,7 @@ void WF_count::operator()(int64_t b, int64_t e, int64_t c) e = c; // for count(*), the column is optimized out, index[1] does not exist. - uint64_t colIn = (fFunctionId == WF__COUNT_ASTERISK) ? 0 : fFieldIndex[1]; + int64_t colIn = (fFunctionId == WF__COUNT_ASTERISK) ? 0 : fFieldIndex[1]; for (int64_t i = b; i <= e; i++) { @@ -125,7 +125,7 @@ void WF_count::operator()(int64_t b, int64_t e, int64_t c) fRow.setData(getPointer(fRowData->at(i))); - if (fRow.isNullValue(colIn) == true) + if (colIn == -1 || fRow.isNullValue(colIn) == true) continue; if (fFunctionId != WF__COUNT_DISTINCT)