Andrew Lamb created ARROW-9771: ---------------------------------- Summary: [Rust] [DataFusion] Predicate Pushdown Improvement: treat predicates separated by AND separately Key: ARROW-9771 URL: https://issues.apache.org/jira/browse/ARROW-9771 Project: Apache Arrow Issue Type: Improvement Reporter: Andrew Lamb
As discussed by [~jorgecarleitao] and [~houqp] here: https://github.com/apache/arrow/pull/7880#pullrequestreview-468057624 If a predicate is a conjunction (aka AND'd) together, each of the clauses can be treated separately (e.g. a single filter expression {{A > 5 And B < 4}} can be broken up and each of {{A > 5}} and {{B < 4}} can be potentially pushed down different levels The filter pushdown logic works for the following case (when {{a}} and {{b}} are are separate selections, predicate for a is pushed below the {{Aggregate}} in the optimized plan): {code} ********Original plan: Selection: #b GtEq Int64(1) Selection: #a LtEq Int64(1) Aggregate: groupBy=[[#a]], aggr=[[MIN(#b)]] TableScan: test projection=None ********Optimized plan: Selection: #b GtEq Int64(1) Aggregate: groupBy=[[#a]], aggr=[[MIN(#b)]] Selection: #a LtEq Int64(1) TableScan: test projection=None {code} But not for this when {{a}} and {{b}} are {{AND}}'d together {code} ********Original plan: Selection: #a LtEq Int64(1) And #b GtEq Int64(1) Aggregate: groupBy=[[#a]], aggr=[[MIN(#b)]] TableScan: test projection=None ********Optimized plan: Selection: #a LtEq Int64(1) And #b GtEq Int64(1) Aggregate: groupBy=[[#a]], aggr=[[MIN(#b)]] TableScan: test projection=None {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)