mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved sql parser for odps
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package com.alibaba.druid.bvt.sql.odps;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.SQLUtils;
|
||||
import com.alibaba.druid.sql.ast.SQLStatement;
|
||||
import com.alibaba.druid.sql.dialect.odps.parser.OdpsStatementParser;
|
||||
import com.alibaba.druid.sql.parser.Token;
|
||||
|
||||
public class OdpsCreateTableTest2 extends TestCase {
|
||||
|
||||
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_detailsale_detail"
|
||||
+ "\nSELECT *" //
|
||||
+ "\nFROM dual", output);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user