alamb commented on code in PR #5328:
URL: https://github.com/apache/arrow-datafusion/pull/5328#discussion_r1118078820
##########
datafusion/common/src/dfschema.rs:
##########
@@ -314,6 +329,26 @@ impl DFSchema {
}
}
+ /// Find if the field exists with the given name
+ pub fn has_column_with_unqualified_name(&self, name: &str) -> bool {
+ let matches = self.fields_with_unqualified_name(name);
Review Comment:
Since we are doing an optimization exercise, I think we should avoid the
`collect()` into a Vec as well (as that also allocates)
Perhaps something like:
```suggestion
self.fields
.iter()
.any(|field| {
field.qualifier().map(|q| q.eq(qualifier)).unwrap_or(false)
&& field.name() == name
})
```
(maybe you can factor out the check into a function to avoid the duplication)
--
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]