gortiz commented on code in PR #14066: URL: https://github.com/apache/pinot/pull/14066#discussion_r1774653956
########## pinot-query-planner/src/main/java/org/apache/pinot/calcite/rel/rules/PinotAggregateToSemiJoinRule.java: ########## @@ -50,18 +48,9 @@ public class PinotAggregateToSemiJoinRule extends RelOptRule { new PinotAggregateToSemiJoinRule(PinotRuleUtils.PINOT_REL_FACTORY); public PinotAggregateToSemiJoinRule(RelBuilderFactory factory) { - super(operand(LogicalAggregate.class, any()), factory, null); - } - - @Override - @SuppressWarnings("rawtypes") - public boolean matches(RelOptRuleCall call) { - final Aggregate topAgg = call.rel(0); - if (!PinotRuleUtils.isJoin(topAgg.getInput())) { - return false; - } - final Join join = (Join) PinotRuleUtils.unboxRel(topAgg.getInput()); - return PinotRuleUtils.isAggregate(join.getInput(1)); + super(operand(Aggregate.class, + some(operand(Join.class, some(operand(RelNode.class, any()), operand(Aggregate.class, any()))))), factory, + null); Review Comment: I've recently ended up reading Hive's [CalcitePlanner class](https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java), which is pretty similar to our QueryEnvironment class and I think that is something we can get inspiration of once our rule logic starts to be more complex. -- 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