コード例 #1
0
ファイル: Query.java プロジェクト: hyunsik/incubator-tajo
    private void finalizeQuery(Query query, QueryCompletedEvent event) {
      MasterPlan masterPlan = query.getPlan();

      ExecutionBlock terminal = query.getPlan().getTerminalBlock();
      DataChannel finalChannel =
          masterPlan.getChannel(event.getExecutionBlockId(), terminal.getId());
      Path finalOutputDir = commitOutputData(query);

      QueryHookExecutor hookExecutor = new QueryHookExecutor(query.context.getQueryMasterContext());
      try {
        hookExecutor.execute(
            query.context.getQueryContext(), query, event.getExecutionBlockId(), finalOutputDir);
      } catch (Exception e) {
        query.eventHandler.handle(
            new QueryDiagnosticsUpdateEvent(query.id, ExceptionUtils.getStackTrace(e)));
      }
    }
コード例 #2
0
  @Override
  public void init() throws IOException {
    QueryContext queryContext = new QueryContext(masterContext.getConf());
    currentRow = 0;

    MasterPlan masterPlan = new MasterPlan(queryId, queryContext, logicalPlan);
    GlobalPlanner globalPlanner =
        new GlobalPlanner(masterContext.getConf(), masterContext.getCatalog());
    try {
      globalPlanner.build(queryContext, masterPlan);
    } catch (PlanningException e) {
      throw new RuntimeException(e);
    }

    ExecutionBlockCursor cursor = new ExecutionBlockCursor(masterPlan);
    ExecutionBlock leafBlock = null;
    for (ExecutionBlock block : cursor) {
      if (masterPlan.isLeaf(block)) {
        leafBlock = block;
        break;
      }
    }

    if (leafBlock == null) {
      throw new InvalidQueryException("Global planner could not find any leaf block.");
    }

    taskContext =
        new TaskAttemptContext(
            queryContext, null, new TaskAttemptId(new TaskId(leafBlock.getId(), 0), 0), null, null);
    physicalExec =
        new SimplePhysicalPlannerImpl(masterContext.getConf())
            .createPlan(taskContext, leafBlock.getPlan());

    tableDesc =
        new TableDesc(
            "table_" + System.currentTimeMillis(),
            physicalExec.getSchema(),
            new TableMeta("SYSTEM", new KeyValueSet()),
            null);
    outSchema = physicalExec.getSchema();
    encoder = RowStoreUtil.createEncoder(getLogicalSchema());

    physicalExec.init();
  }
コード例 #3
0
  @Override
  public void start() {
    LOG.info("Start TaskScheduler");
    maximumRequestContainer =
        tajoConf.getInt(REQUEST_MAX_NUM, stage.getContext().getWorkerMap().size() * 2);

    if (isLeaf) {
      candidateWorkers.addAll(getWorkerIds(getLeafTaskHosts()));
    } else {
      // find assigned hosts for Non-Leaf locality in children executionBlock
      List<ExecutionBlock> executionBlockList = stage.getMasterPlan().getChilds(stage.getBlock());
      for (ExecutionBlock executionBlock : executionBlockList) {
        Stage childStage = stage.getContext().getStage(executionBlock.getId());
        candidateWorkers.addAll(childStage.getAssignedWorkerMap().keySet());
      }
    }

    this.schedulingThread.start();
    super.start();
  }