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
@@ -255,11 +255,12 @@ public class SQLUtils {
if (i > 0) {
visitor.println(";");
}
List<String> comments = stmt.getBeforeCommentsDirect();
if (comments != null){
for(String comment : comments) {
visitor.println(comment);
{
List<String> comments = stmt.getBeforeCommentsDirect();
if (comments != null){
for(String comment : comments) {
visitor.println(comment);
}
}
}
stmt.accept(visitor);
@@ -270,6 +271,17 @@ public class SQLUtils {
visitor.println();
visitor.print(";");
}
List<String> comments = stmt.getAfterCommentsDirect();
if (comments != null){
for (int j = 0; j < comments.size(); ++j) {
String comment = comments.get(j);
if (j != 0) {
visitor.println();
}
visitor.print(comment);
}
}
}
}