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), ()
()
| 66 | // ROLLUP generates hierarchical grouping sets from right to left |
| 67 | // Example: ROLLUP(a, b, c) generates: (a, b, c), (a, b), (a), () |
| 68 | func (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 |
no test coverage detected