hsyuan commented on a change in pull request #2076:
URL: https://github.com/apache/calcite/pull/2076#discussion_r457807922
##########
File path:
core/src/main/java/org/apache/calcite/plan/volcano/IterativeRuleDriver.java
##########
@@ -22,11 +22,11 @@
import org.slf4j.Logger;
/***
- * <p>The algorithm executes repeatedly in a series of phases. In each phase
- * the exact rules that may be fired varies. The mapping of phases to rule
- * sets is maintained in the {@link #ruleQueue}.
+ * <p>The algorithm executes repeatedly.
+ * The exact rules that may be fired varies.
+ * The rule sets is maintained in the {@link #ruleQueue}.
Review comment:
Remove this sentence. It is not needed anymore.
##########
File path:
core/src/main/java/org/apache/calcite/plan/volcano/IterativeRuleQueue.java
##########
@@ -101,51 +63,31 @@
*/
@Override public boolean clear() {
boolean empty = true;
- for (PhaseMatchList matchList : matchListMap.values()) {
- if (!matchList.queue.isEmpty() || !matchList.preQueue.isEmpty()) {
- empty = false;
- }
- matchList.clear();
+ if (!matchList.queue.isEmpty() || !matchList.preQueue.isEmpty()) {
+ empty = false;
}
+ matchList.clear();
return !empty;
}
- /**
- * Removes the {@link PhaseMatchList rule-match list} for the given planner
- * phase.
- */
- public void phaseCompleted(VolcanoPlannerPhase phase) {
- matchListMap.get(phase).clear();
- }
-
/**
* Adds a rule match. The rule-matches are automatically added to all
- * existing {@link PhaseMatchList per-phase rule-match lists} which allow
+ * existing {@link MatchList per-phase rule-match lists} which allow
* the rule referenced by the match.
*/
public void addMatch(VolcanoRuleMatch match) {
final String matchName = match.toString();
- for (PhaseMatchList matchList : matchListMap.values()) {
- Set<String> phaseRuleSet = phaseRuleMapping.get(matchList.phase);
- if (phaseRuleSet != ALL_RULES) {
- String ruleDescription = match.getRule().toString();
- if (!phaseRuleSet.contains(ruleDescription)) {
- continue;
- }
- }
- if (!matchList.names.add(matchName)) {
- // Identical match has already been added.
- continue;
- }
+ if (!matchList.names.add(matchName)) {
+ // Identical match has already been added.
+ return;
+ }
- LOGGER.trace("{} Rule-match queued: {}", matchList.phase.toString(),
matchName);
+ LOGGER.trace("{} Rule-match queued: {}", matchList.toString(), matchName);
Review comment:
You don't want to log matchlist. Remove the first argument.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]