alamb commented on a change in pull request #1088:
URL: https://github.com/apache/arrow-datafusion/pull/1088#discussion_r725167173
##########
File path: datafusion/src/optimizer/projection_push_down.rs
##########
@@ -417,9 +416,15 @@ fn optimize_plan(
})
.collect::<Result<Vec<_>>>()?;
+ let mut new_schema = Vec::new();
+ for df_field in schema.fields() {
+ if union_required_fields.contains(df_field.field()) {
+ new_schema.push(df_field.clone());
+ }
+ }
Review comment:
I don't know if you are into the whole functional programming thing, but
you can probably write this without a `mut Vec` like
```rust
let new_schema = DFSchema::new(
schema.fields()
.iter()
.filter(|df_field| {
union_required_fields.contains(df_field.field())
})
.cloned()
.collect()
)?;
```
I don't think it makes any practical difference (what you have here is fine
too) I just figured I would point it out
--
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]