mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
bug fixed for odps sql formatter
This commit is contained in:
@@ -31,7 +31,10 @@ public class OdpsCreateTableTest extends TestCase {
|
||||
+ "\n\ttotal_price DOUBLE"//
|
||||
+ "\n)"//
|
||||
+ "\nCOMMENT 'xxxx'"//
|
||||
+ "\nPARTITIONED (sale_date STRING, region STRING)"//
|
||||
+ "\nPARTITIONED BY ("
|
||||
+ "\n\tsale_date STRING,"
|
||||
+ "\n\tregion STRING"
|
||||
+ "\n)"//
|
||||
+ "\nLIFECYCLE 5", output);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.alibaba.druid.bvt.sql.odps;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.SQLUtils;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class OdpsFormatCommentTest15 extends TestCase {
|
||||
public void test_column_comment() throws Exception {
|
||||
String sql = "create table t1 (f0 bigint) partitioned by (ds string, hh string);";
|
||||
Assert.assertEquals("CREATE TABLE t1t1 ("
|
||||
+ "\n\tf0 bigint"
|
||||
+ "\n)"
|
||||
+ "\nPARTITIONED BY ("
|
||||
+ "\n\tds string,"
|
||||
+ "\n\thh string"
|
||||
+ "\n)"
|
||||
+ "\n;", SQLUtils.formatOdps(sql));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.alibaba.druid.bvt.sql.odps;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.SQLUtils;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class OdpsFormatCommentTest16 extends TestCase {
|
||||
public void test_column_comment() throws Exception {
|
||||
String sql = "create table t1 (f0 bigint) partitioned by ("
|
||||
+ "ds string, -- c_1"
|
||||
+ "\nhh string -- c_2"
|
||||
+ "\n);";
|
||||
Assert.assertEquals("CREATE TABLE t1t1 ("
|
||||
+ "\n\tf0 bigint"
|
||||
+ "\n)"
|
||||
+ "\nPARTITIONED BY ("
|
||||
+ "\n\tds string, -- c_1"
|
||||
+ "\n\thh string -- c_2"
|
||||
+ "\n)"
|
||||
+ "\n;", SQLUtils.formatOdps(sql));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user