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

ZiLin Chen commented on CALCITE-4681:
-------------------------------------

I had tried the way using predicate restricting only empty collation or any 
distribution RelSubset, But XXX operand can be Sort, which has collation. I can 
not determine which collation the XXX should have at the beginning. So using 
predicate way is not a general solution. I also had tried add some logic in 
matches. But matches may check fail after DeferringRuleCall in some case. 
(RelSet has been merged). All these ways can't work really well, because I even 
don't care about what XXX is and don't want to match it. Matching will cause 
performance problem when the number of RelSubset become large.
{code:java}
public boolean matches(RelOptRuleCall call) {
    return ( (LogicalJoin)call.rel(0)).getLeft() == call.rel(1);
}
{code}
 

> Rule operand match specific shape with or without 
> RelSubset.class/RelNode.class
> -------------------------------------------------------------------------------
>
>                 Key: CALCITE-4681
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4681
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: ZiLin Chen
>            Priority: Major
>
> If we want to match such a pattern, LogicalJoin1 with left Input XXX(original 
> LogicalJoin1 left input) and with right input (LogicalJoin.class).  we wound 
> find that XXX we should use RelNode.class or RelSubset.class. However both 
> RelNode.class and RelSubset.class will match all kind of traitSet which is 
> inefficient(rule may fires multi time just because of some kind of XXX with 
> different trait), especially when this is a JoinReorder Rule.
> The XXX operand we want to match is exact what LogicalJoin1.getLeft() return. 
> LogicalJoin1
>  - XXX(original LogicalJoin1 left input)
>  - LogicalJoin2
>  
> Is that any way we can provide to solve this problem?
> One way maybe changing what RelSubset.class operand match meaning? (Now, 
> there is no rule in calcite with RelSubset.class as match operand. Before 
> JoinAssociateRule is the only one match RelSubset.class, but change later )
>  



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

Reply via email to