You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "jin xing (JIRA)" <ji...@apache.org> on 2019/07/26 05:34:00 UTC

[jira] [Updated] (CALCITE-3211) MutableRel returned from MutableRels::toMutables may fail to be identified by SubstitutionVisitor during matching

     [ https://issues.apache.org/jira/browse/CALCITE-3211?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

jin xing updated CALCITE-3211:
------------------------------
    Summary: MutableRel returned from MutableRels::toMutables  may fail to be identified by SubstitutionVisitor during matching  (was: MutableRel returned from MutableRels::toMutables  may fail to be identified by Subs)

> MutableRel returned from MutableRels::toMutables  may fail to be identified by SubstitutionVisitor during matching
> ------------------------------------------------------------------------------------------------------------------
>
>                 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, 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



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)