mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved odps sql formatter
This commit is contained in:
@@ -185,6 +185,11 @@ public class SQLExprParser extends SQLParser {
|
||||
}
|
||||
|
||||
public SQLExpr primary() {
|
||||
List<String> beforeComments = null;
|
||||
if (lexer.isKeepComments() && lexer.hasComment()) {
|
||||
beforeComments = lexer.readAndResetComments();
|
||||
}
|
||||
|
||||
SQLExpr sqlExpr = null;
|
||||
|
||||
final Token tok = lexer.token();
|
||||
@@ -555,7 +560,13 @@ public class SQLExprParser extends SQLParser {
|
||||
throw new ParserException("ERROR. token : " + tok + ", pos : " + lexer.pos());
|
||||
}
|
||||
|
||||
return primaryRest(sqlExpr);
|
||||
SQLExpr expr = primaryRest(sqlExpr);
|
||||
|
||||
if (beforeComments != null) {
|
||||
expr.addBeforeComment(beforeComments);
|
||||
}
|
||||
|
||||
return expr;
|
||||
}
|
||||
|
||||
protected SQLExpr parseAll() {
|
||||
@@ -1184,6 +1195,7 @@ public class SQLExprParser extends SQLParser {
|
||||
}
|
||||
|
||||
lexer.nextToken();
|
||||
|
||||
SQLExpr rightExp = relational();
|
||||
|
||||
expr = new SQLBinaryOpExpr(expr, SQLBinaryOperator.BooleanAnd, rightExp, getDbType());
|
||||
|
||||
Reference in New Issue
Block a user