[ 
https://issues.apache.org/jira/browse/CALCITE-3668?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17007777#comment-17007777
 ] 

Haisheng Yuan commented on CALCITE-3668:
----------------------------------------

Will a rule with pattern {{operand(Filter, operand(Project)))}} match the pair 
of (LogicalFilter, EnumerableProject)? It doesn't make sense either, but we 
still allow it to match. That's why we provide operand predicates and 
{{matches}} method to filter out nonsense matched pairs. 

In our case, we wanna match {{PhysicalFilter, RelSubset}}, if the input RelSet 
has multiple subsets, say {{distributed by $0}}, or distributed by {{$1, $2}}, 
each RelSubset has 10 satisfied physical relnodes. We want to propagate the 2 
different traitsets up to PhysicalFilter, to generate 2 physical filters with 
the same traitset. With {{(Filter.class, operand(RelSubset.class))}}, we just 
need to match twice to get what we want. After your change, it can only match 
one traitset. We have to change to operand  {{PhysicalFilter, RelNode}}, it 
will match 20 times.



> VolcanoPlanner doesn't match all the RelSubSet in matchRecursive
> ----------------------------------------------------------------
>
>                 Key: CALCITE-3668
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3668
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Haisheng Yuan
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> If I have a rule to match pattern with Filter-RelSubset, VolcanoPlanner only 
> matches 1 RelSubset in the RelSet, instead of all the subsets.
> {code:java}
>          if (operand.getMatchedClass() == RelSubset.class) {
>             // If the rule wants the whole subset, we just provide it
>             successors = ImmutableList.of(subset);  
>           } else {
>             successors = subset.getRelList();
>           }
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to