You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ja...@apache.org on 2023/06/07 11:16:34 UTC
[arrow-datafusion] branch main updated: minor: remove useless mut and borrow() (#6580)
This is an automated email from the ASF dual-hosted git repository.
jakevin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new afa64e0537 minor: remove useless mut and borrow() (#6580)
afa64e0537 is described below
commit afa64e05372161a25ebb57703e71a2878a622c30
Author: jakevin <ja...@gmail.com>
AuthorDate: Wed Jun 7 19:16:29 2023 +0800
minor: remove useless mut and borrow() (#6580)
---
datafusion/physical-expr/src/datetime_expressions.rs | 6 +-----
datafusion/physical-expr/src/window/aggregate.rs | 2 +-
datafusion/physical-expr/src/window/built_in.rs | 2 +-
3 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/datafusion/physical-expr/src/datetime_expressions.rs b/datafusion/physical-expr/src/datetime_expressions.rs
index ddfe34b618..32db0a7ee1 100644
--- a/datafusion/physical-expr/src/datetime_expressions.rs
+++ b/datafusion/physical-expr/src/datetime_expressions.rs
@@ -45,7 +45,6 @@ use datafusion_common::cast::{
use datafusion_common::{DataFusionError, Result};
use datafusion_common::{ScalarType, ScalarValue};
use datafusion_expr::ColumnarValue;
-use std::borrow::Borrow;
use std::sync::Arc;
/// given a function `op` that maps a `&str` to a Result of an arrow native type,
@@ -77,10 +76,7 @@ where
let array = as_generic_string_array::<T>(args[0])?;
// first map is the iterator, second is for the `Option<_>`
- array
- .iter()
- .map(|x| x.map(op.borrow()).transpose())
- .collect()
+ array.iter().map(|x| x.map(&op).transpose()).collect()
}
// given an function that maps a `&str` to a arrow native type,
diff --git a/datafusion/physical-expr/src/window/aggregate.rs b/datafusion/physical-expr/src/window/aggregate.rs
index d0173949dd..698754ab3b 100644
--- a/datafusion/physical-expr/src/window/aggregate.rs
+++ b/datafusion/physical-expr/src/window/aggregate.rs
@@ -115,7 +115,7 @@ impl WindowExpr for PlainAggregateWindowExpr {
window_agg_state.get_mut(partition_row).ok_or_else(|| {
DataFusionError::Execution("Cannot find state".to_string())
})?;
- let mut state = &mut window_state.state;
+ let state = &mut window_state.state;
if self.window_frame.start_bound.is_unbounded() {
state.window_frame_range.start =
state.window_frame_range.end.saturating_sub(1);
diff --git a/datafusion/physical-expr/src/window/built_in.rs b/datafusion/physical-expr/src/window/built_in.rs
index 59674257ed..c09e6db744 100644
--- a/datafusion/physical-expr/src/window/built_in.rs
+++ b/datafusion/physical-expr/src/window/built_in.rs
@@ -158,7 +158,7 @@ impl WindowExpr for BuiltInWindowExpr {
WindowFn::Builtin(evaluator) => evaluator,
_ => unreachable!(),
};
- let mut state = &mut window_state.state;
+ let state = &mut window_state.state;
let (values, order_bys) =
self.get_values_orderbys(&partition_batch_state.record_batch)?;