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

Jeyhun Karimov commented on FLINK-32679:
----------------------------------------

Hi [~grandfisher] the mentioned query does pushes the join conditions down the 
join operator (I verified below with the current master - 
d6a4eb966fbc47277e07b79e7c64939a62eb1d54). Or am I missing something? 

 
{code:java}
Calc(select=[CAST(0 AS INTEGER) AS id, b, CAST(0 AS INTEGER) AS id0, b0, CAST(0 
AS INTEGER) AS id1, b1, CAST(0 AS INTEGER) AS id2, b2, CAST(0 AS INTEGER) AS 
id3, b3])
+- Join(joinType=[InnerJoin], where=[true], select=[b, b0, b1, b2, b3], 
leftInputSpec=[NoUniqueKey], rightInputSpec=[NoUniqueKey])
   :- Exchange(distribution=[single])
   :  +- Join(joinType=[InnerJoin], where=[true], select=[b, b0, b1, b2], 
leftInputSpec=[NoUniqueKey], rightInputSpec=[NoUniqueKey])
   :     :- Exchange(distribution=[single])
   :     :  +- Join(joinType=[InnerJoin], where=[true], select=[b, b0, b1], 
leftInputSpec=[NoUniqueKey], rightInputSpec=[NoUniqueKey])
   :     :     :- Exchange(distribution=[single])
   :     :     :  +- Join(joinType=[InnerJoin], where=[true], select=[b, b0], 
leftInputSpec=[NoUniqueKey], rightInputSpec=[NoUniqueKey])
   :     :     :     :- Exchange(distribution=[single])
   :     :     :     :  +- Calc(select=[b], where=[(id = 0)])
   :     :     :     :     +- TableSourceScan(table=[[default_catalog, 
default_database, v1]], fields=[id, b])
   :     :     :     +- Exchange(distribution=[single])
   :     :     :        +- Calc(select=[b], where=[(id = 0)])
   :     :     :           +- TableSourceScan(table=[[default_catalog, 
default_database, v2]], fields=[id, b])
   :     :     +- Exchange(distribution=[single])
   :     :        +- Calc(select=[b], where=[(0 = id)])
   :     :           +- TableSourceScan(table=[[default_catalog, 
default_database, v3]], fields=[id, b])
   :     +- Exchange(distribution=[single])
   :        +- Calc(select=[b], where=[(0 = id)])
   :           +- TableSourceScan(table=[[default_catalog, default_database, 
v4]], fields=[id, b])
   +- Exchange(distribution=[single])
      +- Calc(select=[b], where=[(0 = id)])
         +- TableSourceScan(table=[[default_catalog, default_database, v5]], 
fields=[id, b]){code}

> Filter conditions cannot be pushed to JOIN in some case
> -------------------------------------------------------
>
>                 Key: FLINK-32679
>                 URL: https://issues.apache.org/jira/browse/FLINK-32679
>             Project: Flink
>          Issue Type: Improvement
>          Components: Table SQL / Planner
>            Reporter: grandfisher
>            Priority: Major
>
> There is a case
> {code:java}
> SELECT a.id, b.id, c.id, d.id, e.id
>       , f.id
> FROM `table-v1` a
>       INNER JOIN `table-v2` b ON a.id = b.id
>       INNER JOIN `table-v3` c ON b.id = c.id
>       INNER JOIN `table-v4` d ON c.id = d.id
>       INNER JOIN `table-v5` e ON d.id = e.id
>       INNER JOIN `table-v6` f ON a.id = f.id
> WHERE f.id = 0
> {code}
> In this sql, each table should have a condition {*}id=0{*}, but actually only 
> table *f* and *a* has this condition.



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

Reply via email to