improved odps sql parser.

This commit is contained in:
wenshao
2016-11-18 21:26:14 +08:00
parent 2dc90c572b
commit a2936b08af
4 changed files with 136 additions and 1 deletions
@@ -770,6 +770,12 @@ public class SQLExprParser extends SQLParser {
}
if (expr instanceof SQLName || expr instanceof SQLDefaultExpr || expr instanceof SQLCharExpr) {
boolean distinct = false;
if (lexer.token() == Token.DISTINCT) {
lexer.nextToken();
distinct = true;
}
String methodName;
SQLMethodInvokeExpr methodInvokeExpr;
@@ -784,6 +790,9 @@ public class SQLExprParser extends SQLParser {
if (isAggreateFunction(methodName)) {
SQLAggregateExpr aggregateExpr = parseAggregateExpr(methodName);
if (distinct) {
aggregateExpr.setOption(SQLAggregateOption.DISTINCT);
}
return aggregateExpr;
}