Skip to content

Commit d6cf206

Browse files
committed
Saving work
1 parent 306ea85 commit d6cf206

File tree

6 files changed

+10
-69
lines changed

6 files changed

+10
-69
lines changed

datafusion/core/tests/dataframe/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ use datafusion_expr::{
5656
placeholder, scalar_subquery, when, wildcard, Expr, ExprSchemable, WindowFrame,
5757
WindowFrameBound, WindowFrameUnits, WindowFunctionDefinition,
5858
};
59-
use datafusion_functions_aggregate::expr_fn::{count, sum};
59+
use datafusion_functions_aggregate::expr_fn::{count, max, sum};
6060

6161
#[tokio::test]
6262
async fn test_count_wildcard_on_sort() -> Result<()> {

datafusion/core/tests/fuzz_cases/window_fuzz.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ use datafusion_common_runtime::SpawnedTask;
3535
use datafusion_expr::type_coercion::aggregates::coerce_types;
3636
use datafusion_expr::type_coercion::functions::data_types_with_aggregate_udf;
3737
use datafusion_expr::{
38-
AggregateFunction, BuiltInWindowFunction, WindowFrame, WindowFrameBound,
38+
BuiltInWindowFunction, WindowFrame, WindowFrameBound,
3939
WindowFrameUnits, WindowFunctionDefinition,
4040
};
4141
use datafusion_functions_aggregate::count::count_udaf;
42+
use datafusion_functions_aggregate::min_max::{max_udaf, min_udaf};
4243
use datafusion_functions_aggregate::sum::sum_udaf;
4344
use datafusion_physical_expr::expressions::{cast, col, lit};
4445
use datafusion_physical_expr::{PhysicalExpr, PhysicalSortExpr};
@@ -360,14 +361,14 @@ fn get_random_function(
360361
window_fn_map.insert(
361362
"min",
362363
(
363-
WindowFunctionDefinition::AggregateFunction(AggregateFunction::Min),
364+
WindowFunctionDefinition::AggregateUDF(min_udaf()),
364365
vec![arg.clone()],
365366
),
366367
);
367368
window_fn_map.insert(
368369
"max",
369370
(
370-
WindowFunctionDefinition::AggregateFunction(AggregateFunction::Max),
371+
WindowFunctionDefinition::AggregateUDF(max_udaf()),
371372
vec![arg.clone()],
372373
),
373374
);

datafusion/expr/src/expr.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2255,18 +2255,6 @@ mod test {
22552255

22562256
#[test]
22572257
fn test_find_df_window_function() {
2258-
assert_eq!(
2259-
find_df_window_func("max"),
2260-
Some(WindowFunctionDefinition::AggregateFunction(
2261-
aggregate_function::AggregateFunction::Max
2262-
))
2263-
);
2264-
assert_eq!(
2265-
find_df_window_func("min"),
2266-
Some(WindowFunctionDefinition::AggregateFunction(
2267-
aggregate_function::AggregateFunction::Min
2268-
))
2269-
);
22702258
assert_eq!(
22712259
find_df_window_func("avg"),
22722260
Some(WindowFunctionDefinition::AggregateFunction(

datafusion/expr/src/expr_rewriter/order_by.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ mod test {
156156
use arrow::datatypes::{DataType, Field, Schema};
157157

158158
use crate::{
159-
avg, cast, col, lit, logical_plan::builder::LogicalTableSource, min, try_cast,
159+
avg, cast, col, lit, logical_plan::builder::LogicalTableSource, try_cast,
160160
LogicalPlanBuilder,
161161
};
162162

datafusion/expr/src/utils.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,23 +1268,23 @@ mod tests {
12681268
#[test]
12691269
fn test_group_window_expr_by_sort_keys_empty_window() -> Result<()> {
12701270
let max1 = Expr::WindowFunction(expr::WindowFunction::new(
1271-
WindowFunctionDefinition::AggregateFunction(AggregateFunction::Max),
1271+
WindowFunctionDefinition::AggregateUDF(max_udaf()),
12721272
vec![col("name")],
12731273
vec![],
12741274
vec![],
12751275
WindowFrame::new(None),
12761276
None,
12771277
));
12781278
let max2 = Expr::WindowFunction(expr::WindowFunction::new(
1279-
WindowFunctionDefinition::AggregateFunction(AggregateFunction::Max),
1279+
WindowFunctionDefinition::AggregateUDF(max_udaf()),
12801280
vec![col("name")],
12811281
vec![],
12821282
vec![],
12831283
WindowFrame::new(None),
12841284
None,
12851285
));
12861286
let min3 = Expr::WindowFunction(expr::WindowFunction::new(
1287-
WindowFunctionDefinition::AggregateFunction(AggregateFunction::Min),
1287+
WindowFunctionDefinition::AggregateUDF(min_udaf()),
12881288
vec![col("name")],
12891289
vec![],
12901290
vec![],
@@ -1371,7 +1371,7 @@ mod tests {
13711371
fn test_find_sort_exprs() -> Result<()> {
13721372
let exprs = &[
13731373
Expr::WindowFunction(expr::WindowFunction::new(
1374-
WindowFunctionDefinition::AggregateFunction(AggregateFunction::Max),
1374+
WindowFunctionDefinition::AggregateUDF(max_udaf()),
13751375
vec![col("name")],
13761376
vec![],
13771377
vec![

datafusion/physical-expr/src/aggregate/build_in.rs

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -222,54 +222,6 @@ mod tests {
222222
Ok(())
223223
}
224224

225-
#[test]
226-
fn test_min_max_expr() -> Result<()> {
227-
let funcs = vec![AggregateFunction::Min, AggregateFunction::Max];
228-
let data_types = vec![
229-
DataType::UInt32,
230-
DataType::Int32,
231-
DataType::Float32,
232-
DataType::Float64,
233-
DataType::Decimal128(10, 2),
234-
DataType::Utf8,
235-
];
236-
for fun in funcs {
237-
for data_type in &data_types {
238-
let input_schema =
239-
Schema::new(vec![Field::new("c1", data_type.clone(), true)]);
240-
let input_phy_exprs: Vec<Arc<dyn PhysicalExpr>> = vec![Arc::new(
241-
expressions::Column::new_with_schema("c1", &input_schema).unwrap(),
242-
)];
243-
let result_agg_phy_exprs = create_physical_agg_expr_for_test(
244-
&fun,
245-
false,
246-
&input_phy_exprs[0..1],
247-
&input_schema,
248-
"c1",
249-
)?;
250-
match fun {
251-
AggregateFunction::Min => {
252-
assert!(result_agg_phy_exprs.as_any().is::<Min>());
253-
assert_eq!("c1", result_agg_phy_exprs.name());
254-
assert_eq!(
255-
Field::new("c1", data_type.clone(), true),
256-
result_agg_phy_exprs.field().unwrap()
257-
);
258-
}
259-
AggregateFunction::Max => {
260-
assert!(result_agg_phy_exprs.as_any().is::<Max>());
261-
assert_eq!("c1", result_agg_phy_exprs.name());
262-
assert_eq!(
263-
Field::new("c1", data_type.clone(), true),
264-
result_agg_phy_exprs.field().unwrap()
265-
);
266-
}
267-
_ => {}
268-
};
269-
}
270-
}
271-
Ok(())
272-
}
273225

274226
#[test]
275227
fn test_bool_and_or_expr() -> Result<()> {

0 commit comments

Comments
 (0)