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);