diff --git a/datafusion/common/src/scalar.rs b/datafusion/common/src/scalar.rs index 4c08538843cb..97c0a6f7a30b 100644 --- a/datafusion/common/src/scalar.rs +++ b/datafusion/common/src/scalar.rs @@ -3272,7 +3272,6 @@ mod tests { ]; let array = ScalarValue::new_list(scalars.as_slice(), &DataType::Utf8); - let result = as_list_array(&array); let expected = array_into_list_array(Arc::new(StringArray::from(vec![ "rust", @@ -3280,6 +3279,7 @@ mod tests { "data-fusion", ]))); + let result = as_list_array(&array); assert_eq!(result, &expected); } diff --git a/datafusion/core/tests/sql/aggregates.rs b/datafusion/core/tests/sql/aggregates.rs index 68c58df41cb6..b30dffb50f2c 100644 --- a/datafusion/core/tests/sql/aggregates.rs +++ b/datafusion/core/tests/sql/aggregates.rs @@ -47,13 +47,13 @@ async fn csv_query_array_agg_distinct() -> Result<()> { // 1 row let scalar_vec = ScalarValue::convert_list_array_to_scalar_vec::(&column)?; + let mut scalars = scalar_vec.first().unwrap().to_owned(); // workaround lack of Ord of ScalarValue let cmp = |a: &ScalarValue, b: &ScalarValue| { a.partial_cmp(b).expect("Can compare ScalarValues") }; - let mut scalars = scalar_vec.first().unwrap().to_owned(); scalars.sort_by(cmp); assert_eq!( diff --git a/datafusion/physical-expr/src/aggregate/array_agg_distinct.rs b/datafusion/physical-expr/src/aggregate/array_agg_distinct.rs index f6eaee58f50e..39f769d0d4ff 100644 --- a/datafusion/physical-expr/src/aggregate/array_agg_distinct.rs +++ b/datafusion/physical-expr/src/aggregate/array_agg_distinct.rs @@ -139,7 +139,8 @@ impl Accumulator for DistinctArrayAggAccumulator { let array = &values[0]; match array.data_type() { DataType::List(_) => { - let scalar_vec = ScalarValue::convert_list_array_to_scalar_vec::(array)?; + let scalar_vec = + ScalarValue::convert_list_array_to_scalar_vec::(array)?; for scalars in scalar_vec { self.values.extend(scalars); } diff --git a/datafusion/physical-expr/src/aggregate/count_distinct.rs b/datafusion/physical-expr/src/aggregate/count_distinct.rs index 332e1b690b49..d2a18869ae99 100644 --- a/datafusion/physical-expr/src/aggregate/count_distinct.rs +++ b/datafusion/physical-expr/src/aggregate/count_distinct.rs @@ -167,7 +167,8 @@ impl Accumulator for DistinctCountAccumulator { return Ok(()); } assert_eq!(states.len(), 1, "array_agg states must be singleton!"); - let scalar_vec = ScalarValue::convert_list_array_to_scalar_vec::(&states[0])?; + let scalar_vec = + ScalarValue::convert_list_array_to_scalar_vec::(&states[0])?; for scalars in scalar_vec.into_iter() { self.values.extend(scalars) }