From f4e6939139c733a60fbac3c7af79765fc9bf70fd Mon Sep 17 00:00:00 2001 From: David Hall Date: Fri, 30 Apr 2021 10:57:40 -0500 Subject: [PATCH] MCOL-4643 dev 5 reset valOut after processing UDAF After a UDAF result has been inserted in the output stream, the valOut object needs to be reset to empty in preparation for the next value. Failing to do so may cause what should be a NULL value to erroneously take the last value inserted. --- utils/rowgroup/rowaggregation.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/rowgroup/rowaggregation.cpp b/utils/rowgroup/rowaggregation.cpp index 8bb5c012a..e25c9b465 100755 --- a/utils/rowgroup/rowaggregation.cpp +++ b/utils/rowgroup/rowaggregation.cpp @@ -3029,6 +3029,8 @@ void RowAggregationUM::SetUDAFValue(static_any::any& valOut, int64_t colOut) // This handles the mismatch SetUDAFAnyValue(valOut, colOut); } + // reset valOut to be ready for the next value + valOut.reset(); } void RowAggregationUM::SetUDAFAnyValue(static_any::any& valOut, int64_t colOut) @@ -3298,7 +3300,6 @@ void RowAggregationUM::calculateUDAFColumns() // Set the returned value into the output row SetUDAFValue(valOut, colOut); - valOut.reset(); } fRGContext.setUserData(NULL);