Package com.alibaba.druid.sql.dialect.odps.parser

Examples of com.alibaba.druid.sql.dialect.odps.parser.OdpsStatementParser.parseStatementList()


        String[] items = input.split("---------------------------");
        String sql = items[0].trim();
        String expect = items[1].trim();

        OdpsStatementParser parser = new OdpsStatementParser(sql);
        List<SQLStatement> statementList = parser.parseStatementList();
        SQLStatement stmt = statementList.get(0);

        Assert.assertEquals(1, statementList.size());

        SchemaStatVisitor visitor = new OdpsSchemaStatVisitor();
View Full Code Here


public class OdpsDoubleQuoteTest extends TestCase {
    public void test_0() throws Exception {
        String sql = "SELECT my_udtf(1,2,3) as (a, b, c) from employee t1 WHERE t1.name = \"aaa\";";

        OdpsStatementParser parser = new OdpsStatementParser(sql);
        List<SQLStatement> statementList = parser.parseStatementList();
        SQLStatement stmt = statementList.get(0);

        Assert.assertEquals(1, statementList.size());

        OdpsSchemaStatVisitor visitor = new OdpsSchemaStatVisitor();
View Full Code Here

public class OdpsShowPartitionsTest extends TestCase {

    public void test_0() throws Exception {
        String sql = "show partitions secods.xxx";
        OdpsStatementParser parser = new OdpsStatementParser(sql);
        SQLStatement stmt = parser.parseStatementList().get(0);
        parser.match(Token.EOF);
        String output = SQLUtils.toOdpsString(stmt);
        Assert.assertEquals("SHOW PARTITIONS secods.xxx", output);
    }
}
View Full Code Here

public class OdpsUDTFTest extends TestCase {
    public void test_0() throws Exception {
        String sql = "SELECT my_udtf(1,2,3) as (a, b, c) from employee t1 WHERE t1.name = 'aaa';";

        OdpsStatementParser parser = new OdpsStatementParser(sql);
        List<SQLStatement> statementList = parser.parseStatementList();
        SQLStatement stmt = statementList.get(0);

        Assert.assertEquals(1, statementList.size());

        OdpsSchemaStatVisitor visitor = new OdpsSchemaStatVisitor();
View Full Code Here

        String[] items = input.split("---------------------------");
        String sql = items[0].trim();
        String expect = items[1].trim();

        OdpsStatementParser parser = new OdpsStatementParser(sql);
        List<SQLStatement> statementList = parser.parseStatementList();
        SQLStatement stmt = statementList.get(0);

        Assert.assertEquals(1, statementList.size());

        SchemaStatVisitor visitor = new OdpsSchemaStatVisitor();
View Full Code Here

public class OdpsCreateTableTest_1 extends TestCase {

    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_likesale_detail_like LIKE sale_detail", output);
    }
}
View Full Code Here

        String[] items = input.split("---------------------------");
        String sql = items[0].trim();
        String expect = items[1].trim();

        OdpsStatementParser parser = new OdpsStatementParser(sql);
        List<SQLStatement> statementList = parser.parseStatementList();
        SQLStatement stmt = statementList.get(0);

        Assert.assertEquals(1, statementList.size());

        SchemaStatVisitor visitor = new OdpsSchemaStatVisitor();
View Full Code Here

        String[] items = input.split("---------------------------");
        String sql = items[0].trim();
        String expect = items[1].trim();

        OdpsStatementParser parser = new OdpsStatementParser(sql);
        List<SQLStatement> statementList = parser.parseStatementList();
        SQLStatement stmt = statementList.get(0);

        Assert.assertEquals(1, statementList.size());

        SchemaStatVisitor visitor = new OdpsSchemaStatVisitor();
View Full Code Here

                     + "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_detailsale_detail ("//
                + "\n\tshop_name STRING, "//
                + "\n\tcustomer_id STRING, "//
View Full Code Here

public class OdpsShowStatisticTest extends TestCase {

    public void test_0() throws Exception {
        String sql = "show statistic secods.xxx";
        OdpsStatementParser parser = new OdpsStatementParser(sql);
        SQLStatement stmt = parser.parseStatementList().get(0);
        parser.match(Token.EOF);
        String output = SQLUtils.toOdpsString(stmt);
        Assert.assertEquals("SHOW STATISTIC secods.xxx", output);
    }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.