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

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

[~maosuhan], thanks for sharing!

[~libenchao], from past experience working with the Hive's equivalent rule 
([HiveJoinPushTransitivePredicatesRule|https://github.com/apache/hive/blob/7583142cbffcb3958a546a9aaa15700bbc243df9/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveJoinPushTransitivePredicatesRule.java]),
 the rule is very sensitive to how effective _RexSimplify_ is to reach a 
fixpoint. 

When simplification is missing some opportunities, it can lead to infinite 
loops where predicates are pushed and pulled from one side of the join to the 
other without (and OOMs).

You can see an example in the Calcite meetup talk of last March 
(https://calcite.apache.org/community/#debugging-planning-issues-using-calcites-built-in-loggers),
 especially slides 44 to 51 from here: 
https://www.slideshare.net/StamatisZampetakis/debugging-planning-issues-using-calcites-builtin-loggers

This said, the rule is powerful and useful, I don't know what are the reasons 
behind the exclusion from the core ruleset, maybe you want to bring this 
discussion to the ML?

> 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