Skip to content

Commit 3949190

Browse files
committed
Support WITH TOTALS at end of SELECT statement
WITH TOTALS can appear after GROUP BY or at the end of SELECT even without GROUP BY. Added parsing support after LIMIT clause. Test count: 5550 -> 5554 (+4 tests)
1 parent 06f016f commit 3949190

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

parser/parser.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,13 @@ func (p *Parser) parseSelect() *ast.SelectQuery {
354354
}
355355
}
356356

357+
// Parse WITH TOTALS (can appear after GROUP BY or at end of SELECT)
358+
if p.currentIs(token.WITH) && p.peekIs(token.TOTALS) {
359+
p.nextToken()
360+
p.nextToken()
361+
sel.WithTotals = true
362+
}
363+
357364
// Parse SETTINGS clause
358365
if p.currentIs(token.SETTINGS) {
359366
p.nextToken()

0 commit comments

Comments
 (0)