Jackie-Jiang commented on code in PR #14664:
URL: https://github.com/apache/pinot/pull/14664#discussion_r1899319481
##########
pinot-query-planner/src/main/java/org/apache/pinot/calcite/rel/rules/PinotAggregateExchangeNodeInsertRule.java:
##########
@@ -83,48 +85,148 @@
* - COUNT(*)__LEAF produces TUPLE[ SUM(1), GROUP_BY_KEY ]
* - COUNT(*)__FINAL produces TUPLE[ SUM(COUNT(*)__LEAF), GROUP_BY_KEY ]
*/
-public class PinotAggregateExchangeNodeInsertRule extends RelOptRule {
- public static final PinotAggregateExchangeNodeInsertRule INSTANCE =
- new
PinotAggregateExchangeNodeInsertRule(PinotRuleUtils.PINOT_REL_FACTORY);
-
- public PinotAggregateExchangeNodeInsertRule(RelBuilderFactory factory) {
- // NOTE: Explicitly match for LogicalAggregate because after applying the
rule, LogicalAggregate is replaced with
- // PinotLogicalAggregate, and the rule won't be applied again.
- super(operand(LogicalAggregate.class, any()), factory, null);
+public class PinotAggregateExchangeNodeInsertRule {
+
+ public static class SortProjectAggregate extends RelOptRule {
+ public static final SortProjectAggregate INSTANCE = new
SortProjectAggregate(PinotRuleUtils.PINOT_REL_FACTORY);
+
+ private SortProjectAggregate(RelBuilderFactory factory) {
+ // NOTE: Explicitly match for LogicalAggregate because after applying
the rule, LogicalAggregate is replaced with
+ // PinotLogicalAggregate, and the rule won't be applied again.
+ super(operand(Sort.class, operand(Project.class,
operand(LogicalAggregate.class, any()))), factory, null);
+ }
+
+ @Override
+ public void onMatch(RelOptRuleCall call) {
Review Comment:
Some Calcite rules also rely on return in `onMatch()` if the check is not
trivial to reduce overhead, e.g. `ProjectToSemiJoinRule`. I'm not sure if it is
a good idea to rely on which method is being invoked. IMO a safer way to detect
which rules are applied is to check the actual rewrite of RelNode
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]