return taskNum;
}
}
private static void createTasks(SubQuery subQuery) throws IOException {
MasterPlan masterPlan = subQuery.getMasterPlan();
ExecutionBlock execBlock = subQuery.getBlock();
QueryUnit [] tasks;
if (subQuery.getMasterPlan().isLeaf(execBlock.getId()) && execBlock.getScanNodes().length == 1) { // Case 1: Just Scan
tasks = createLeafTasks(subQuery);
} else if (execBlock.getScanNodes().length > 1) { // Case 2: Join
tasks = Repartitioner.createJoinTasks(subQuery);
} else { // Case 3: Others (Sort or Aggregation)
int numTasks = getNonLeafTaskNum(subQuery);
ExecutionBlockId childId = masterPlan.getChilds(subQuery.getBlock()).get(0).getId();
SubQuery child = subQuery.context.getSubQuery(childId);
DataChannel channel = masterPlan.getChannel(child.getId(), subQuery.getId());
tasks = Repartitioner.createNonLeafTask(masterPlan, subQuery, child, channel, numTasks);
}
LOG.info("Create " + tasks.length + " Tasks");