improved sql parser.

This commit is contained in:
wenshao
2017-07-23 16:44:43 +08:00
parent 82fe08109f
commit 6829a23bce
41 changed files with 1183 additions and 514 deletions
@@ -456,22 +456,23 @@ public class OdpsOutputVisitor extends SQLASTOutputVisitor implements OdpsASTVis
printSelectList(x.getSelectList());
if (x.getFrom() != null) {
SQLTableSource from = x.getFrom();
if (from != null) {
println();
print0(ucase ? "FROM " : "from ");
x.getFrom().accept(this);
from.accept(this);
}
if (x.getWhere() != null) {
SQLExpr where = x.getWhere();
if (where != null) {
println();
print0(ucase ? "WHERE " : "where ");
if (x.getWhere().hasBeforeComment() && isPrettyFormat()) {
if (where.hasBeforeComment() && isPrettyFormat()) {
printlnComments(x.getWhere().getBeforeCommentsDirect());
}
x.getWhere().setParent(x);
x.getWhere().accept(this);
if (x.getWhere().hasAfterComment() && isPrettyFormat()) {
where.accept(this);
if (where.hasAfterComment() && isPrettyFormat()) {
print(' ');
printlnComment(x.getWhere().getAfterCommentsDirect());
}