walterddr commented on code in PR #10409:
URL: https://github.com/apache/pinot/pull/10409#discussion_r1134897846
##########
pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotQueryRuleSets.java:
##########
@@ -88,31 +86,41 @@ private PinotQueryRuleSets() {
// reduce aggregate functions like AVG, STDDEV_POP etc.
PinotReduceAggregateFunctionsRule.INSTANCE,
- CoreRules.AGGREGATE_REDUCE_FUNCTIONS,
-
- // remove unnecessary sort rule
- CoreRules.SORT_REMOVE,
-
- // prune empty results rules
- PruneEmptyRules.AGGREGATE_INSTANCE, PruneEmptyRules.FILTER_INSTANCE,
PruneEmptyRules.JOIN_LEFT_INSTANCE,
- PruneEmptyRules.JOIN_RIGHT_INSTANCE,
PruneEmptyRules.PROJECT_INSTANCE, PruneEmptyRules.SORT_INSTANCE,
- PruneEmptyRules.UNION_INSTANCE,
-
- // ------------------------------------------------------------------
- // Pinot specific rules
- // ------------------------------------------------------------------
-
- // ---- rules apply before exchange insertion.
- PinotFilterExpandSearchRule.INSTANCE,
-
- // ---- rules that insert exchange.
- // add an extra exchange for sort
- PinotSortExchangeNodeInsertRule.INSTANCE,
- // copy exchanges down, this must be done after
SortExchangeNodeInsertRule
- PinotSortExchangeCopyRule.SORT_EXCHANGE_COPY,
-
- PinotJoinExchangeNodeInsertRule.INSTANCE,
- PinotAggregateExchangeNodeInsertRule.INSTANCE,
- PinotWindowExchangeNodeInsertRule.INSTANCE
+ CoreRules.AGGREGATE_REDUCE_FUNCTIONS
);
+
+ // Filter pushdown rules run using a RuleCollection since we want to push
down a filter as much as possible in a
+ // single HepInstruction.
+ public static final Collection<RelOptRule> FILTER_PUSHDOWN_RULES =
ImmutableList.of(
+ CoreRules.FILTER_INTO_JOIN,
+ CoreRules.FILTER_AGGREGATE_TRANSPOSE,
+ CoreRules.FILTER_SET_OP_TRANSPOSE,
+ CoreRules.FILTER_PROJECT_TRANSPOSE
+ );
+
+ // The pruner rules run top-down to ensure Calcite restarts from root node
after applying a transformation.
+ public static final Collection<RelOptRule> PRUNE_RULES = ImmutableList.of(
+ CoreRules.PROJECT_MERGE,
+ CoreRules.AGGREGATE_REMOVE,
+ CoreRules.SORT_REMOVE,
+ PruneEmptyRules.AGGREGATE_INSTANCE, PruneEmptyRules.FILTER_INSTANCE,
PruneEmptyRules.JOIN_LEFT_INSTANCE,
+ PruneEmptyRules.JOIN_RIGHT_INSTANCE, PruneEmptyRules.PROJECT_INSTANCE,
PruneEmptyRules.SORT_INSTANCE,
+ PruneEmptyRules.UNION_INSTANCE
+ );
+
+ // Pinot specific rules that should be run after all other rules
+ public static final Collection<RelOptRule> PINOT_POST_RULES =
ImmutableList.of(
+ // ---- rules apply before exchange insertion.
+ PinotFilterExpandSearchRule.INSTANCE,
Review Comment:
filter expand search rule can be applied with filter rules or basic rules
IMO.
--
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]