Package org.apache.tajo.engine.query

Examples of org.apache.tajo.engine.query.QueryUnitRequestImpl


                  LOG.info("Initializing: " + taskAttemptId);
                  Task task;
                  try {
                    task = new Task(taskAttemptId, taskRunnerContext, master,
                        new QueryUnitRequestImpl(taskRequest));
                    tasks.put(taskAttemptId, task);

                    task.init();
                    if (task.hasFetchPhase()) {
                      task.fetch(); // The fetch is performed in an asynchronous way.
View Full Code Here


        SubQuery subQuery = context.getQuery().getSubQuery(attemptId.getQueryUnitId().getExecutionBlockId());

        if (attemptId != null) {
          QueryUnit task = subQuery.getQueryUnit(attemptId.getQueryUnitId());
          QueryUnitRequest taskAssign = new QueryUnitRequestImpl(
              attemptId,
              new ArrayList<Fragment>(task.getAllFragments()),
              "",
              false,
              task.getLogicalPlan().toJson(),
              context.getQueryContext(),
              subQuery.getDataChannel(), subQuery.getBlock().getEnforcer());
          if (!subQuery.getBlock().isRoot()) {
            taskAssign.setInterQuery();
          }

          context.getEventHandler().handle(new TaskAttemptAssignedEvent(attemptId,
              taskRequest.getContainerId(),
              host, container.getTaskPort()));
          assignedRequest.add(attemptId);

          totalAssigned++;
          taskRequest.getCallback().run(taskAssign.getProto());
        } else {
          throw new RuntimeException("Illegal State!!!!!!!!!!!!!!!!!!!!!");
        }
      }
View Full Code Here

          LOG.debug("Assigned based on * match");

          QueryUnit task;
          SubQuery subQuery = context.getSubQuery(attemptId.getQueryUnitId().getExecutionBlockId());
          task = subQuery.getQueryUnit(attemptId.getQueryUnitId());
          QueryUnitRequest taskAssign = new QueryUnitRequestImpl(
              attemptId,
              Lists.newArrayList(task.getAllFragments()),
              "",
              false,
              task.getLogicalPlan().toJson(),
              context.getQueryContext(),
              subQuery.getDataChannel(),
              subQuery.getBlock().getEnforcer());
          if (!subQuery.getBlock().isRoot()) {
            taskAssign.setInterQuery();
          }
          for (ScanNode scan : task.getScanNodes()) {
            Collection<URI> fetches = task.getFetch(scan);
            if (fetches != null) {
              for (URI fetch : fetches) {
                taskAssign.addFetch(scan.getTableName(), fetch);
              }
            }
          }

          ContainerProxy container = context.getResourceAllocator().getContainer(
              taskRequest.getContainerId());
          context.getEventHandler().handle(new TaskAttemptAssignedEvent(attemptId,
              taskRequest.getContainerId(), container.getTaskHostName(), container.getTaskPort()));
          taskRequest.getCallback().run(taskAssign.getProto());
        }
      }
    }
View Full Code Here

  private void assignTask(QueryUnitAttemptScheduleContext attemptContext, QueryUnitAttempt taskAttempt) {
    QueryUnitAttemptId attemptId = taskAttempt.getId();
    ContainerProxy containerProxy = context.getMasterContext().getResourceAllocator().
        getContainer(attemptContext.getContainerId());
    QueryUnitRequest taskAssign = new QueryUnitRequestImpl(
        attemptId,
        new ArrayList<FragmentProto>(taskAttempt.getQueryUnit().getAllFragments()),
        "",
        false,
        taskAttempt.getQueryUnit().getLogicalPlan().toJson(),
        context.getMasterContext().getQueryContext(),
        subQuery.getDataChannel(), subQuery.getBlock().getEnforcer());
    if (checkIfInterQuery(subQuery.getMasterPlan(), subQuery.getBlock())) {
      taskAssign.setInterQuery();
    }

    if (!context.isLeafQuery()) {
      Map<String, List<URI>> fetch = scheduledFetches.getNextFetch();
      scheduledFetches.popNextFetch();

      for (Entry<String, List<URI>> fetchEntry : fetch.entrySet()) {
        for (URI eachValue : fetchEntry.getValue()) {
          taskAssign.addFetch(fetchEntry.getKey(), eachValue);
        }
      }
    }

    context.getMasterContext().getEventHandler().handle(new TaskAttemptAssignedEvent(attemptId,
        attemptContext.getContainerId(), attemptContext.getHost(), containerProxy.getTaskPort()));

    totalAssigned++;
    attemptContext.getCallback().run(taskAssign.getProto());

    if (context.isLeafQuery()) {
      LOG.debug("DiskLocalAssigned / Total: " + diskLocalAssigned + " / " + totalAssigned);
      LOG.debug("HostLocalAssigned / Total: " + hostLocalAssigned + " / " + totalAssigned);
      LOG.debug("RackLocalAssigned: " + rackLocalAssigned + " / " + totalAssigned);
View Full Code Here

                  LOG.info("Initializing: " + taskAttemptId);
                  Task task;
                  try {
                    task = new Task(taskAttemptId, taskRunnerContext, qmClientService,
                        new QueryUnitRequestImpl(taskRequest));
                    tasks.put(taskAttemptId, task);

                    task.init();
                    if (task.hasFetchPhase()) {
                      task.fetch(); // The fetch is performed in an asynchronous way.
View Full Code Here

          }
        }

        if (attemptId != null) {
          QueryUnit task = subQuery.getQueryUnit(attemptId.getQueryUnitId());
          QueryUnitRequest taskAssign = new QueryUnitRequestImpl(
              attemptId,
              new ArrayList<FragmentProto>(task.getAllFragments()),
              "",
              false,
              task.getLogicalPlan().toJson(),
              context.getMasterContext().getQueryContext(),
              subQuery.getDataChannel(), subQuery.getBlock().getEnforcer());
          if (checkIfInterQuery(subQuery.getMasterPlan(), subQuery.getBlock())) {
            taskAssign.setInterQuery();
          }

          context.getMasterContext().getEventHandler().handle(new TaskAttemptAssignedEvent(attemptId,
              taskRequest.getContainerId(),
              host, container.getTaskPort()));
          assignedRequest.add(attemptId);

          scheduledObjectNum -= task.getAllFragments().size();
          taskRequest.getCallback().run(taskAssign.getProto());
        } else {
          throw new RuntimeException("Illegal State!!!!!!!!!!!!!!!!!!!!!");
        }
      }
    }
View Full Code Here

          }
          LOG.debug("Assigned based on * match");

          QueryUnit task;
          task = subQuery.getQueryUnit(attemptId.getQueryUnitId());
          QueryUnitRequest taskAssign = new QueryUnitRequestImpl(
              attemptId,
              Lists.newArrayList(task.getAllFragments()),
              "",
              false,
              task.getLogicalPlan().toJson(),
              context.getMasterContext().getQueryContext(),
              subQuery.getDataChannel(),
              subQuery.getBlock().getEnforcer());
          if (checkIfInterQuery(subQuery.getMasterPlan(), subQuery.getBlock())) {
            taskAssign.setInterQuery();
          }
          for (ScanNode scan : task.getScanNodes()) {
            Collection<URI> fetches = task.getFetch(scan);
            if (fetches != null) {
              for (URI fetch : fetches) {
                taskAssign.addFetch(scan.getTableName(), fetch);
              }
            }
          }

          ContainerProxy container = context.getMasterContext().getResourceAllocator().getContainer(
              taskRequest.getContainerId());
          context.getMasterContext().getEventHandler().handle(new TaskAttemptAssignedEvent(attemptId,
              taskRequest.getContainerId(), container.getTaskHostName(), container.getTaskPort()));
          taskRequest.getCallback().run(taskAssign.getProto());
          totalAssigned++;
          scheduledObjectNum--;
        }
      }
    }
View Full Code Here

TOP

Related Classes of org.apache.tajo.engine.query.QueryUnitRequestImpl

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.