Skip to content

Commit

Permalink
Minor: rename binding + formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jcsherin committed Nov 14, 2024
1 parent 880b3f2 commit 30538fb
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions datafusion/proto/tests/cases/roundtrip_physical_plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,12 @@ fn roundtrip_nested_loop_join() -> Result<()> {
}

#[test]
fn roundtrip_built_in_window() -> Result<()> {
fn roundtrip_udwf() -> Result<()> {
let field_a = Field::new("a", DataType::Int64, false);
let field_b = Field::new("b", DataType::Int64, false);
let schema = Arc::new(Schema::new(vec![field_a, field_b]));

let built_in_window_expr = Arc::new(BuiltInWindowExpr::new(
let udwf_expr = Arc::new(BuiltInWindowExpr::new(
create_udwf_window_expr(
&row_number_udwf(),
&[],
Expand All @@ -296,7 +296,7 @@ fn roundtrip_built_in_window() -> Result<()> {
let input = Arc::new(EmptyExec::new(schema.clone()));

roundtrip_test(Arc::new(BoundedWindowAggExec::try_new(
vec![built_in_window_expr],
vec![udwf_expr],
input,
vec![col("a", &schema)?],
InputOrderMode::Sorted,
Expand All @@ -315,8 +315,14 @@ fn roundtrip_window() -> Result<()> {
);

let nth_value_window =
create_udwf_window_expr(&nth_value_udwf(), &[col("a", &schema)?, lit(2)], schema.as_ref(), "NTH_VALUE(a,2) PARTITION BY [b] ORDER BY [a ASC NULLS LAST] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW".to_string(), false)?;
let builtin_window_expr = Arc::new(BuiltInWindowExpr::new(
create_udwf_window_expr(
&nth_value_udwf(),
&[col("a", &schema)?,
lit(2)], schema.as_ref(),
"NTH_VALUE(a, 2) PARTITION BY [b] ORDER BY [a ASC NULLS LAST] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW".to_string(),
false,
)?;
let udwf_expr = Arc::new(BuiltInWindowExpr::new(
nth_value_window,
&[col("b", &schema)?],
&LexOrdering {
Expand Down Expand Up @@ -368,11 +374,7 @@ fn roundtrip_window() -> Result<()> {
let input = Arc::new(EmptyExec::new(schema.clone()));

roundtrip_test(Arc::new(WindowAggExec::try_new(
vec![
plain_aggr_window_expr,
sliding_aggr_window_expr,
builtin_window_expr,
],
vec![plain_aggr_window_expr, sliding_aggr_window_expr, udwf_expr],
input,
vec![col("b", &schema)?],
)?))
Expand Down

0 comments on commit 30538fb

Please sign in to comment.