mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-30 10:47:22 +00:00
Support FILTER
in over clause (#1007)
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
This commit is contained in:
parent
e857a45201
commit
ce62fe6d27
15 changed files with 102 additions and 2 deletions
|
@ -875,6 +875,7 @@ fn parse_select_count_wildcard() {
|
|||
&Expr::Function(Function {
|
||||
name: ObjectName(vec![Ident::new("COUNT")]),
|
||||
args: vec![FunctionArg::Unnamed(FunctionArgExpr::Wildcard)],
|
||||
filter: None,
|
||||
over: None,
|
||||
distinct: false,
|
||||
special: false,
|
||||
|
@ -895,6 +896,7 @@ fn parse_select_count_distinct() {
|
|||
op: UnaryOperator::Plus,
|
||||
expr: Box::new(Expr::Identifier(Ident::new("x"))),
|
||||
}))],
|
||||
filter: None,
|
||||
over: None,
|
||||
distinct: true,
|
||||
special: false,
|
||||
|
@ -1862,6 +1864,7 @@ fn parse_select_having() {
|
|||
left: Box::new(Expr::Function(Function {
|
||||
name: ObjectName(vec![Ident::new("COUNT")]),
|
||||
args: vec![FunctionArg::Unnamed(FunctionArgExpr::Wildcard)],
|
||||
filter: None,
|
||||
over: None,
|
||||
distinct: false,
|
||||
special: false,
|
||||
|
@ -1887,6 +1890,7 @@ fn parse_select_qualify() {
|
|||
left: Box::new(Expr::Function(Function {
|
||||
name: ObjectName(vec![Ident::new("ROW_NUMBER")]),
|
||||
args: vec![],
|
||||
filter: None,
|
||||
over: Some(WindowType::WindowSpec(WindowSpec {
|
||||
partition_by: vec![Expr::Identifier(Ident::new("p"))],
|
||||
order_by: vec![OrderByExpr {
|
||||
|
@ -3342,6 +3346,7 @@ fn parse_scalar_function_in_projection() {
|
|||
args: vec![FunctionArg::Unnamed(FunctionArgExpr::Expr(
|
||||
Expr::Identifier(Ident::new("id"))
|
||||
))],
|
||||
filter: None,
|
||||
over: None,
|
||||
distinct: false,
|
||||
special: false,
|
||||
|
@ -3461,6 +3466,7 @@ fn parse_named_argument_function() {
|
|||
))),
|
||||
},
|
||||
],
|
||||
filter: None,
|
||||
over: None,
|
||||
distinct: false,
|
||||
special: false,
|
||||
|
@ -3492,6 +3498,7 @@ fn parse_window_functions() {
|
|||
&Expr::Function(Function {
|
||||
name: ObjectName(vec![Ident::new("row_number")]),
|
||||
args: vec![],
|
||||
filter: None,
|
||||
over: Some(WindowType::WindowSpec(WindowSpec {
|
||||
partition_by: vec![],
|
||||
order_by: vec![OrderByExpr {
|
||||
|
@ -3535,6 +3542,7 @@ fn test_parse_named_window() {
|
|||
quote_style: None,
|
||||
}),
|
||||
))],
|
||||
filter: None,
|
||||
over: Some(WindowType::NamedWindow(Ident {
|
||||
value: "window1".to_string(),
|
||||
quote_style: None,
|
||||
|
@ -3560,6 +3568,7 @@ fn test_parse_named_window() {
|
|||
quote_style: None,
|
||||
}),
|
||||
))],
|
||||
filter: None,
|
||||
over: Some(WindowType::NamedWindow(Ident {
|
||||
value: "window2".to_string(),
|
||||
quote_style: None,
|
||||
|
@ -4029,6 +4038,7 @@ fn parse_at_timezone() {
|
|||
quote_style: None,
|
||||
}]),
|
||||
args: vec![FunctionArg::Unnamed(FunctionArgExpr::Expr(zero.clone()))],
|
||||
filter: None,
|
||||
over: None,
|
||||
distinct: false,
|
||||
special: false,
|
||||
|
@ -4056,6 +4066,7 @@ fn parse_at_timezone() {
|
|||
quote_style: None,
|
||||
},],),
|
||||
args: vec![FunctionArg::Unnamed(FunctionArgExpr::Expr(zero))],
|
||||
filter: None,
|
||||
over: None,
|
||||
distinct: false,
|
||||
special: false,
|
||||
|
@ -4067,6 +4078,7 @@ fn parse_at_timezone() {
|
|||
Value::SingleQuotedString("%Y-%m-%dT%H".to_string()),
|
||||
),),),
|
||||
],
|
||||
filter: None,
|
||||
over: None,
|
||||
distinct: false,
|
||||
special: false,
|
||||
|
@ -4225,6 +4237,7 @@ fn parse_table_function() {
|
|||
args: vec![FunctionArg::Unnamed(FunctionArgExpr::Expr(Expr::Value(
|
||||
Value::SingleQuotedString("1".to_owned()),
|
||||
)))],
|
||||
filter: None,
|
||||
over: None,
|
||||
distinct: false,
|
||||
special: false,
|
||||
|
@ -4376,6 +4389,7 @@ fn parse_unnest_in_from_clause() {
|
|||
FunctionArg::Unnamed(FunctionArgExpr::Expr(Expr::Value(number("2")))),
|
||||
FunctionArg::Unnamed(FunctionArgExpr::Expr(Expr::Value(number("3")))),
|
||||
],
|
||||
filter: None,
|
||||
over: None,
|
||||
distinct: false,
|
||||
special: false,
|
||||
|
@ -4405,6 +4419,7 @@ fn parse_unnest_in_from_clause() {
|
|||
FunctionArg::Unnamed(FunctionArgExpr::Expr(Expr::Value(number("2")))),
|
||||
FunctionArg::Unnamed(FunctionArgExpr::Expr(Expr::Value(number("3")))),
|
||||
],
|
||||
filter: None,
|
||||
over: None,
|
||||
distinct: false,
|
||||
special: false,
|
||||
|
@ -4416,6 +4431,7 @@ fn parse_unnest_in_from_clause() {
|
|||
FunctionArg::Unnamed(FunctionArgExpr::Expr(Expr::Value(number("5")))),
|
||||
FunctionArg::Unnamed(FunctionArgExpr::Expr(Expr::Value(number("6")))),
|
||||
],
|
||||
filter: None,
|
||||
over: None,
|
||||
distinct: false,
|
||||
special: false,
|
||||
|
@ -6888,6 +6904,7 @@ fn parse_time_functions() {
|
|||
let select_localtime_func_call_ast = Function {
|
||||
name: ObjectName(vec![Ident::new(func_name)]),
|
||||
args: vec![],
|
||||
filter: None,
|
||||
over: None,
|
||||
distinct: false,
|
||||
special: false,
|
||||
|
@ -7374,6 +7391,7 @@ fn parse_pivot_table() {
|
|||
args: (vec![FunctionArg::Unnamed(FunctionArgExpr::Expr(
|
||||
Expr::CompoundIdentifier(vec![Ident::new("a"), Ident::new("amount"),])
|
||||
))]),
|
||||
filter: None,
|
||||
over: None,
|
||||
distinct: false,
|
||||
special: false,
|
||||
|
@ -7523,6 +7541,7 @@ fn parse_pivot_unpivot_table() {
|
|||
args: (vec![FunctionArg::Unnamed(FunctionArgExpr::Expr(
|
||||
Expr::Identifier(Ident::new("population"))
|
||||
))]),
|
||||
filter: None,
|
||||
over: None,
|
||||
distinct: false,
|
||||
special: false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue