use of com.alibaba.druid.sql.dialect.odps.parser.OdpsStatementParser in project druid by alibaba.
the class OdpsCreateTableTest method test_0.
public void test_0() throws Exception {
String sql = //
"CREATE TABLE IF NOT EXISTS sale_detail(" + //
" shop_name STRING," + //
" customer_id STRING," + //
" total_price DOUBLE" + //
")" + //
"comment 'xxxx'" + //
"PARTITIONED BY (sale_date STRING,region STRING)" + //
"LIFECYCLE 5" + ";";
OdpsStatementParser parser = new OdpsStatementParser(sql);
SQLStatement stmt = parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toOdpsString(stmt);
Assert.assertEquals(//
"CREATE TABLE IF NOT EXISTS sale_detail (" + //
"\n\tshop_name STRING," + //
"\n\tcustomer_id STRING," + //
"\n\ttotal_price DOUBLE" + //
"\n)" + //
"\nCOMMENT 'xxxx'" + "\nPARTITIONED BY (" + "\n\tsale_date STRING," + "\n\tregion STRING" + //
"\n)" + "\nLIFECYCLE 5", output);
}
use of com.alibaba.druid.sql.dialect.odps.parser.OdpsStatementParser in project druid by alibaba.
the class OdpsCreateTableTest2 method test_0.
public void test_0() throws Exception {
String sql = "CREATE TABLE sale_detail as select * from dual;";
OdpsStatementParser parser = new OdpsStatementParser(sql);
SQLStatement stmt = parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toOdpsString(stmt);
Assert.assertEquals("CREATE TABLE sale_detail" + "\nAS" + //
"\nSELECT *" + "\nFROM dual", output);
}
use of com.alibaba.druid.sql.dialect.odps.parser.OdpsStatementParser in project druid by alibaba.
the class OdpsCreateTableTest_1 method test_0.
public void test_0() throws Exception {
String sql = "CREATE TABLE sale_detail_like LIKE sale_detail;";
OdpsStatementParser parser = new OdpsStatementParser(sql);
SQLStatement stmt = parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toOdpsString(stmt);
Assert.assertEquals("CREATE TABLE sale_detail_like LIKE sale_detail", output);
}
use of com.alibaba.druid.sql.dialect.odps.parser.OdpsStatementParser in project druid by alibaba.
the class OdpsCreateViewTest method test_create.
public void test_create() throws Exception {
String sql = "CREATE view sale_detail as select * from dual;";
OdpsStatementParser parser = new OdpsStatementParser(sql);
SQLStatement stmt = parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toOdpsString(stmt);
Assert.assertEquals(//
"CREATE VIEW sale_detail" + //
"\nAS" + //
"\nSELECT *" + "\nFROM dual", output);
}
use of com.alibaba.druid.sql.dialect.odps.parser.OdpsStatementParser in project druid by alibaba.
the class OdpsCreateViewTest method test_create_or_replace.
public void test_create_or_replace() throws Exception {
String sql = "CREATE or replace view sale_detail as select * from dual;";
OdpsStatementParser parser = new OdpsStatementParser(sql);
SQLStatement stmt = parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toOdpsString(stmt);
Assert.assertEquals(//
"CREATE OR REPLACE VIEW sale_detail" + //
"\nAS" + //
"\nSELECT *" + "\nFROM dual", output);
}
Aggregations