[
https://issues.apache.org/jira/browse/CALCITE-3968?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17098001#comment-17098001
]
Haisheng Yuan commented on CALCITE-3968:
----------------------------------------
||Left-Hand Bracketed||Right-Hand Bracketed||Equivalence||
|(A inner B) inner C|A inner (B inner C)|Equivalent|
|(A left B) inner C|A left (B inner C)|*Not equivalent*|
|(A right B) inner C|A right (B inner C)|Equivalent|
|(A full B) inner C|A full (B inner C)|*Not equivalent*|
|(A inner B) left C|A inner (B left C)|Equivalent|
|(A left B) left C|A left (B left C)|Equivalent|
|(A right B) left C|A right (B left C)|Equivalent|
|(A full B) left C|A full (B left C)|Equivalent|
|(A inner B) right C|A inner (B right C)|*Not equivalent*|
|(A left B) right C|A left (B right C)|*Not equivalent*|
|(A right B) right C|A right (B right C)|Equivalent|
|(A full B) right C|A full (B right C)|*Not equivalent*|
|(A inner B) full C|A inner (B full C)|*Not equivalent*|
|(A left B) full C|A left (B full C)|*Not equivalent*|
|(A right B) full C|A right (B full C)|Equivalent|
|(A full B) full C|A full (B full C)|Equivalent|
The above table is from:
[http://blog.ylett.com/2011/09/non-associativity-of-sql-table-joins.html]
> Disable JoinPushThroughJoinRule.left by default
> -----------------------------------------------
>
> Key: CALCITE-3968
> URL: https://issues.apache.org/jira/browse/CALCITE-3968
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Reporter: Haisheng Yuan
> Priority: Major
> Time Spent: 10m
> Remaining Estimate: 0h
>
> JoinPushThroughJoinRule.right does
> (RS)T -> (RT)S
> JoinPushThroughJoinRule.left does
> (RS)T -> (TS)R
> If JoinCommuteRule is enabled, only enabling JoinPushThroughJoinRule.right
> can achieve the same alternative with JoinPushThroughJoinRule.left, vice
> versa (suppose they are connected). So there is no need to enable left and
> right instances at the same time, which will slow down the optimization
> dramatically, e.g TPCH q05, q07 in TpchTest.java never finish. There is also
> the same bug report from [1].
> Meanwhile, JoinPushThroughJoinRule matches RelNode.class, which is
> unnecessary. It should be just a group, or RelSet / RelSubset, as a place
> holder, because we don't care about what exactly the top join's right child
> is. But since the rule is designed to work with both HepPlanner and
> VolcanoPlanner, so just bear with the slowness.
> [1]
> https://lists.apache.org/thread.html/r195c267ef15f50aa21bbcefd7bf523f8bf2495b2345fd163e91e3c36%40%3Cdev.calcite.apache.org%3E
--
This message was sent by Atlassian Jira
(v8.3.4#803005)