gortiz commented on code in PR #17328:
URL: https://github.com/apache/pinot/pull/17328#discussion_r2639959221
##########
pinot-query-planner/src/main/java/org/apache/pinot/calcite/rel/rules/PinotQueryRuleSets.java:
##########
@@ -252,4 +254,33 @@ private PinotQueryRuleSets() {
CoreRules.FILTER_REDUCE_EXPRESSIONS
);
//@formatter:on
+
+ public static List<RelOptRule> getPinotPostRules(QueryEnvironment.Config
envConfig) {
+ int sortExchangeCopyLimit = envConfig.getSortExchangeCopyLimit();
+ if (sortExchangeCopyLimit == -1) {
+ return PINOT_POST_RULES;
+ } else {
+ return replaceAll(
+ PINOT_POST_RULES,
+ PinotSortExchangeCopyRule.class,
+ ImmutablePinotSortExchangeCopyRule.Config.builder()
+ .from(PinotSortExchangeCopyRule.Config.DEFAULT)
+ .fetchLimitThreshold(sortExchangeCopyLimit)
+ .build()
+ .toRule()
+ );
+ }
+ }
+
+ private static <C extends RelOptRule> List<RelOptRule> replaceAll(List<?
extends RelOptRule> rules,
+ Class<? extends C> clazz, C newRule) {
+ List<RelOptRule> updatedRules = new ArrayList<>(rules);
+ for (int i = 0; i < updatedRules.size(); i++) {
+ RelOptRule rule = updatedRules.get(i);
+ if (clazz.isInstance(rule)) {
+ updatedRules.set(i, newRule);
+ }
+ }
+ return updatedRules;
+ }
Review Comment:
I've changed this code. It is still not the best TBH. We need to cleanup
this part of the code
--
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]