lincoln-lil opened a new pull request, #4549: URL: https://github.com/apache/calcite/pull/4549
The AggregateReduceFunctionsRule incorrectly handled FILTER conditions when decomposing variance and standard deviation functions. The SUM(x*x) aggregate call in the reduceStddev method was not applying the original FILTER condition, causing incorrect results. This fix ensures that all decomposed aggregate calls (SUM(x*x), SUM(x), and COUNT(x)) properly inherit the FILTER condition from the original aggregate function call. Affected functions: - STDDEV_POP(x) FILTER (WHERE condition) - STDDEV_SAMP(x) FILTER (WHERE condition) - VAR_POP(x) FILTER (WHERE condition) - VAR_SAMP(x) FILTER (WHERE condition) Changes: - Fixed filterArg parameter in createAggregateCallWithBinding call - Added comprehensive test coverage for all affected functions Before: SUM(x*x) ignored FILTER conditions After: SUM(x*x) correctly applies FILTER conditions -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
