jinxing64 opened a new pull request #1330: [CALCITE-3211] MutableRel returned 
from MutableRels::toMutables may lose reference to parent
URL: https://github.com/apache/calcite/pull/1330
 
 
   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, the parent information will be lost.
   This PR propose to refine the implementation of `MutableRels::toMutables` 
and avoid creating a new `MutableRel` every time when we get the object.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to