Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
Signed-off-by: jayzhan211 <jayzhan211@gmail.com>
  • Loading branch information
jayzhan211 committed Dec 13, 2023
1 parent d704c83 commit aee4eff
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion datafusion/common/src/scalar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3272,14 +3272,14 @@ 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",
"arrow",
"data-fusion",
])));

let result = as_list_array(&array);
assert_eq!(result, &expected);
}

Expand Down
2 changes: 1 addition & 1 deletion datafusion/core/tests/sql/aggregates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ async fn csv_query_array_agg_distinct() -> Result<()> {

// 1 row
let scalar_vec = ScalarValue::convert_list_array_to_scalar_vec::<i32>(&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!(
Expand Down
3 changes: 2 additions & 1 deletion datafusion/physical-expr/src/aggregate/array_agg_distinct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<i32>(array)?;
let scalar_vec =
ScalarValue::convert_list_array_to_scalar_vec::<i32>(array)?;
for scalars in scalar_vec {
self.values.extend(scalars);
}
Expand Down
3 changes: 2 additions & 1 deletion datafusion/physical-expr/src/aggregate/count_distinct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<i32>(&states[0])?;
let scalar_vec =
ScalarValue::convert_list_array_to_scalar_vec::<i32>(&states[0])?;
for scalars in scalar_vec.into_iter() {
self.values.extend(scalars)
}
Expand Down

0 comments on commit aee4eff

Please sign in to comment.