You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Jark Wu (Jira)" <ji...@apache.org> on 2022/03/28 10:02:00 UTC

[jira] [Commented] (FLINK-25593) A redundant scan could be skipped if it is an input of join and the other input is empty after partition prune

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

Jark Wu commented on FLINK-25593:
---------------------------------

If the left scan is prunned, then the inner join can also be pruned, the final plan should be an empty values? 

> A redundant scan could be skipped if it is an input of join and the other input is empty after partition prune
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: FLINK-25593
>                 URL: https://issues.apache.org/jira/browse/FLINK-25593
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Table SQL / Planner
>            Reporter: Jing Zhang
>            Priority: Major
>
> A redundant scan could be skipped if it is an input of join and the other input is empty after partition prune.
> For example:
> ltable has two partitions: pt=0 ad pt=1, rtable has one partition pt1=0.
> The schema of ltable is (lkey string, value int).
> The schema of rtable is (rkey string, value int).
> {code:sql}
> SELECT * FROM ltable, rtable WHERE pt=2 and pt1=0 and `lkey`=rkey
> {code}
> The plan is as following.
> {code:java}
> Calc(select=[lkey, value, CAST(2 AS INTEGER) AS pt, rkey, value1, CAST(0 AS INTEGER) AS pt1])
> +- HashJoin(joinType=[InnerJoin], where=[=(lkey, rkey)], select=[lkey, value, rkey, value1], build=[right])
>    :- Exchange(distribution=[hash[lkey]])
>    :  +- TableSourceScan(table=[[hive, source_db, ltable, partitions=[], project=[lkey, value]]], fields=[lkey, value])
>    +- Exchange(distribution=[hash[rkey]])
>       +- TableSourceScan(table=[[hive, source_db, rtable, partitions=[{pt1=0}], project=[rkey, value1]]], fields=[rkey, value1])
> {code}
> There is no need to scan right side because the left input of join has 0 partitions after partition prune.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)