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

Vladimir Sitnikov edited comment on CALCITE-3668 at 1/4/20 7:47 AM:
--------------------------------------------------------------------

{quote} It has been there for 10 years or so, no one reports any issue with 
it.{quote}
No-one was using operand(RelSubset.class).

{quote}Well, you are right, it matches all relnodes satisfying its traitset. 
Then would it make sense to return all the subsets with same convention for 
matched RelSubset?{quote}
I could understand/agree if returned all the subsets that satisfy input trait 
requirements.
However, two modes might be helpful: "return just the subset which is used as 
the input", and "return all the subsets that satisfy input requirements"

{quote}Do you think it is a good practice to expose subset.set.subsets? They 
are not public, can't be accessed through rule.{quote}
Oh, I did not notice it was not public.

For now there's RelSubset#getRels which returns all the rels that are part of 
the subset.
How about adding RelSubset#getSubsets which would return all the subsets that 
satisfy subset traits?

E.g. something like
{code:java}
class RelSubset {
...
  public Iterable<RelSubset> getSubsets() {
    return Iterables.filter(set.subsets, s -> 
s.getTraitSet().satisfies(traitSet));
  }
{code}


was (Author: vladimirsitnikov):
{quote} It has been there for 10 years or so, no one reports any issue with 
it.{quote}
No-one was using operand(RelSubset.class).

{quote}Well, you are right, it matches all relnodes satisfying its traitset. 
Then would it make sense to return all the subsets with same convention for 
matched RelSubset?{quote}
I could understand/agree if returned all the subsets that satisfy input trait 
requirements.
However, two modes might be helpful: "return just the subset which is used as 
the input", and "return all the subsets that satisfy input requirements"

{quote}Do you think it is a good practice to expose subset.set.subsets? They 
are not public, can't be accessed through rule.{quote}
Oh, I did not notice it was not public.

For now there's RelSubset#getRels which returns all the rels that are part of 
the subset.
How about adding RelSubset#getSubsets which would return all the subsets that 
satisfy subset traits?

E.g. something like
{code:java}
  public Iterable<RelSubset> getSubsets() {
    return Iterables.filter(set.subsets, s -> 
s.getTraitSet().satisfies(traitSet));
  }
{code}

> 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