Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
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
Attachments
Issue Links
- links to