Skip to content

Commit

Permalink
Minor: clean up the code based on clippy (#8179)
Browse files Browse the repository at this point in the history
  • Loading branch information
Weijun-H authored Nov 15, 2023
1 parent 67d66fa commit 841a9a6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
8 changes: 4 additions & 4 deletions datafusion/physical-expr/src/array_expressions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1440,7 +1440,7 @@ fn union_generic_lists<OffsetSize: OffsetSizeTrait>(
r: &GenericListArray<OffsetSize>,
field: &FieldRef,
) -> Result<GenericListArray<OffsetSize>> {
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();
Expand Down Expand Up @@ -1494,14 +1494,14 @@ pub fn array_union(args: &[ArrayRef]) -> Result<ArrayRef> {
(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::<i32>();
let list2 = array2.as_list::<i32>();
let result = union_generic_lists::<i32>(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::<i64>();
let list2 = array2.as_list::<i64>();
let result = union_generic_lists::<i64>(list1, list2, field_ref)?;
Expand Down Expand Up @@ -1985,7 +1985,7 @@ pub fn array_intersect(args: &[ArrayRef]) -> Result<ArrayRef> {
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![];
Expand Down
2 changes: 1 addition & 1 deletion datafusion/physical-plan/src/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
6 changes: 1 addition & 5 deletions datafusion/sql/src/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Result<Vec<_>>>()?;

Expand Down

0 comments on commit 841a9a6

Please sign in to comment.