Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
Description
/** * Returns the collection of RelNodes one of whose inputs is in this * subset. */ Set<RelNode> getParents() { final Set<RelNode> list = new LinkedHashSet<>(); for (RelNode parent : set.getParentRels()) { for (RelSubset rel : inputSubsets(parent)) { // see usage of this method in propagateCostImprovements0() if (rel == this) { list.add(parent); break; } } } return list; } /** * Returns the collection of distinct subsets that contain a RelNode one * of whose inputs is in this subset. */ Set<RelSubset> getParentSubsets(VolcanoPlanner planner) { final Set<RelSubset> list = new LinkedHashSet<>(); for (RelNode parent : set.getParentRels()) { for (RelSubset rel : inputSubsets(parent)) { if (rel.set == set && rel.getTraitSet().equals(traitSet)) { list.add(planner.getSubsetNonNull(parent)); break; } } } return list; }
Once we have found a matching Relsubset from its parent input, the subsequent inner loop is unnecessary,so we can immediately end the inner loop to save a little time. This is just a minor improment.
Attachments
Issue Links
- links to