From 841a9a6e4120395ed3df3423b2831531ba8a3fad Mon Sep 17 00:00:00 2001 From: Alex Huang Date: Wed, 15 Nov 2023 16:02:21 +0100 Subject: [PATCH] Minor: clean up the code based on clippy (#8179) --- datafusion/physical-expr/src/array_expressions.rs | 8 ++++---- datafusion/physical-plan/src/filter.rs | 2 +- datafusion/sql/src/select.rs | 6 +----- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/datafusion/physical-expr/src/array_expressions.rs b/datafusion/physical-expr/src/array_expressions.rs index 6415bd5391d5..01d495ee7f6b 100644 --- a/datafusion/physical-expr/src/array_expressions.rs +++ b/datafusion/physical-expr/src/array_expressions.rs @@ -1440,7 +1440,7 @@ fn union_generic_lists( r: &GenericListArray, field: &FieldRef, ) -> Result> { - let converter = RowConverter::new(vec![SortField::new(l.value_type().clone())])?; + let converter = RowConverter::new(vec![SortField::new(l.value_type())])?; let nulls = NullBuffer::union(l.nulls(), r.nulls()); let l_values = l.values().clone(); @@ -1494,14 +1494,14 @@ pub fn array_union(args: &[ArrayRef]) -> Result { (DataType::Null, _) => Ok(array2.clone()), (_, DataType::Null) => Ok(array1.clone()), (DataType::List(field_ref), DataType::List(_)) => { - check_datatypes("array_union", &[&array1, &array2])?; + check_datatypes("array_union", &[array1, array2])?; let list1 = array1.as_list::(); let list2 = array2.as_list::(); let result = union_generic_lists::(list1, list2, field_ref)?; Ok(Arc::new(result)) } (DataType::LargeList(field_ref), DataType::LargeList(_)) => { - check_datatypes("array_union", &[&array1, &array2])?; + check_datatypes("array_union", &[array1, array2])?; let list1 = array1.as_list::(); let list2 = array2.as_list::(); let result = union_generic_lists::(list1, list2, field_ref)?; @@ -1985,7 +1985,7 @@ pub fn array_intersect(args: &[ArrayRef]) -> Result { if first_array.value_type() != second_array.value_type() { return internal_err!("array_intersect is not implemented for '{first_array:?}' and '{second_array:?}'"); } - let dt = first_array.value_type().clone(); + let dt = first_array.value_type(); let mut offsets = vec![0]; let mut new_arrays = vec![]; diff --git a/datafusion/physical-plan/src/filter.rs b/datafusion/physical-plan/src/filter.rs index 822ddfdf3eb0..52bff880b127 100644 --- a/datafusion/physical-plan/src/filter.rs +++ b/datafusion/physical-plan/src/filter.rs @@ -201,7 +201,7 @@ impl ExecutionPlan for FilterExec { // tracking issue for making this configurable: // https://github.com/apache/arrow-datafusion/issues/8133 let selectivity = 0.2_f32; - let mut stats = input_stats.clone().into_inexact(); + let mut stats = input_stats.into_inexact(); if let Precision::Inexact(n) = stats.num_rows { stats.num_rows = Precision::Inexact((selectivity * n as f32) as usize); } diff --git a/datafusion/sql/src/select.rs b/datafusion/sql/src/select.rs index 31333affe0af..356c53605131 100644 --- a/datafusion/sql/src/select.rs +++ b/datafusion/sql/src/select.rs @@ -245,11 +245,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> { let on_expr = on_expr .into_iter() .map(|e| { - self.sql_expr_to_logical_expr( - e.clone(), - plan.schema(), - planner_context, - ) + self.sql_expr_to_logical_expr(e, plan.schema(), planner_context) }) .collect::>>()?;