xiedeyantu commented on code in PR #4549:
URL: https://github.com/apache/calcite/pull/4549#discussion_r2368432816
##########
core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java:
##########
@@ -2147,6 +2147,28 @@ private void
checkSemiOrAntiJoinProjectTranspose(JoinRelType type) {
.check();
}
+ /** Test case for all variance/standard deviation functions with FILTER
clause reduction. */
+ @Test void testVarianceStddevWithFilter() {
+ // Test to ensure FILTER conditions are properly propagated to decomposed
aggregates
+ // for all functions that use the reduceStddev method
+ final RelOptRule rule = AggregateReduceFunctionsRule.Config.DEFAULT
+ .withOperandFor(LogicalAggregate.class)
+ .withFunctionsToReduce(
+ EnumSet.of(SqlKind.STDDEV_POP, SqlKind.STDDEV_SAMP,
+ SqlKind.VAR_POP, SqlKind.VAR_SAMP, SqlKind.AVG))
+ .toRule();
+ final String sql = "select name, "
Review Comment:
The plan looks good, but a `.iq` test can verify the correctness of the
results, which is more intuitive. If you can use the form `with t (i) as
(values (0), (1))`, others can also easily use MySQL or PostgreSQL to help
verify the correctness of the results.
--
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]