comphead commented on code in PR #9933:
URL: https://github.com/apache/arrow-datafusion/pull/9933#discussion_r1552244127
##########
datafusion/expr/src/logical_plan/builder.rs:
##########
@@ -1152,36 +1152,35 @@ pub fn build_join_schema(
join_type: &JoinType,
) -> Result<DFSchema> {
fn nullify_fields<'a>(
- fields: impl Iterator<Item = (Option<&'a OwnedTableReference>, &'a
Arc<Field>)>,
- ) -> Vec<(Option<OwnedTableReference>, Arc<Field>)> {
+ fields: impl Iterator<Item = (Option<&'a TableReference>, &'a
Arc<Field>)>,
+ ) -> Vec<(Option<TableReference>, Arc<Field>)> {
fields
.map(|(q, f)| {
// TODO: find a good way to do that
let field = f.as_ref().clone().with_nullable(true);
- (q.map(|r| r.to_owned_reference()), Arc::new(field))
+ (q.cloned(), Arc::new(field))
})
.collect()
}
let right_fields = right.iter();
let left_fields = left.iter();
- let qualified_fields: Vec<(Option<OwnedTableReference>, Arc<Field>)> =
match join_type
- {
+ let qualified_fields: Vec<(Option<TableReference>, Arc<Field>)> = match
join_type {
JoinType::Inner => {
// left then right
let left_fields = left_fields
- .map(|(q, f)| (q.map(|r| r.to_owned_reference()), f.clone()))
+ .map(|(q, f)| (q.cloned(), f.clone()))
.collect::<Vec<_>>();
let right_fields = right_fields
- .map(|(q, f)| (q.map(|r| r.to_owned_reference()), f.clone()))
+ .map(|(q, f)| (q.cloned(), f.clone()))
.collect::<Vec<_>>();
left_fields.into_iter().chain(right_fields).collect()
}
JoinType::Left => {
// left then right, right set to nullable in case of not matched
scenario
let left_fields = left_fields
- .map(|(q, f)| (q.map(|r| r.to_owned_reference()), f.clone()))
+ .map(|(q, f)| (q.cloned(), f.clone()))
Review Comment:
I'm thinking to try removing all this clones in future... if possible
--
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]