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:
@@ -112,7 +112,6 @@ public class OdpsLexer extends Lexer {
|
||||
} else {
|
||||
stringVal = subString(mark, bufPos + 1);
|
||||
token = Token.MULTI_LINE_COMMENT;
|
||||
hasComment = true;
|
||||
if (keepComments) {
|
||||
addComment(stringVal);
|
||||
}
|
||||
@@ -160,9 +159,8 @@ public class OdpsLexer extends Lexer {
|
||||
bufPos++;
|
||||
}
|
||||
|
||||
stringVal = subString(mark, bufPos);
|
||||
stringVal = subString(mark, ch != EOI ? bufPos : bufPos + 1);
|
||||
token = Token.LINE_COMMENT;
|
||||
hasComment = true;
|
||||
if (keepComments) {
|
||||
addComment(stringVal);
|
||||
}
|
||||
|
||||
@@ -450,6 +450,10 @@ public class OdpsOutputVisitor extends SQLASTOutputVisitor implements OdpsASTVis
|
||||
if (x.getWhere() != null) {
|
||||
println();
|
||||
print("WHERE ");
|
||||
if (x.getWhere().hasBeforeComment() && isPrettyFormat()) {
|
||||
printlnComments(x.getWhere().getBeforeCommentsDirect());
|
||||
}
|
||||
|
||||
x.getWhere().setParent(x);
|
||||
x.getWhere().accept(this);
|
||||
if (x.getWhere().hasAfterComment() && isPrettyFormat()) {
|
||||
|
||||
Reference in New Issue
Block a user