Is there any way to solve this issue?
On 2018/05/23 12:30:42, [email protected] <[email protected]> wrote: > Query: > SELECT X.a FROM X LEFT JOIN Y ON X.b=Y.c INNER JOIN (SELECT X.a FROM X) t ON > X.a=t.a; > > 102:LogicalProject(a=[$0]) > 101:LogicalJoin(condition=[=($0, $3)], joinType=[inner]) > 98:LogicalJoin(condition=[=($1, $2)], joinType=[left]) > 96:EnumerableTableScan(table=[[X]]) > 97:EnumerableTableScan(table=[[Y]]) > 100:LogicalProject(a=[$0]) > 99:EnumerableTableScan(table=[[X]]) > > Root {kind: SELECT, rel: EnumerableProject#173, rowType: RecordType(BIGINT > a), fields: [<0, a>], collation: []} > 173:EnumerableProject(a=[$1]) > 172:EnumerableJoin(condition=[=($0, $1)], joinType=[inner]) > 170:EnumerableProject(a=[$0]) > 96:EnumerableTableScan(table=[[X]]) > 171:EnumerableJoin(condition=[=($1, $2)], joinType=[left]) > 96:EnumerableTableScan(table=[[X]]) > 97:EnumerableTableScan(table=[[Y]]) > > > > Schema: > > Table X: > Column Type > a bigint not null > b bigint not null > > Table Y: > Column Type > c bigint not null > > On 2018/05/14 20:36:28, Vitalii Diravka <[email protected]> wrote: > > Check yours intermediate RelNode plan, which is going to be improved by > > this rule. The operands and their ordering are important in matching of the > > rules. > > https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/rel/rules/JoinPushThroughJoinRule.java#L87 > > > > From your case the rule should match. Could you share please the plan? > > > > Kind regards > > Vitalii > > > > > > On Tue, May 8, 2018 at 4:24 PM [email protected] < > > [email protected]> wrote: > > > > > Okay let me rephrase my question. > > > > > > I am executing a query having inner and left join. The plan generated by > > > calcite for that query is like > > > > > > inner > > > / \ > > > left C > > > / \ > > > A B > > > > > > But it would be better if it proceeds inner join first, as the row count > > > will be reduced further to proceed left join. So the plan needed is, > > > > > > left > > > / \ > > > inner B > > > / \ > > > A C > > > > > > So I read through the documentation and found JoinPushThroughJoinRule will > > > do so. So I tried applying them (Till now, I am giving only row count to > > > statistics). But no change in the plan. > > > > > > Then I found onMatch() in JoinPushThroughJoinRule.java has > > > not been called at all. > > > > > > How can this be resolved? > > > > > > > > > On 2018/05/04 14:23:00, Michael Mior <[email protected]> wrote: > > > > I have no immediate answers, but it would be helpful if you could > > > provide a > > > > complete working example of code that exhibits the problem. > > > > > > > > -- > > > > Michael Mior > > > > [email protected] > > > > > > > > > > > > Le ven. 4 mai 2018 à 03:58, Valli Annamalai <[email protected]> a > > > > écrit : > > > > > > > > > I wanted to apply JoinPushThroughJoinRule.LEFT and > > > > > JoinPushThroughJoinRule.RIGHT to the plan for optimization. So I added > > > > > those 2 rules to Program and ran it as a sequence of programs. > > > > > > > > > > But I am not getting plan applied with these rules > > > > > > > > > > I did read [here > > > > > < > > > > > > > > https://issues.apache.org/jira/browse/CALCITE-457?focusedCommentId=14205221&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14205221 > > > > > >] > > > > > that adding rules does not mean that the plan will be better. So > > > > > sanity > > > > > checks may fail. In my case, during onMatch() checks (in > > > > > matchRecurse() > > > > > from ValcanoRuleCall.java), it fails because of no parents for the > > > subsets > > > > > (getParentRels() returns empty list) . > > > > > > > > > > Thus there are no successors and the recursion has not been trigerred. > > > So > > > > > the rules has not been fired (onMatch() in > > > JoinPushThroughJoinRule.java has > > > > > not been called at all). What can be done for that? > > > > > > > > > > Any other flags need to be enabled or rules to be added?? > > > > > > > > > > > > > > > Thanks in advance > > > > > > > > > > > > > > >
