Пример #1
0
 @Override
 public ExecutionStep buildSingleKeyStep(
     SchemaContext pc, TableKey tk, DistributionKey kv, DMLStatement sql) throws PEException {
   return ProjectingExecutionStep.build(
       pc,
       getDatabase(pc),
       getStorageGroup(pc),
       tk.getAbstractTable().getDistributionVector(pc),
       kv,
       sql,
       distKeyExplain);
 }
 @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));
   }
 }
Пример #3
0
 @Override
 protected ExecutionPlan buildExplain(SchemaContext sc, BehaviorConfiguration config)
     throws PEException {
   boolean noplan = explain.hasSetting(ExplainOption.NOPLAN);
   if (noplan) {
     normalize(sc);
     ProjectingExecutionStep ses =
         ProjectingExecutionStep.build(
             sc,
             getDatabase(sc),
             getStorageGroups(sc).get(0),
             EngineConstant.BROADEST_DISTRIBUTION_VECTOR.getValue(this, sc),
             null,
             this,
             DMLExplainReason.EXPLAIN_NOPLAN.makeRecord());
     ExecutionPlan expep = new ExecutionPlan(null, sc.getValueManager(), StatementType.EXPLAIN);
     expep.getSequence().append(ses);
     return expep;
   }
   // we would check for alternate configuration here, but not quite yet
   return super.buildExplain(sc, config);
 }