qstommyshu commented on code in PR #15548: URL: https://github.com/apache/datafusion/pull/15548#discussion_r2025673999
########## datafusion/sql/tests/sql_integration.rs: ########## @@ -4786,30 +4972,47 @@ fn test_field_not_found_window_function() { "### ); - let qualified_sql = - "SELECT order_id, MAX(qty) OVER (PARTITION BY orders.order_id) from orders"; - let expected = "Projection: orders.order_id, max(orders.qty) PARTITION BY [orders.order_id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING\n WindowAggr: windowExpr=[[max(orders.qty) PARTITION BY [orders.order_id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING]]\n TableScan: orders"; - quick_test(qualified_sql, expected); + let sql = "SELECT order_id, MAX(qty) OVER (PARTITION BY orders.order_id) from orders"; + let plan = generate_logical_plan(sql); + assert_snapshot!( + plan, + @r#" +Projection: orders.order_id, max(orders.qty) PARTITION BY [orders.order_id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING + WindowAggr: windowExpr=[[max(orders.qty) PARTITION BY [orders.order_id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING]] + TableScan: orders +"# + ); } #[test] fn test_parse_escaped_string_literal_value() { - let sql = r"SELECT character_length('\r\n') AS len"; - let expected = "Projection: character_length(Utf8(\"\\r\\n\")) AS len\ - \n EmptyRelation"; - quick_test(sql, expected); - - let sql = r"SELECT character_length(E'\r\n') AS len"; - let expected = "Projection: character_length(Utf8(\"\r\n\")) AS len\ - \n EmptyRelation"; - quick_test(sql, expected); - + let sql = "SELECT character_length('\r\n') AS len"; Review Comment: fixed ########## datafusion/sql/tests/sql_integration.rs: ########## @@ -1766,41 +1766,57 @@ fn select_simple_aggregate_with_groupby_non_column_expression_and_its_column_sel #[test] fn select_simple_aggregate_nested_in_binary_expr_with_groupby() { - quick_test( - "SELECT state, MIN(age) < 10 FROM person GROUP BY state", - "Projection: person.state, min(person.age) < Int64(10)\ - \n Aggregate: groupBy=[[person.state]], aggr=[[min(person.age)]]\ - \n TableScan: person", + let plan = + generate_logical_plan("SELECT state, MIN(age) + 1 FROM person GROUP BY state"); + assert_snapshot!( + plan, + @r#" + Projection: person.state, min(person.age) + Int64(1) + Aggregate: groupBy=[[person.state]], aggr=[[min(person.age)]] + TableScan: person + "# ); } #[test] fn select_simple_aggregate_and_nested_groupby_column() { - quick_test( - "SELECT age + 1, MAX(first_name) FROM person GROUP BY age", - "Projection: person.age + Int64(1), max(person.first_name)\ - \n Aggregate: groupBy=[[person.age]], aggr=[[max(person.first_name)]]\ - \n TableScan: person", + let plan = + generate_logical_plan("SELECT MAX(first_name), age + 1 FROM person GROUP BY age"); + assert_snapshot!( + plan, + @r#" + Projection: max(person.first_name), person.age + Int64(1) + Aggregate: groupBy=[[person.age]], aggr=[[max(person.first_name)]] + TableScan: person + "# ); } #[test] fn select_aggregate_compounded_with_groupby_column() { - quick_test( - "SELECT age + MIN(salary) FROM person GROUP BY age", - "Projection: person.age + min(person.salary)\ - \n Aggregate: groupBy=[[person.age]], aggr=[[min(person.salary)]]\ - \n TableScan: person", + let plan = + generate_logical_plan("SELECT age + MIN(salary), age FROM person GROUP BY age"); Review Comment: fixed -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org