mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-31 11:17:23 +00:00
Accept WINDOW clause after QUALIFY when parsing (#1248)
Co-authored-by: ifeanyi <ifeanyi@validio.io>
This commit is contained in:
parent
71a7262e38
commit
8e64b73e9d
8 changed files with 86 additions and 14 deletions
|
@ -401,6 +401,7 @@ fn parse_update_set_from() {
|
|||
having: None,
|
||||
named_window: vec![],
|
||||
qualify: None,
|
||||
window_before_qualify: false,
|
||||
value_table_mode: None,
|
||||
connect_by: None,
|
||||
}))),
|
||||
|
@ -4546,12 +4547,34 @@ fn test_parse_named_window() {
|
|||
),
|
||||
],
|
||||
qualify: None,
|
||||
window_before_qualify: true,
|
||||
value_table_mode: None,
|
||||
connect_by: None,
|
||||
};
|
||||
assert_eq!(actual_select_only, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_window_and_qualify_clause() {
|
||||
let sql = "SELECT \
|
||||
MIN(c12) OVER window1 AS min1 \
|
||||
FROM aggregate_test_100 \
|
||||
QUALIFY ROW_NUMBER() OVER my_window \
|
||||
WINDOW window1 AS (ORDER BY C12), \
|
||||
window2 AS (PARTITION BY C11) \
|
||||
ORDER BY C3";
|
||||
verified_only_select(sql);
|
||||
|
||||
let sql = "SELECT \
|
||||
MIN(c12) OVER window1 AS min1 \
|
||||
FROM aggregate_test_100 \
|
||||
WINDOW window1 AS (ORDER BY C12), \
|
||||
window2 AS (PARTITION BY C11) \
|
||||
QUALIFY ROW_NUMBER() OVER my_window \
|
||||
ORDER BY C3";
|
||||
verified_only_select(sql);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_window_clause_named_window() {
|
||||
let sql = "SELECT * FROM mytable WINDOW window1 AS window2";
|
||||
|
@ -4918,6 +4941,7 @@ fn parse_interval_and_or_xor() {
|
|||
having: None,
|
||||
named_window: vec![],
|
||||
qualify: None,
|
||||
window_before_qualify: false,
|
||||
value_table_mode: None,
|
||||
connect_by: None,
|
||||
}))),
|
||||
|
@ -6872,6 +6896,7 @@ fn lateral_function() {
|
|||
having: None,
|
||||
named_window: vec![],
|
||||
qualify: None,
|
||||
window_before_qualify: false,
|
||||
value_table_mode: None,
|
||||
connect_by: None,
|
||||
};
|
||||
|
@ -7516,6 +7541,7 @@ fn parse_merge() {
|
|||
sort_by: vec![],
|
||||
having: None,
|
||||
named_window: vec![],
|
||||
window_before_qualify: false,
|
||||
qualify: None,
|
||||
value_table_mode: None,
|
||||
connect_by: None,
|
||||
|
@ -8958,6 +8984,7 @@ fn parse_unload() {
|
|||
sort_by: vec![],
|
||||
having: None,
|
||||
named_window: vec![],
|
||||
window_before_qualify: false,
|
||||
qualify: None,
|
||||
value_table_mode: None,
|
||||
connect_by: None,
|
||||
|
@ -9112,6 +9139,7 @@ fn parse_connect_by() {
|
|||
having: None,
|
||||
named_window: vec![],
|
||||
qualify: None,
|
||||
window_before_qualify: false,
|
||||
value_table_mode: None,
|
||||
connect_by: Some(ConnectBy {
|
||||
condition: Expr::BinaryOp {
|
||||
|
@ -9199,6 +9227,7 @@ fn parse_connect_by() {
|
|||
having: None,
|
||||
named_window: vec![],
|
||||
qualify: None,
|
||||
window_before_qualify: false,
|
||||
value_table_mode: None,
|
||||
connect_by: Some(ConnectBy {
|
||||
condition: Expr::BinaryOp {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue