improved sql parser for odps

This commit is contained in:
wenshao
2014-11-18 23:49:13 +08:00
parent 06df60f95a
commit 0aa403bb4e
9 changed files with 271 additions and 11 deletions
@@ -0,0 +1,22 @@
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 OdpsSetLabelTest extends TestCase {
public void test_odps() throws Exception {
String sql = "SET LABEL S3 TO USER aliyun$abc@alibaba-inc.com";
OdpsStatementParser parser = new OdpsStatementParser(sql);
SQLStatement stmt = parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toOdpsString(stmt);
Assert.assertEquals("SET LABEL S3 TO USER aliyun$abc@alibaba-inc.com", output);
}
}
@@ -0,0 +1,22 @@
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 OdpsSetLabelTest2 extends TestCase {
public void test_odps() throws Exception {
String sql = "SET LABEL S3 TO TABLE xx(f1,f2)";
OdpsStatementParser parser = new OdpsStatementParser(sql);
SQLStatement stmt = parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toOdpsString(stmt);
Assert.assertEquals("SET LABEL S3 TO TABLE xx(f1, f2)", output);
}
}