ankitsultana commented on code in PR #16204: URL: https://github.com/apache/pinot/pull/16204#discussion_r2167810304
########## pinot-query-planner/src/main/java/org/apache/pinot/calcite/rel/rules/PinotLogicalAggregateRule.java: ########## @@ -177,13 +177,17 @@ private static PinotLogicalAggregate createPlan(Aggregate aggRel, @Nullable List leafReturnFinalResult, collations, limit); } - private static boolean isGroupTrimmingEnabled(RelOptRuleCall call, @Nullable Map<String, String> hintOptions) { + private static boolean isGroupTrimmingEnabled(RelOptRuleCall call, @Nullable Map<String, String> hintOptions, + Aggregate aggRel) { if (hintOptions != null) { String option = hintOptions.get(PinotHintOptions.AggregateOptions.IS_ENABLE_GROUP_TRIM); if (option != null) { return Boolean.parseBoolean(option); } } + if (aggRel.getAggCallList().isEmpty()) { Review Comment: **Note for Reviewers:** For queries such as `WITH tmp AS (SELECT DISTINCT col1, col2 FROM tbl LIMIT 1000) SELECT ...`, at present we were not trimming groups by default which would have meant that the group-by could have grown really huge. For such queries, we can always leverage group-trimming, and this change enables that. -- 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: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org