}
protected SQLAggregateExpr parseAggregateExpr(String methodName) {
methodName = methodName.toUpperCase();
SQLAggregateExpr aggregateExpr;
if (lexer.token() == Token.ALL) {
aggregateExpr = new SQLAggregateExpr(methodName, SQLAggregateExpr.Option.ALL);
lexer.nextToken();
} else if (lexer.token() == Token.DISTINCT) {
aggregateExpr = new SQLAggregateExpr(methodName, SQLAggregateExpr.Option.DISTINCT);
lexer.nextToken();
} else {
aggregateExpr = new SQLAggregateExpr(methodName);
}
exprList(aggregateExpr.getArguments(), aggregateExpr);
parseAggregateExprRest(aggregateExpr);
accept(Token.RPAREN);
if (lexer.token() == Token.OVER) {
lexer.nextToken();
SQLOver over = new SQLOver();
accept(Token.LPAREN);
if (lexer.token() == Token.PARTITION || identifierEquals("PARTITION")) {
lexer.nextToken();
accept(Token.BY);
if (lexer.token() == (Token.LPAREN)) {
lexer.nextToken();
exprList(over.getPartitionBy());
accept(Token.RPAREN);
} else {
exprList(over.getPartitionBy());
}
}
over.setOrderBy(parseOrderBy());
accept(Token.RPAREN);
aggregateExpr.setOver(over);
}
return aggregateExpr;
}