// is the current task a root task
if (uPrsCtx.getRootTask(pos) && (!ctx.getRootTasks().contains(currTask)))
ctx.getRootTasks().add(currTask);
GenMRUnionCtx uCtxTask = ctx.getUnionTask(union);
Task<? extends Serializable> uTask = null;
Operator<? extends Serializable> parent = union.getParentOperators().get(pos);
mapredWork uPlan = null;
// union is encountered for the first time
if (uCtxTask == null) {
uCtxTask = new GenMRUnionCtx();
uPlan = GenMapRedUtils.getMapRedWork();
uTask = TaskFactory.get(uPlan, parseCtx.getConf());
uCtxTask.setUTask(uTask);
ctx.setUnionTask(union, uCtxTask);
}
else {
uTask = uCtxTask.getUTask();
uPlan = (mapredWork)uTask.getWork();
}
// If there is a mapjoin at position 'pos'
if (uPrsCtx.getMapJoinSubq(pos)) {
MapJoinOperator mjOp = ctx.getCurrMapJoinOp();
assert mjOp != null;
GenMRMapJoinCtx mjCtx = ctx.getMapJoinCtx(mjOp);
assert mjCtx != null;
mapredWork plan = (mapredWork) currTask.getWork();
String taskTmpDir = mjCtx.getTaskTmpDir();
tableDesc tt_desc = mjCtx.getTTDesc();
assert plan.getPathToAliases().get(taskTmpDir) == null;
plan.getPathToAliases().put(taskTmpDir, new ArrayList<String>());
plan.getPathToAliases().get(taskTmpDir).add(taskTmpDir);
plan.getPathToPartitionInfo().put(taskTmpDir, new partitionDesc(tt_desc, null));
plan.getAliasToWork().put(taskTmpDir, mjCtx.getRootMapJoinOp());
}
tableDesc tt_desc = PlanUtils.getIntermediateFileTableDesc(
PlanUtils.getFieldSchemasFromRowSchema(parent.getSchema(), "temporarycol"));
// generate the temporary file
Context baseCtx = parseCtx.getContext();
String taskTmpDir = baseCtx.getMRTmpFileURI();
// Add the path to alias mapping
uCtxTask.addTaskTmpDir(taskTmpDir);
uCtxTask.addTTDesc(tt_desc);
// The union task is empty. The files created for all the inputs are assembled in the
// union context and later used to initialize the union plan
// Create a file sink operator for this file name