Skip to content

Commit

Permalink
Fixing imports
Browse files Browse the repository at this point in the history
  • Loading branch information
edmondop committed Dec 1, 2023
1 parent a0d4edc commit 5ec9334
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 102 deletions.
99 changes: 0 additions & 99 deletions datafusion/expr/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2254,103 +2254,4 @@ mod test {
assert_eq!(func_from_str, func_original);
}
}

#[test]
fn test_window_count_return_type() -> Result<()> {
let fun = find_df_window_func("count").unwrap();
let observed = fun.return_type(&[DataType::Utf8])?;
assert_eq!(DataType::Int64, observed);

let observed = fun.return_type(&[DataType::UInt64])?;
assert_eq!(DataType::Int64, observed);

Ok(())
}

#[test]
fn test_window_first_value_return_type() -> Result<()> {
let fun = find_df_window_func("first_value").unwrap();
let observed = fun.return_type(&[DataType::Utf8])?;
assert_eq!(DataType::Utf8, observed);

let observed = fun.return_type(&[DataType::UInt64])?;
assert_eq!(DataType::UInt64, observed);

Ok(())
}

#[test]
fn test_window_last_value_return_type() -> Result<()> {
let fun = find_df_window_func("last_value").unwrap();
let observed = fun.return_type(&[DataType::Utf8])?;
assert_eq!(DataType::Utf8, observed);

let observed = fun.return_type(&[DataType::Float64])?;
assert_eq!(DataType::Float64, observed);

Ok(())
}

#[test]
fn test_window_lead_return_type() -> Result<()> {
let fun = find_df_window_func("lead").unwrap();
let observed = fun.return_type(&[DataType::Utf8])?;
assert_eq!(DataType::Utf8, observed);

let observed = fun.return_type(&[DataType::Float64])?;
assert_eq!(DataType::Float64, observed);

Ok(())
}

#[test]
fn test_window_lag_return_type() -> Result<()> {
let fun = find_df_window_func("lag").unwrap();
let observed = fun.return_type(&[DataType::Utf8])?;
assert_eq!(DataType::Utf8, observed);

let observed = fun.return_type(&[DataType::Float64])?;
assert_eq!(DataType::Float64, observed);

Ok(())
}

#[test]
fn test_window_nth_value_return_type() -> Result<()> {
let fun = find_df_window_func("nth_value").unwrap();
let observed = fun.return_type(&[DataType::Utf8, DataType::UInt64])?;
assert_eq!(DataType::Utf8, observed);

let observed = fun.return_type(&[DataType::Float64, DataType::UInt64])?;
assert_eq!(DataType::Float64, observed);

Ok(())
}

#[test]
fn test_window_percent_rank_return_type() -> Result<()> {
let fun = find_df_window_func("percent_rank").unwrap();
let observed = fun.return_type(&[])?;
assert_eq!(DataType::Float64, observed);

Ok(())
}

#[test]
fn test_window_cume_dist_return_type() -> Result<()> {
let fun = find_df_window_func("cume_dist").unwrap();
let observed = fun.return_type(&[])?;
assert_eq!(DataType::Float64, observed);

Ok(())
}

#[test]
fn test_window_ntile_return_type() -> Result<()> {
let fun = find_df_window_func("ntile").unwrap();
let observed = fun.return_type(&[DataType::Int16])?;
assert_eq!(DataType::UInt64, observed);

Ok(())
}
}
6 changes: 3 additions & 3 deletions datafusion/proto/tests/cases/roundtrip_logical_plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1465,7 +1465,7 @@ fn roundtrip_window() {
// 1. without window_frame
let test_expr1 = Expr::WindowFunction(expr::WindowFunction::new(
WindowFunctionDefinition::BuiltInWindowFunction(
datafusion_expr::window_function::BuiltInWindowFunction::Rank,
datafusion_expr::BuiltInWindowFunction::Rank,
),
vec![],
vec![col("col1")],
Expand All @@ -1476,7 +1476,7 @@ fn roundtrip_window() {
// 2. with default window_frame
let test_expr2 = Expr::WindowFunction(expr::WindowFunction::new(
WindowFunctionDefinition::BuiltInWindowFunction(
datafusion_expr::window_function::BuiltInWindowFunction::Rank,
datafusion_expr::BuiltInWindowFunction::Rank,
),
vec![],
vec![col("col1")],
Expand All @@ -1493,7 +1493,7 @@ fn roundtrip_window() {

let test_expr3 = Expr::WindowFunction(expr::WindowFunction::new(
WindowFunctionDefinition::BuiltInWindowFunction(
datafusion_expr::window_function::BuiltInWindowFunction::Rank,
datafusion_expr::BuiltInWindowFunction::Rank,
),
vec![],
vec![col("col1")],
Expand Down

0 comments on commit 5ec9334

Please sign in to comment.