[ https://issues.apache.org/jira/browse/CALCITE-5563?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ruben Q L resolved CALCITE-5563. -------------------------------- Resolution: Fixed Fixed via https://github.com/apache/calcite/commit/f500e2f1570c0992dbb90e080b821f77cf3150ee Thanks for the patch [~xinqiu] ! > Reduce loops to optimize RelSubset#getParents and RelSubset#getParentSubsets > ---------------------------------------------------------------------------- > > Key: CALCITE-5563 > URL: https://issues.apache.org/jira/browse/CALCITE-5563 > Project: Calcite > Issue Type: Improvement > Components: core > Reporter: asdfgh19 > Assignee: asdfgh19 > Priority: Minor > Labels: pull-request-available > Fix For: 1.35.0 > > Time Spent: 1h > Remaining Estimate: 0h > > > {code:java} > /** > * 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; > }{code} > > 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. -- This message was sent by Atlassian Jira (v8.20.10#820010)