neoremind commented on a change in pull request #1869: [CALCITE-3868] Remove
redundant ruleSet and ruleNames in VolcanoPlanner
URL: https://github.com/apache/calcite/pull/1869#discussion_r398354625
##########
File path: core/src/main/java/org/apache/calcite/plan/hep/HepPlanner.java
##########
@@ -275,7 +253,7 @@ void executeInstruction(
LOGGER.trace("Applying rule class {}", instruction.ruleClass);
if (instruction.ruleSet == null) {
instruction.ruleSet = new LinkedHashSet<>();
- for (RelOptRule rule : allRules) {
+ for (RelOptRule rule : mapDescToRule.values()) {
Review comment:
If we already know the size of `mapDescToRule`, we can create a set with
exact size, which will eliminate capacity expansion overhead and space waste
when creating. Even though this is trivial update, I think it is always a good
manner to create collection in such way if possible.
```
instruction.ruleSet = Sets.newHashSetWithExpectedSize(mapDescToRule.size());
```
----------------------------------------------------------------
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]
With regards,
Apache Git Services