Skip to content

Commit c2ab1cf

Browse files
authored
Fixes parser for GROUP ALL|PARTIAL (#112)
1 parent bd1de53 commit c2ab1cf

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

partiql-parser/src/lexer.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,8 @@ pub enum Token<'input> {
568568
Order,
569569
#[regex("(?i:Outer)")]
570570
Outer,
571+
#[regex("(?i:Partial)")]
572+
Partial,
571573
#[regex("(?i:Pivot)")]
572574
Pivot,
573575
#[regex("(?i:Preserve)")]
@@ -672,6 +674,7 @@ impl<'input> fmt::Display for Token<'input> {
672674
| Token::Or
673675
| Token::Order
674676
| Token::Outer
677+
| Token::Partial
675678
| Token::Pivot
676679
| Token::Preserve
677680
| Token::Right

partiql-parser/src/parse/partiql.lalrpop

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ WhereClause: Box<ast::Expr> = { "WHERE" <ExprQuery> }
247247
// GROUP BY //
248248
// ------------------------------------------------------------------------------ //
249249
GroupClause: Box<ast::GroupByExpr> = {
250-
"GROUP" "BY" <strategy: GroupStrategy> <keys:CommaSep<GroupKey>> <group_as_alias:GroupAlias?> => {
250+
"GROUP" <strategy: GroupStrategy> "BY" <keys:CommaSep<GroupKey>> <group_as_alias:GroupAlias?> => {
251251
Box::new(ast::GroupByExpr{
252252
strategy,
253253
key_list: ast::GroupKeyList{ keys },
@@ -257,10 +257,11 @@ GroupClause: Box<ast::GroupByExpr> = {
257257
}
258258
#[inline]
259259
GroupStrategy: ast::GroupingStrategy = {
260-
<all:"ALL"?> => {
261-
match all {
262-
Some(_) => ast::GroupingStrategy::GroupFull,
263-
None => ast::GroupingStrategy::GroupPartial,
260+
"ALL" => ast::GroupingStrategy::GroupFull,
261+
<partial:"PARTIAL"?> => {
262+
match partial {
263+
Some(_) => ast::GroupingStrategy::GroupPartial,
264+
None => ast::GroupingStrategy::GroupFull,
264265
}
265266
}
266267
}
@@ -880,6 +881,7 @@ extern {
880881
"OR" => lexer::Token::Or,
881882
"ORDER" => lexer::Token::Order,
882883
"OUTER" => lexer::Token::Outer,
884+
"PARTIAL" => lexer::Token::Partial,
883885
"PIVOT" => lexer::Token::Pivot,
884886
"PRESERVE" => lexer::Token::Preserve,
885887
"RIGHT" => lexer::Token::Right,

0 commit comments

Comments
 (0)