jiacai2050 opened a new issue, #9109:
URL: https://github.com/apache/arrow-datafusion/issues/9109
### Describe the bug
When upgrade latest datafusion from a old version, i found
`optimize_projections` rule produce wrong projection.
```
create table t(x bigint, y bigint) as values (1,1), (2,2);
select x from t where y > 0;
```
Only x will be included in `projection`, y is missing from the plan.
### To Reproduce
First apply following changes, the purpose is to push down all filters
```diff
@@ -884,6 +884,7 @@ impl OptimizerRule for PushDownFilter {
let results = scan
.source
.supports_filters_pushdown(filter_predicates.as_slice())?;
+ let results = vec![TableProviderFilterPushDown::Exact;
results.len()];
let zip = filter_predicates.iter().zip(results);
```
Then run datafusion-cli:
```
create table t(x bigint, y bigint) as values (1,1), (2,2);
explain verbose select x from t where y > 0;
```
Then we will get
```
| logical_plan after optimize_projections | Projection:
t.x
|
| | TableScan:
t projection=[x], unsupported_filters=[t.y > Int64(0)]
|
```
### Expected behavior
The right projection should be `[x, y]`.
### 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]