Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
jayzhan211 committed Feb 28, 2025
1 parent dff3590 commit 1a07b82
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
26 changes: 15 additions & 11 deletions datafusion/core/tests/dataframe/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -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?;
Expand Down Expand Up @@ -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]
Expand Down
8 changes: 6 additions & 2 deletions datafusion/functions-aggregate/src/count.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1a07b82

Please sign in to comment.