mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
Merge pull request #929 from wenshao/master
improved odps sql formatter
This commit is contained in:
@@ -350,9 +350,9 @@ public class OdpsOutputVisitor extends SQLASTOutputVisitor implements OdpsASTVis
|
||||
x.getRight().accept(this);
|
||||
|
||||
if (x.getCondition() != null) {
|
||||
incrementIndent();
|
||||
println();
|
||||
print("ON ");
|
||||
incrementIndent();
|
||||
x.getCondition().accept(this);
|
||||
decrementIndent();
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ public class OdpsFormatCommentTest20 extends TestCase {
|
||||
Assert.assertEquals("SELECT *"
|
||||
+ "\nFROM a"
|
||||
+ "\nFULL OUTER JOIN b"
|
||||
+ "\n\tON a.id = b.id", SQLUtils.formatOdps(sql));
|
||||
+ "\nON a.id = b.id", SQLUtils.formatOdps(sql));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -29,13 +29,14 @@ public class OdpsSelectTest_mapjoin extends TestCase {
|
||||
+ "\nb.customer_id,"
|
||||
+ "\nb.total_price"
|
||||
+ "\nfrom shop a join sale_detail b"
|
||||
+ "\non a.shop_name = b.shop_name;";
|
||||
+ "\non a.shop_name = b.shop_name and b.ds = '20150101';";
|
||||
Assert.assertEquals("SELECT /*+ mapjoin(a) */ a.shop_name"
|
||||
+ "\n\t, b.customer_id"
|
||||
+ "\n\t, b.total_price"
|
||||
+ "\nFROM shop a"
|
||||
+ "\nJOIN sale_detail b"
|
||||
+ "\n\tON a.shop_name = b.shop_name;", SQLUtils.formatOdps(sql));
|
||||
+ "\nON a.shop_name = b.shop_name"
|
||||
+ "\n\tAND b.ds = '20150101';", SQLUtils.formatOdps(sql));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user