Skip to content

Commit c36c04a

Browse files
author
Jiayu Liu
committed
add more tests
1 parent f5e64de commit c36c04a

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

datafusion/src/physical_plan/windows.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub fn create_window_expr(
5959
})),
6060
WindowFunction::BuiltInWindowFunction(fun) => {
6161
Err(DataFusionError::NotImplemented(format!(
62-
"window funtion with {:?} not implemented",
62+
"window function with {:?} not implemented",
6363
fun
6464
)))
6565
}

datafusion/src/sql/planner.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2720,6 +2720,16 @@ mod tests {
27202720
quick_test(sql, expected);
27212721
}
27222722

2723+
#[test]
2724+
fn empty_over_multiple() {
2725+
let sql = "SELECT order_id, MAX(qty) OVER (), CUMe_dist(qty), lag(qty) OVER () from orders";
2726+
let expected = "\
2727+
Projection: #order_id, #MAX(qty Multiply Float64(1.1))\
2728+
\n WindowAggr: windowExpr=[[MAX(#qty Multiply Float64(1.1))]] partitionBy=[], orderBy=[]\
2729+
\n TableScan: orders projection=None";
2730+
quick_test(sql, expected);
2731+
}
2732+
27232733
#[test]
27242734
fn over_partition_by_not_supported() {
27252735
let sql =
@@ -2731,6 +2741,16 @@ mod tests {
27312741
);
27322742
}
27332743

2744+
#[test]
2745+
fn over_order_by_not_supported() {
2746+
let sql = "SELECT order_id, MAX(delivered) OVER (order BY order_id) from orders";
2747+
let err = logical_plan(sql).expect_err("query should have failed");
2748+
assert_eq!(
2749+
"NotImplemented(\"Unsupported OVER clause (PARTITION BY order_id)\")",
2750+
format!("{:?}", err)
2751+
);
2752+
}
2753+
27342754
#[test]
27352755
fn only_union_all_supported() {
27362756
let sql = "SELECT order_id from orders EXCEPT SELECT order_id FROM orders";

0 commit comments

Comments
 (0)