You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "asdfgh19 (Jira)" <ji...@apache.org> on 2023/03/07 13:45:00 UTC
[jira] [Created] (CALCITE-5563) Add a break to the inner loop of RelSubset#getParents and RelSubset#getParentSubsets after we find a matching Relsubset from its parent input
asdfgh19 created CALCITE-5563:
---------------------------------
Summary: Add a break to the inner loop of RelSubset#getParents and RelSubset#getParentSubsets after we find a matching Relsubset from its parent input
Key: CALCITE-5563
URL: https://issues.apache.org/jira/browse/CALCITE-5563
Project: Calcite
Issue Type: Improvement
Components: core
Reporter: asdfgh19
Assignee: asdfgh19
Fix For: 1.34.0
{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, we can immediately end the inner loop.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)