Package com.alibaba.wasp.plan

Examples of com.alibaba.wasp.plan.Plan


    String[] sqlList = { sql1, sql2 };
    for (String sql : sqlList) {
      context.setSql(sql);
      boolean result = DruidParserTestUtil.execute(context, druidParser);
      Assert.assertTrue(result);
      Plan plan = context.getPlan();
      if (plan instanceof ShowIndexesPlan) {
        ShowIndexesPlan showIndex = (ShowIndexesPlan) plan;
        String tableName = showIndex.getTableName();
        Assert.assertEquals("Photo", tableName);
      } else {
View Full Code Here


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

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

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

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

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

    for (String sql : seed) {
      context.setSql(sql);
      try {
        druidParser.parseSqlToStatement(context);
        druidParser.generatePlan(context);
        Plan plan = context.getPlan();
        if (plan instanceof CreateTablePlan) {
          CreateTablePlan createTable = (CreateTablePlan) plan;
          FTable ftable = createTable.getTable();
          fmetaServices.createTable(ftable);
          TableSchemaCacheReader reader = TableSchemaCacheReader
View Full Code Here

    table = new FTable[DruidParserTestUtil.SEED.length];
    for (int i = 0; i < DruidParserTestUtil.SEED.length; i++) {
      String createTable = DruidParserTestUtil.SEED[i];
      context.setSql(createTable);
      druidParser.generatePlan(context);
      Plan plan = context.getPlan();
      if (plan instanceof CreateTablePlan) {
        CreateTablePlan createPlan = (CreateTablePlan) plan;
        table[i] = createPlan.getTable();
        TableSchemaCacheReader.getService(conf).createTable(table[i]);
        reader.addSchema(table[i].getTableName(), table[i]);
      }
    }
    for (int i = 0; i < DruidParserTestUtil.INDEX_SEED.length; i++) {
      String createIndex = DruidParserTestUtil.INDEX_SEED[i];
      context.setSql(createIndex);
      druidParser.generatePlan(context);
      Plan plan = context.getPlan();
      if (plan instanceof CreateIndexPlan) {
        CreateIndexPlan createIndexPlan = (CreateIndexPlan) plan;
        Index index = createIndexPlan.getIndex();
        TableSchemaCacheReader.getService(conf).addIndex(
            index.getDependentTableName(), index);
View Full Code Here

      print("Execute " + insert[i]);
      try {
        // insert
        context.setSql(insert[i]);
        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
          OperationStatus status = eg.insert(units.get(0));
          if (status.getOperationStatusCode() != org.apache.hadoop.hbase.HConstants.OperationStatusCode.SUCCESS) {
            success = false;
          }
          Redo redo = eg.getLog();
          try {
            while (redo.peekLastUnCommitedTransaction() != null) {
              Thread.sleep(500);
            }
          } catch (Exception e) {
            success = false;
          }
        } else if (plan instanceof UpdatePlan) {
          UpdatePlan updatePlan = (UpdatePlan) plan;
          List<UpdateAction> units = updatePlan.getActions();
          Assert.assertEquals(units.size(), 1);
          // EntityGroup execute insert
          OperationStatus status = eg.update(units.get(0));
          if (status.getOperationStatusCode() != org.apache.hadoop.hbase.HConstants.OperationStatusCode.SUCCESS) {
            success = false;
          }
          Redo redo = eg.getLog();
          try {
            while (redo.peekLastUnCommitedTransaction() != null) {
              Thread.sleep(500);
            }
          } catch (Exception e) {
            success = false;
          }
        } else if (plan instanceof DeletePlan) {
          LOG.info(" DeletePlan is " + plan.toString());
          DeletePlan deletePlan = (DeletePlan) plan;
          List<DeleteAction> units = deletePlan.getActions();
          Assert.assertEquals(units.size(), 1);
          OperationStatus status = eg.delete(units.get(0));
          if (status.getOperationStatusCode() != org.apache.hadoop.hbase.HConstants.OperationStatusCode.SUCCESS) {
            success = false;
          }
          Redo redo = eg.getLog();
          try {
            while (redo.peekLastUnCommitedTransaction() != null) {
              Thread.sleep(500);
            }
          } catch (Exception e) {
            success = false;
          }
        } else {
          Assert.assertTrue(false);
        }

        context.setSql(select[i]);
        druidParser.generatePlan(context);
        plan = context.getPlan();
        LOG.info("Plan is " + plan.toString());
        if (plan instanceof LocalQueryPlan) {
          LocalQueryPlan localQueryPlan = (LocalQueryPlan) plan;
          GetAction getAction = localQueryPlan.getGetAction();
          if (getAction != null) {
            LOG.info("GetAction " + getAction.toString());
View Full Code Here

    for (String sql1 : sqlList) {
      context.setSql(sql1);
      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

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.