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

Alessandro Solimando commented on CALCITE-5720:
-----------------------------------------------

{quote}`SELECT * FROM MyTable1 join MyTable2 ON a1 = a2 AND a1 = 2`

`SELECT * FROM MyTable1, MyTable2 WHERE a1 = a2 AND a1 = 2`
{quote}
The kind of enhancements proposed in this ticket looks a lot like "inferring 
predicates from one side of a join and pushing to the other side", and 
therefore, ideally, I would not make _FilterJoinRule_ more complex by adding 
support for more inference patterns, but rather use 
_JoinPushTransitivePredicatesRule_ and eventually fix its existing issues if 
needed (even with some heuristics at first, like limiting the number of times 
the rule can be applied to avoid the cases where the fix-point cannot be 
reached).

On the other hand, the line separating the two rules is a bit fuzzy, and I also 
understand that in the short-term enhancing _FilterJoinRule_ brings more 
immediate value, although it will make the situation more complex in the 
mid/long run.

In summary, I only have a slight preference but not a very strong opinion, I 
see value on both ways of moving forward.

The discussion is interesting IMO and it's quite general, about how to deal 
with short vs long term benefits, maybe in the ML we could gather more valuable 
opinions.

> improve FilterJoinRule to push filter into both join sides
> ----------------------------------------------------------
>
>                 Key: CALCITE-5720
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5720
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: Suhan Mao
>            Priority: Major
>
> In flink source code, 
> [FlinkFilterJoinRule|https://github.com/apache/flink/blob/master/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/rules/logical/FlinkFilterJoinRule.java],
>  the FilterJoinRule is improved to handle more cases:
> for the above filter of inner/left/right join or the join condition of inner 
> join, the predicate which field references are all from one side join 
> condition can be pushed into another join side. Such as:
> `SELECT * FROM MyTable1 join MyTable2 ON a1 = a2 AND a1 = 2`
> `SELECT * FROM MyTable1, MyTable2 WHERE a1 = a2 AND a1 = 2 `
>  
> I would like to add the improvement to exist FilterJoinRule class.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to