-
Type:
Bug
-
Status: Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 1.21.0
-
Component/s: None
-
Labels:
Current implementation of MutableRels::toMutables is as below:
private static List<MutableRel> toMutables(List<RelNode> nodes) { return Lists.transform(nodes, MutableRels::toMutable); }
Thus every time we get from the result list, a new MutableRel will be created:
private static class TransformingRandomAccessList<F, T> extends AbstractList<T> implements RandomAccess, Serializable { final List<F> fromList; final Function<? super F, ? extends T> function; TransformingRandomAccessList(List<F> fromList, Function<? super F, ? extends T> function) { this.fromList = checkNotNull(fromList); this.function = checkNotNull(function); } @Override public T get(int index) { return function.apply(fromList.get(index)); } ......
As a result, https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/plan/SubstitutionVisitor.java#L514 SubstitutionVisitor will fail to check whether a node has been met/matched before
- links to