You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by al...@apache.org on 2022/11/17 11:26:07 UTC

[arrow-datafusion] branch master updated: Fix nightly clippy failures (#4246)

This is an automated email from the ASF dual-hosted git repository.

alamb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git


The following commit(s) were added to refs/heads/master by this push:
     new 929a17525 Fix nightly clippy failures (#4246)
929a17525 is described below

commit 929a17525917727aa99b26667e9c3a8c55bd67c3
Author: mvanschellebeeck <mv...@gmail.com>
AuthorDate: Thu Nov 17 06:26:02 2022 -0500

    Fix nightly clippy failures (#4246)
    
    * Make clippy happy
    
    * std clamp panics if lo < hi: revert
---
 datafusion/common/src/parsers.rs                         |  4 ++--
 datafusion/physical-expr/src/aggregate/count_distinct.rs |  3 +--
 datafusion/physical-expr/src/aggregate/tdigest.rs        |  3 ++-
 datafusion/physical-expr/src/expressions/binary.rs       | 14 +++++++-------
 datafusion/physical-expr/src/window/row_number.rs        |  2 +-
 5 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/datafusion/common/src/parsers.rs b/datafusion/common/src/parsers.rs
index 5d937a4ec..c6747007e 100644
--- a/datafusion/common/src/parsers.rs
+++ b/datafusion/common/src/parsers.rs
@@ -166,7 +166,7 @@ pub fn parse_interval(leading_field: &str, value: &str) -> Result<ScalarValue> {
         let (diff_month, diff_days, diff_nanos) =
             calculate_from_part(interval_period_str.unwrap(), unit)?;
 
-        result_month += diff_month as i64;
+        result_month += diff_month;
 
         if result_month > (i32::MAX as i64) {
             return Err(DataFusionError::NotImplemented(format!(
@@ -175,7 +175,7 @@ pub fn parse_interval(leading_field: &str, value: &str) -> Result<ScalarValue> {
             )));
         }
 
-        result_days += diff_days as i64;
+        result_days += diff_days;
 
         if result_days > (i32::MAX as i64) {
             return Err(DataFusionError::NotImplemented(format!(
diff --git a/datafusion/physical-expr/src/aggregate/count_distinct.rs b/datafusion/physical-expr/src/aggregate/count_distinct.rs
index 588b73909..943f7b632 100644
--- a/datafusion/physical-expr/src/aggregate/count_distinct.rs
+++ b/datafusion/physical-expr/src/aggregate/count_distinct.rs
@@ -182,8 +182,7 @@ impl Accumulator for DistinctCountAccumulator {
             .state_data_types
             .iter()
             .map(|state_data_type| {
-                let values = Box::new(Vec::new());
-                ScalarValue::new_list(Some(*values), state_data_type.clone())
+                ScalarValue::new_list(Some(Vec::new()), state_data_type.clone())
             })
             .collect::<Vec<_>>();
 
diff --git a/datafusion/physical-expr/src/aggregate/tdigest.rs b/datafusion/physical-expr/src/aggregate/tdigest.rs
index 6457f7025..dc9b5bec6 100644
--- a/datafusion/physical-expr/src/aggregate/tdigest.rs
+++ b/datafusion/physical-expr/src/aggregate/tdigest.rs
@@ -523,6 +523,7 @@ impl TDigest {
 
         let value = self.centroids[pos].mean()
             + ((rank - t) / self.centroids[pos].weight() - 0.5) * delta;
+
         Self::clamp(value, min, max)
     }
 
@@ -684,7 +685,7 @@ mod tests {
         let mut t = TDigest::new(10);
 
         for v in vals {
-            t = t.merge_unsorted_f64(vec![v as f64]);
+            t = t.merge_unsorted_f64(vec![v]);
         }
 
         assert_error_bounds!(t, quantile = 0.5, want = 1.0);
diff --git a/datafusion/physical-expr/src/expressions/binary.rs b/datafusion/physical-expr/src/expressions/binary.rs
index f670412ae..df33cd0c9 100644
--- a/datafusion/physical-expr/src/expressions/binary.rs
+++ b/datafusion/physical-expr/src/expressions/binary.rs
@@ -2439,8 +2439,8 @@ mod tests {
             &[
                 Some(value), // 1.23
                 None,
-                Some((value - 1) as i128), // 1.22
-                Some(value + 1),           // 1.24
+                Some(value - 1), // 1.22
+                Some(value + 1), // 1.24
             ],
             10,
             2,
@@ -2561,10 +2561,10 @@ mod tests {
         let value: i128 = 123;
         let decimal_array = Arc::new(create_decimal_array(
             &[
-                Some(value as i128), // 1.23
+                Some(value), // 1.23
                 None,
-                Some(value - 1),           // 1.22
-                Some((value + 1) as i128), // 1.24
+                Some(value - 1), // 1.22
+                Some(value + 1), // 1.24
             ],
             10,
             2,
@@ -2682,8 +2682,8 @@ mod tests {
             &[
                 Some(value), // 1.23
                 None,
-                Some((value - 1) as i128), // 1.22
-                Some(value + 1),           // 1.24
+                Some(value - 1), // 1.22
+                Some(value + 1), // 1.24
             ],
             10,
             2,
diff --git a/datafusion/physical-expr/src/window/row_number.rs b/datafusion/physical-expr/src/window/row_number.rs
index d8ff215d4..fb3bc7704 100644
--- a/datafusion/physical-expr/src/window/row_number.rs
+++ b/datafusion/physical-expr/src/window/row_number.rs
@@ -65,7 +65,7 @@ impl BuiltInWindowFunctionExpr for RowNumber {
         &self,
         _batch: &RecordBatch,
     ) -> Result<Box<dyn PartitionEvaluator>> {
-        Ok(Box::new(NumRowsEvaluator::default()))
+        Ok(Box::<NumRowsEvaluator>::default())
     }
 }