当前位置: 首页>>代码示例>>Java>>正文


Java QueryUnitRequest.getFetches方法代码示例

本文整理汇总了Java中org.apache.tajo.engine.query.QueryUnitRequest.getFetches方法的典型用法代码示例。如果您正苦于以下问题:Java QueryUnitRequest.getFetches方法的具体用法?Java QueryUnitRequest.getFetches怎么用?Java QueryUnitRequest.getFetches使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.tajo.engine.query.QueryUnitRequest的用法示例。


在下文中一共展示了QueryUnitRequest.getFetches方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Task

import org.apache.tajo.engine.query.QueryUnitRequest; //导入方法依赖的package包/类
public Task(QueryUnitAttemptId taskId,
            final TaskRunner.TaskRunnerContext worker,
            final QueryMasterProtocolService.Interface masterProxy,
            final QueryUnitRequest request) throws IOException {
  this.request = request;
  this.taskId = taskId;

  this.systemConf = worker.getConf();
  this.queryContext = request.getQueryContext();
  this.taskRunnerContext = worker;
  this.masterProxy = masterProxy;
  this.localFS = worker.getLocalFS();
  this.lDirAllocator = worker.getLocalDirAllocator();
  this.taskDir = StorageUtil.concatPath(taskRunnerContext.getBaseDir(),
      taskId.getQueryUnitId().getId() + "_" + taskId.getId());

  this.context = new TaskAttemptContext(systemConf, taskId,
      request.getFragments().toArray(new FragmentProto[request.getFragments().size()]), taskDir);
  this.context.setDataChannel(request.getDataChannel());
  this.context.setEnforcer(request.getEnforcer());
  this.inputStats = new TableStats();

  this.reporter = new Reporter(taskId, masterProxy);
  this.reporter.startCommunicationThread();

  plan = CoreGsonHelper.fromJson(request.getSerializedData(), LogicalNode.class);
  LogicalNode [] scanNode = PlannerUtil.findAllNodes(plan, NodeType.SCAN);
  for (LogicalNode node : scanNode) {
    ScanNode scan = (ScanNode)node;
    descs.put(scan.getCanonicalName(), scan.getTableDesc());
  }

  interQuery = request.getProto().getInterQuery();
  if (interQuery) {
    context.setInterQuery();
    this.shuffleType = context.getDataChannel().getShuffleType();

    if (shuffleType == ShuffleType.RANGE_SHUFFLE) {
      SortNode sortNode = PlannerUtil.findTopNode(plan, NodeType.SORT);
      this.finalSchema = PlannerUtil.sortSpecsToSchema(sortNode.getSortKeys());
      this.sortComp = new TupleComparator(finalSchema, sortNode.getSortKeys());
    }
  } else {
    // The final result of a task will be written in a file named part-ss-nnnnnnn,
    // where ss is the subquery id associated with this task, and nnnnnn is the task id.
    Path outFilePath = StorageUtil.concatPath(queryContext.getStagingDir(), TajoConstants.RESULT_DIR_NAME,
        OUTPUT_FILE_PREFIX +
        OUTPUT_FILE_FORMAT_SUBQUERY.get().format(taskId.getQueryUnitId().getExecutionBlockId().getId()) + "-" +
        OUTPUT_FILE_FORMAT_TASK.get().format(taskId.getQueryUnitId().getId()));
    LOG.info("Output File Path: " + outFilePath);
    context.setOutputPath(outFilePath);
  }

  context.setState(TaskAttemptState.TA_PENDING);
  LOG.info("==================================");
  LOG.info("* Subquery " + request.getId() + " is initialized");
  LOG.info("* InterQuery: " + interQuery
      + (interQuery ? ", Use " + this.shuffleType + " shuffle":""));

  LOG.info("* Fragments (num: " + request.getFragments().size() + ")");
  LOG.info("* Fetches (total:" + request.getFetches().size() + ") :");
  for (Fetch f : request.getFetches()) {
    LOG.info("Table Id: " + f.getName() + ", url: " + f.getUrls());
  }
  LOG.info("* Local task dir: " + taskDir);
  if(LOG.isDebugEnabled()) {
    LOG.debug("* plan:\n");
    LOG.debug(plan.toString());
  }
  LOG.info("==================================");
}
 
开发者ID:apache,项目名称:incubator-tajo,代码行数:72,代码来源:Task.java


注:本文中的org.apache.tajo.engine.query.QueryUnitRequest.getFetches方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。