mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-07-08 01:15:00 +00:00
feat: Group By All (#964)
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
This commit is contained in:
parent
2593dcfb79
commit
bb7b05e106
9 changed files with 85 additions and 36 deletions
|
@ -990,7 +990,7 @@ fn parse_copy_to() {
|
|||
from: vec![],
|
||||
lateral_views: vec![],
|
||||
selection: None,
|
||||
group_by: vec![],
|
||||
group_by: GroupByExpr::Expressions(vec![]),
|
||||
having: None,
|
||||
named_window: vec![],
|
||||
cluster_by: vec![],
|
||||
|
@ -2019,7 +2019,7 @@ fn parse_array_subquery_expr() {
|
|||
from: vec![],
|
||||
lateral_views: vec![],
|
||||
selection: None,
|
||||
group_by: vec![],
|
||||
group_by: GroupByExpr::Expressions(vec![]),
|
||||
cluster_by: vec![],
|
||||
distribute_by: vec![],
|
||||
sort_by: vec![],
|
||||
|
@ -2035,7 +2035,7 @@ fn parse_array_subquery_expr() {
|
|||
from: vec![],
|
||||
lateral_views: vec![],
|
||||
selection: None,
|
||||
group_by: vec![],
|
||||
group_by: GroupByExpr::Expressions(vec![]),
|
||||
cluster_by: vec![],
|
||||
distribute_by: vec![],
|
||||
sort_by: vec![],
|
||||
|
@ -3321,14 +3321,14 @@ fn parse_select_group_by_grouping_sets() {
|
|||
"SELECT brand, size, sum(sales) FROM items_sold GROUP BY size, GROUPING SETS ((brand), (size), ())"
|
||||
);
|
||||
assert_eq!(
|
||||
vec![
|
||||
GroupByExpr::Expressions(vec![
|
||||
Expr::Identifier(Ident::new("size")),
|
||||
Expr::GroupingSets(vec![
|
||||
vec![Expr::Identifier(Ident::new("brand"))],
|
||||
vec![Expr::Identifier(Ident::new("size"))],
|
||||
vec![],
|
||||
]),
|
||||
],
|
||||
]),
|
||||
select.group_by
|
||||
);
|
||||
}
|
||||
|
@ -3339,13 +3339,13 @@ fn parse_select_group_by_rollup() {
|
|||
"SELECT brand, size, sum(sales) FROM items_sold GROUP BY size, ROLLUP (brand, size)",
|
||||
);
|
||||
assert_eq!(
|
||||
vec![
|
||||
GroupByExpr::Expressions(vec![
|
||||
Expr::Identifier(Ident::new("size")),
|
||||
Expr::Rollup(vec![
|
||||
vec![Expr::Identifier(Ident::new("brand"))],
|
||||
vec![Expr::Identifier(Ident::new("size"))],
|
||||
]),
|
||||
],
|
||||
]),
|
||||
select.group_by
|
||||
);
|
||||
}
|
||||
|
@ -3356,13 +3356,13 @@ fn parse_select_group_by_cube() {
|
|||
"SELECT brand, size, sum(sales) FROM items_sold GROUP BY size, CUBE (brand, size)",
|
||||
);
|
||||
assert_eq!(
|
||||
vec![
|
||||
GroupByExpr::Expressions(vec![
|
||||
Expr::Identifier(Ident::new("size")),
|
||||
Expr::Cube(vec![
|
||||
vec![Expr::Identifier(Ident::new("brand"))],
|
||||
vec![Expr::Identifier(Ident::new("size"))],
|
||||
]),
|
||||
],
|
||||
]),
|
||||
select.group_by
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue