walterddr commented on code in PR #10122:
URL: https://github.com/apache/pinot/pull/10122#discussion_r1073965486
##########
pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotRuleUtils.java:
##########
@@ -23,22 +23,28 @@
import org.apache.calcite.rel.RelNode;
import org.apache.calcite.rel.core.Exchange;
import org.apache.calcite.rel.core.RelFactories;
+import org.apache.calcite.rel.logical.LogicalAggregate;
+import org.apache.calcite.rel.logical.LogicalJoin;
import org.apache.calcite.tools.RelBuilder;
import org.apache.calcite.tools.RelBuilderFactory;
-public class PinotRuleUtils {
+class PinotRuleUtils {
private static final RelBuilder.Config DEFAULT_CONFIG =
RelBuilder.Config.DEFAULT.withAggregateUnique(true).withPushJoinCondition(true);
- public static final RelBuilderFactory PINOT_REL_FACTORY =
+ static final RelBuilderFactory PINOT_REL_FACTORY =
RelBuilder.proto(Contexts.of(RelFactories.DEFAULT_STRUCT,
DEFAULT_CONFIG));
+ // A AggregateExtractProjectRule configured to run when a LogicalAggregate
sits atop a LogicalJoin.
+ static final AggregateExtractProjectRule
PINOT_AGGREGATE_EXTRACT_PROJECT_RULE =
+ new AggregateExtractProjectRule(LogicalAggregate.class,
LogicalJoin.class, PinotRuleUtils.PINOT_REL_FACTORY);
Review Comment:
use a generic RelNode with negate project OperandSupplier will match more
generic cases.
```suggestion
static final AggregateExtractProjectRule
PINOT_AGGREGATE_EXTRACT_PROJECT_RULE =
new
AggregateExtractProjectRule(ImmutableAggregateExtractProjectRule.Config.of()
.withOperandSupplier(b0 -> b0.operand(Aggregate.class).oneInput(
b1 -> b1.operand(RelNode.class).predicate(r -> !(r instanceof
Project)).anyInputs()))
.withRelBuilderFactory(PINOT_REL_FACTORY));
```
--
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]