Package com.alibaba.wasp.plan

Examples of com.alibaba.wasp.plan.Plan


    context.setTsr(reader);
    // create table
    String createTable = DruidParserTestUtil.SEED[0];
    context.setSql(createTable);
    druidParser.generatePlan(context);
    Plan plan = context.getPlan();
    if (plan instanceof CreateTablePlan) {
      CreateTablePlan createPlan = (CreateTablePlan) plan;
      table = createPlan.getTable();
      TableSchemaCacheReader.getService(conf).createTable(table);
      reader.addSchema(table.getTableName(), table);
View Full Code Here


  public void testInsert() throws IOException {
    String insert = "Insert into User(user_id,name) values(1,'binlijin');";
    // insert
    context.setSql(insert);
    druidParser.generatePlan(context);
    Plan plan = context.getPlan();
    if (plan instanceof InsertPlan) {
      InsertPlan insertPlan = (InsertPlan) plan;
      List<InsertAction> units = insertPlan.getActions();
      Assert.assertEquals(units.size(), 1);
      // EntityGroup execute insert
View Full Code Here

  public void testUpdate() throws IOException {
    String update = "UPDATE User SET name = 'Mike' WHERE user_id = 123;";
    // update
    context.setSql(update);
    druidParser.generatePlan(context);
    Plan plan = context.getPlan();
    if (plan instanceof UpdatePlan) {
      UpdatePlan updatePlan = (UpdatePlan) plan;
      List<UpdateAction> units = updatePlan.getActions();
      Assert.assertEquals(units.size(), 1);
      // EntityGroup execute update
View Full Code Here

  public void testDelete() throws IOException {
    String delete = "DELETE FROM User WHERE user_id = 123;";
    // delete
    context.setSql(delete);
    druidParser.generatePlan(context);
    Plan plan = context.getPlan();
    if (plan instanceof DeletePlan) {
      DeletePlan deletePlan = (DeletePlan) plan;
      List<DeleteAction> units = deletePlan.getActions();
      Assert.assertEquals(units.size(), 1);
      // EntityGroup execute delete
View Full Code Here

    String[] sqlList = { sql1, sql2, sql3 };
    for (String sql : sqlList) {
      context.setSql(sql);
      boolean result = DruidParserTestUtil.execute(context, druidDMLParser);
      Assert.assertTrue(result);
      Plan plan = context.getPlan();
      if (plan instanceof InsertPlan) {
      } else {
        Assert.assertTrue(false);
      }
    }
View Full Code Here

    String[] sqlList = { sql1, sql2 };
    for (String sql : sqlList) {
      context.setSql(sql);
      boolean result = DruidParserTestUtil.execute(context, druidDMLParser);
      Assert.assertTrue(result);
      Plan plan = context.getPlan();
      if (plan instanceof UpdatePlan) {
      } else {
        Assert.assertTrue(false);
      }
    }
View Full Code Here

    String[] sqlList = { sql1 };
    for (String sql : sqlList) {
      context.setSql(sql);
      boolean result = DruidParserTestUtil.execute(context, druidDMLParser);
      Assert.assertTrue(result);
      Plan plan = context.getPlan();
      if (plan instanceof DeletePlan) {
      } else {
        Assert.assertTrue(false);
      }
    }
View Full Code Here

    for (String sql : sqlList) {
      context.setSql(sql);
      boolean result = DruidParserTestUtil.execute(context, druidParser);
      Assert.assertTrue(result);
      try {
        Plan plan = context.getPlan();
        if (plan instanceof CreateTablePlan) {
          CreateTablePlan createTable = (CreateTablePlan) plan;
          FTable ftable = createTable.getTable();
          TableSchemaCacheReader.getService(conf).createTable(ftable);
          TableSchemaCacheReader.getInstance(conf).addSchema(
View Full Code Here

    for (String sql : sqlList) {
      context.setSql(sql);
      boolean result = DruidParserTestUtil.execute(context, druidParser);
      Assert.assertTrue(result);
      try {
        Plan plan = context.getPlan();
        if (plan instanceof CreateIndexPlan) {
          CreateIndexPlan createIndex = (CreateIndexPlan) plan;
          Index index = createIndex.getIndex();
          TableSchemaCacheReader.getService(conf).addIndex(
              index.getDependentTableName(), index);
View Full Code Here

    for (String sql : sqlList) {
      context.setSql(sql);
      boolean result = DruidParserTestUtil.execute(context, druidParser);
      Assert.assertTrue(result);
      try {
        Plan plan = context.getPlan();
        if (plan instanceof CreateIndexPlan) {
          CreateIndexPlan createIndex = (CreateIndexPlan) plan;
          Index index = createIndex.getIndex();
          TableSchemaCacheReader.getService(conf).addIndex(
              index.getDependentTableName(), index);
View Full Code Here

TOP

Related Classes of com.alibaba.wasp.plan.Plan

Copyright © 2018 www.massapicom. 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.