You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2019/07/25 08:19:01 UTC

[GitHub] [calcite] jinxing64 opened a new pull request #1330: [CALCITE-3211] MutableRel returned from MutableRels::toMutables may lose reference to parent

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:
users@infra.apache.org


With regards,
Apache Git Services