Skip to content

Commit

Permalink
[CALCITE-5832] Avoid cycle in relational nodes.
Browse files Browse the repository at this point in the history
  • Loading branch information
kramerul committed Dec 13, 2023
1 parent a6729b7 commit 34f2b3d
Showing 1 changed file with 11 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,7 @@

import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.IdentityHashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Set;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

Expand Down Expand Up @@ -1107,13 +1097,17 @@ private boolean fixUpInputs(RelNode rel) {
assert input instanceof RelSubset;
final RelSubset subset = (RelSubset) input;
RelSubset newSubset = canonize(subset);
newInputs.add(newSubset);
if (newSubset != subset) {
if (subset.set != newSubset.set) {
subset.set.parents.remove(rel);
newSubset.set.parents.add(rel);
if ( rel == subset.best) {
newInputs.add(input);
} else {
newInputs.add(newSubset);
if (newSubset != subset) {
if (subset.set != newSubset.set) {
subset.set.parents.remove(rel);
newSubset.set.parents.add(rel);
}
changeCount++;
}
changeCount++;
}
}

Expand Down

0 comments on commit 34f2b3d

Please sign in to comment.