Skip to content

Commit

Permalink
fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiayu Liu committed May 21, 2021
1 parent 5c4d92d commit 3ee87aa
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions datafusion/src/sql/planner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2703,14 +2703,20 @@ mod tests {
#[test]
fn empty_over() {
let sql = "SELECT order_id, MAX(order_id) OVER () from orders";
let expected = "Projection: #order_id, AGGREGATEFUNCTION(MAX)(#order_id)\n WindowAggr: windowExpr=[[AGGREGATEFUNCTION(MAX)(#order_id)]] partitionBy=[], orderBy=[]\n TableScan: orders projection=None";
let expected = "\
Projection: #order_id, #MAX(order_id)\
\n WindowAggr: windowExpr=[[MAX(#order_id)]] partitionBy=[], orderBy=[]\
\n TableScan: orders projection=None";
quick_test(sql, expected);
}

#[test]
fn empty_over_with_alias() {
let sql = "SELECT order_id, MAX(order_id) OVER () max_order_id from orders";
let expected = "Projection: #order_id, AGGREGATEFUNCTION(MAX)(#order_id) AS max_order_id\n WindowAggr: windowExpr=[[AGGREGATEFUNCTION(MAX)(#order_id)]] partitionBy=[], orderBy=[]\n TableScan: orders projection=None";
fn empty_over_plus() {
let sql = "SELECT order_id, MAX(qty * 1.1) OVER () from orders";
let expected = "\
Projection: #order_id, #MAX(qty Multiply Float64(1.1))\
\n WindowAggr: windowExpr=[[MAX(#qty Multiply Float64(1.1))]] partitionBy=[], orderBy=[]\
\n TableScan: orders projection=None";
quick_test(sql, expected);
}

Expand Down

0 comments on commit 3ee87aa

Please sign in to comment.