use of com.alibaba.druid.sql.dialect.odps.parser.OdpsStatementParser in project druid by alibaba.
the class OdpsListTest method test_1.
public void test_1() throws Exception {
String sql = "list users";
OdpsStatementParser parser = new OdpsStatementParser(sql);
SQLStatement stmt = parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toOdpsString(stmt);
// System.out.println(output);
Assert.assertEquals("LIST users", output);
}
use of com.alibaba.druid.sql.dialect.odps.parser.OdpsStatementParser in project druid by alibaba.
the class OdpsCreateViewTest method test_create_column_comments.
public void test_create_column_comments() throws Exception {
String sql = "CREATE view if not exists sale_detail (f1 comment 'aaaa', f2 comment 'bbb') 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 IF NOT EXISTS sale_detail" + //
"\n(" + //
"\n\tf1 COMMENT 'aaaa', " + //
"\n\tf2 COMMENT 'bbb'" + //
"\n)" + //
"\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_if_not_exists.
public void test_create_if_not_exists() throws Exception {
String sql = "CREATE view if not exists 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 IF NOT EXISTS sale_detail" + //
"\nAS" + //
"\nSELECT *" + "\nFROM dual", output);
}
use of com.alibaba.druid.sql.dialect.odps.parser.OdpsStatementParser in project druid by alibaba.
the class OdpsDescTest method test_1.
public void test_1() throws Exception {
String sql = "desc role admin";
OdpsStatementParser parser = new OdpsStatementParser(sql);
SQLStatement stmt = parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toOdpsString(stmt);
System.out.println(output);
Assert.assertEquals("DESC ROLE admin", output);
}
Aggregations