MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / parseRollup

Method parseRollup

pkg/sql/parser/grouping.go:68–79  ·  view source on GitHub ↗

parseRollup parses ROLLUP(col1, col2, ...) in GROUP BY clause ROLLUP generates hierarchical grouping sets from right to left Example: ROLLUP(a, b, c) generates: (a, b, c), (a, b), (a), ()

()

Source from the content-addressed store, hash-verified

66// ROLLUP generates hierarchical grouping sets from right to left
67// Example: ROLLUP(a, b, c) generates: (a, b, c), (a, b), (a), ()
68func (p *Parser) parseRollup() (*ast.RollupExpression, error) {
69 p.advance() // Consume ROLLUP
70
71 expressions, err := p.parseGroupingExpressionList("ROLLUP")
72 if err != nil {
73 return nil, err
74 }
75
76 return &ast.RollupExpression{
77 Expressions: expressions,
78 }, nil
79}
80
81// parseCube parses CUBE(col1, col2, ...) in GROUP BY clause
82// CUBE generates all possible combinations of grouping sets

Callers 1

parseGroupByClauseMethod · 0.95

Calls 2

advanceMethod · 0.95

Tested by

no test coverage detected