nuno-faria opened a new issue, #19917: URL: https://github.com/apache/datafusion/issues/19917
### Describe the bug If we have a filter on a join key, we can push it down to both relations. Currently, it is only pushed for inner joins, although it can be applied to other join types. ### To Reproduce In this example, `k = 1` can be pushed to both tables, since `t1.k = t2.k`. Right now, it is only pushed to `t1`: ```sql create table t1 (k int, v int); create table t2 (k int, v int); explain select * from t1 left join t2 on t1.k = t2.k where t1.k = 1; +---------------+------------------------------------------------------------+ | plan_type | plan | +---------------+------------------------------------------------------------+ | physical_plan | ┌───────────────────────────┐ | | | │ HashJoinExec │ | | | │ -------------------- │ | | | │ join_type: Left ├──────────────┐ | | | │ on: (k = k) │ │ | | | └─────────────┬─────────────┘ │ | | | ┌─────────────┴─────────────┐┌─────────────┴─────────────┐ | | | │ RepartitionExec ││ RepartitionExec │ | | | │ -------------------- ││ -------------------- │ | | | │ partition_count(in->out): ││ partition_count(in->out): │ | | | │ 1 -> 12 ││ 1 -> 12 │ | | | │ ││ │ | | | │ partitioning_scheme: ││ partitioning_scheme: │ | | | │ Hash([k@0], 12) ││ Hash([k@0], 12) │ | | | └─────────────┬─────────────┘└─────────────┬─────────────┘ | | | ┌─────────────┴─────────────┐┌─────────────┴─────────────┐ | | | │ FilterExec ││ DataSourceExec │ | | | │ -------------------- ││ -------------------- │ | | | │ predicate: k = 1 ││ bytes: 0 │ | | | │ ││ format: memory │ | | | │ ││ rows: 0 │ | | | └─────────────┬─────────────┘└───────────────────────────┘ | | | ┌─────────────┴─────────────┐ | | | │ DataSourceExec │ | | | │ -------------------- │ | | | │ bytes: 0 │ | | | │ format: memory │ | | | │ rows: 0 │ | | | └───────────────────────────┘ | | | | +---------------+------------------------------------------------------------+ ``` ### Expected behavior Filter pushed down to both tables (when possible). ### Additional context _No response_ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
