Affects Version/s: None
Fix Version/s: None
I'm trying to call Planner.transform(int ruleSetIndex,RelTraitSet requiredOutputTraits, RelNode rel) multiple times, and Optiq fails during the 2nd call of transform, complaining AssertionError "Used match list for phase PRE_PROCESS_MDR after phase complete" by org.eigenbase.relopt.volcano.RuleQueue.popMatch.
The reason for this error is because during the first call of transform(), in VolcanoPlanner.findBestExp(), it will remove the PhaseMatchList for each phase in rule queue, once that phase is completed:
In the following call of transform(), even there are new matched rules, those rules will not be able to be added to rule queue, since there is no PhaseMatchList for the phase in the rule queue.
To address this issue, is it possible that optiq changes as following:
1) In RuleQueue.phaseCompleted() call, we just clean up the PhaseMatchList, in stead of remove PhaseMatchList from rule queue.
2) Move the logic of ruleQueue.phaseCompleted(phase) to Planner.clearRules()? That is, clearRules() will clear both the ruleset as well as rule queue ? Or is there any particular reason that the rule queue has to be cleaned up within findBestExp() call ?