@Override
 public void plan(SchemaContext pc, ExecutionSequence es, BehaviorConfiguration config)
     throws PEException {
   if (savepoint == null)
     es.append(new TransactionExecutionStep(getDatabase(pc), getStorageGroup(pc), this));
   else unsupportedStatement();
 }
 @Override
 public void plan(SchemaContext pc, ExecutionSequence es, BehaviorConfiguration config)
     throws PEException {
   Database<?> ondb = null;
   for (TableKey tk : tables) {
     if (ondb == null) ondb = tk.getTable().getDatabase(pc);
     else if (!ondb.equals(tk.getTable().getDatabase(pc)))
       throw new SchemaException(Pass.PLANNER, "Unable to show table status across databases");
   }
   String origCommand = buildInitialShowStatusCommand();
   if (onGroup.isSingleSiteGroup()) {
     es.append(ProjectingExecutionStep.build(pc, ondb, onGroup, origCommand));
   } else {
     //		System.out.println(origCommand);
     TempGroupManager tgm = new TempGroupManager();
     TempTable t1 = buildFirstTempTable(pc, tgm.getGroup(true));
     if (!pc.hasCurrentDatabase() && !t1.hasDatabase(pc)) {
       // if no current database is set and the temp table has no database
       // we need to set one
       t1.setDatabase(pc, (PEDatabase) ondb, false);
     }
     SelectStatement firstSelect = buildFirstSelect(pc, t1);
     DistributionKeyTemplate dkt = buildKeyTemplate();
     for (int i = 0; i < firstSelect.getProjectionEdge().size(); i++)
       dkt.addColumn(firstSelect.getProjectionEdge().get(i), i);
     DistributionVector sourceVect = buildVector(pc);
     tgm.plan(pc);
     es.append(
         RedistributionExecutionStep.build(
             pc, ondb, onGroup, origCommand, sourceVect, t1, t1.getStorageGroup(pc), dkt, null));
     SelectStatement aggCommand = buildAggCommand(firstSelect);
     //		System.out.println(aggCommand.getSQL());
     es.append(
         ProjectingExecutionStep.build(
             pc, ondb, t1.getStorageGroup(pc), null, null, aggCommand, null));
   }
 }
 @Override
 public void plan(SchemaContext sc, ExecutionSequence es, BehaviorConfiguration config)
     throws PEException {
   MultiMap<PEDatabase, PETable> plain = new MultiMap<PEDatabase, PETable>();
   MultiMap<PEDatabase, PETable> fks = new MultiMap<PEDatabase, PETable>();
   MultiMap<PEDatabase, PEViewTable> views = new MultiMap<PEDatabase, PEViewTable>();
   AddStorageSiteStatement.sortTablesOnGroup(sc, onGroup, plain, fks, views);
   ListSet<PEDatabase> dbs = new ListSet<PEDatabase>();
   dbs.addAll(views.keySet());
   dbs.addAll(plain.keySet());
   dbs.addAll(fks.keySet());
   Pair<List<PEAbstractTable<?>>, Boolean> tableDeclOrder =
       AddStorageSiteStatement.buildTableDeclOrder(sc, plain, fks);
   MultiMap<RangeDistribution, PETable> tablesByRange = new MultiMap<RangeDistribution, PETable>();
   for (PEAbstractTable<?> abst : tableDeclOrder.getFirst()) {
     if (abst.isView()) continue;
     PETable pet = abst.asTable();
     if (pet.getDistributionVector(sc).isRange()) {
       RangeDistributionVector rdv = (RangeDistributionVector) pet.getDistributionVector(sc);
       tablesByRange.put(rdv.getRangeDistribution().getDistribution(sc), pet);
     }
   }
   List<AddStorageGenRangeInfo> rangeInfo = buildRangeInfo(sc, tablesByRange);
   /*
   for(AddStorageGenRangeInfo info : rangeInfo) {
   	info.display(System.out);
   }
   */
   es.append(
       new ComplexDDLExecutionStep(
           null,
           onGroup,
           null,
           Action.ALTER,
           new RebalanceCallback(onGroup, rangeInfo, tableDeclOrder.getSecond())));
 }