improved odps sql formatter

This commit is contained in:
shaojin.wensj
2015-07-20 04:41:57 +08:00
parent 8f51368245
commit a5811a4f3e
38 changed files with 415 additions and 103 deletions
@@ -162,7 +162,7 @@ public class SQLSelectParser extends SQLParser {
SQLSelectQueryBlock queryBlock = new SQLSelectQueryBlock();
if (lexer.hasComment() && lexer.isKeepComments()) {
queryBlock.addBeforeComment(lexer.commentVal());
queryBlock.addBeforeComment(lexer.readAndResetCommentValue());
}
accept(Token.SELECT);
@@ -243,7 +243,7 @@ public class SQLSelectParser extends SQLParser {
if (lexer.hasComment() && lexer.isKeepComments() //
&& lexer.token() != Token.INSERT // odps multi-insert
) {
where.addAfterComment(lexer.commentVal());
where.addAfterComment(lexer.readAndResetCommentValue());
}
queryBlock.setWhere(where);
@@ -341,7 +341,7 @@ public class SQLSelectParser extends SQLParser {
SQLTableSource tableSrc = parseTableSourceRest(tableReference);
if (lexer.hasComment() && lexer.isKeepComments()) {
tableSrc.addAfterComment(lexer.commentVal());
tableSrc.addAfterComment(lexer.readAndResetComments());
}
return tableSrc;