[
https://issues.apache.org/jira/browse/CALCITE-3211?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16892754#comment-16892754
]
Julian Hyde commented on CALCITE-3211:
--------------------------------------
I don’t see this as a problem, per se. In fact, retaining parent information is
probably an impossible goal.
What is the use case you are trying to solve?
> MutableRel returned from MutableRels::toMutables may lose reference to parent
> -----------------------------------------------------------------------------
>
> Key: CALCITE-3211
> URL: https://issues.apache.org/jira/browse/CALCITE-3211
> Project: Calcite
> Issue Type: Bug
> Reporter: jin xing
> Priority: Major
> Labels: pull-request-available
> Time Spent: 10m
> Remaining Estimate: 0h
>
> Current implementation of {{MutableRels::toMutables}} is as below:
> {code:java}
> private static List<MutableRel> toMutables(List<RelNode> nodes) {
> return Lists.transform(nodes, MutableRels::toMutable);
> }
> {code}
> Thus every time we {{get}} from the result list, a new {{MutableRel}} will be
> created:
> {code:java}
> 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));
> }
> ......
> {code}
> As a result, the {{parent}} information will be lost.
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)