diff --git a/datafusion/core/tests/dataframe/mod.rs b/datafusion/core/tests/dataframe/mod.rs index 28c330775fc3..894877a98ea7 100644 --- a/datafusion/core/tests/dataframe/mod.rs +++ b/datafusion/core/tests/dataframe/mod.rs @@ -32,7 +32,9 @@ use arrow::datatypes::{ }; use arrow::error::ArrowError; use arrow::util::pretty::pretty_format_batches; -use datafusion_functions_aggregate::count::{count_all, count_all_column, count_all_window, count_all_window_column}; +use datafusion_functions_aggregate::count::{ + count_all, count_all_column, count_all_window, count_all_window_column, +}; use datafusion_functions_aggregate::expr_fn::{ array_agg, avg, count, count_distinct, max, median, min, sum, }; @@ -2711,14 +2713,14 @@ async fn test_count_wildcard_on_window() -> Result<()> { .table("t1") .await? .select(vec![count_all_window() - .order_by(vec![Sort::new(col("a"), false, true)]) - .window_frame(WindowFrame::new_bounds( - WindowFrameUnits::Range, - WindowFrameBound::Preceding(ScalarValue::UInt32(Some(6))), - WindowFrameBound::Following(ScalarValue::UInt32(Some(2))), - )) - .build() - .unwrap()])? + .order_by(vec![Sort::new(col("a"), false, true)]) + .window_frame(WindowFrame::new_bounds( + WindowFrameUnits::Range, + WindowFrameBound::Preceding(ScalarValue::UInt32(Some(6))), + WindowFrameBound::Following(ScalarValue::UInt32(Some(2))), + )) + .build() + .unwrap()])? .explain(false, false)? .collect() .await?; @@ -2803,8 +2805,10 @@ async fn test_count_wildcard_on_aggregate() -> Result<()> { async fn test_count_wildcard_shema_name() { assert_eq!(count_all().schema_name().to_string(), "count(*)"); assert_eq!(count_all_column(), col("count(*)")); - assert_eq!(count_all_window_column(), col("count(Int64(1)) ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING")); - + assert_eq!( + count_all_window_column(), + col("count(Int64(1)) ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING") + ); } #[tokio::test] diff --git a/datafusion/functions-aggregate/src/count.rs b/datafusion/functions-aggregate/src/count.rs index f79ce421cbe2..bd66dbb42771 100644 --- a/datafusion/functions-aggregate/src/count.rs +++ b/datafusion/functions-aggregate/src/count.rs @@ -48,7 +48,9 @@ use datafusion_common::{ downcast_value, internal_err, not_impl_err, Result, ScalarValue, }; use datafusion_expr::function::StateFieldsArgs; -use datafusion_expr::{col, Expr, ReversedUDAF, StatisticsArgs, TypeSignature, WindowFunctionDefinition}; +use datafusion_expr::{ + col, Expr, ReversedUDAF, StatisticsArgs, TypeSignature, WindowFunctionDefinition, +}; use datafusion_expr::{ function::AccumulatorArgs, utils::format_state_name, Accumulator, AggregateUDFImpl, Documentation, EmitTo, GroupsAccumulator, SetMonotonicity, Signature, Volatility, @@ -99,7 +101,9 @@ pub fn count_all_window_column() -> Expr { col(Expr::WindowFunction(WindowFunction::new( WindowFunctionDefinition::AggregateUDF(count_udaf()), vec![Expr::Literal(COUNT_STAR_EXPANSION)], - )).schema_name().to_string()) + )) + .schema_name() + .to_string()) } /// Create count wildcard of Expr::Column