use of org.apache.hadoop.hive.ql.optimizer.GenMRProcContext.GenMRUnionCtx in project hive by apache.
the class GenMRUnion1 method processMapOnlyUnion.
/**
* Process the union if all sub-queries are map-only
*
* @return
* @throws SemanticException
*/
private Object processMapOnlyUnion(UnionOperator union, Stack<Node> stack, GenMRProcContext ctx, UnionProcContext uCtx) throws SemanticException {
// merge currTask from multiple topOps
GenMRUnionCtx uCtxTask = ctx.getUnionTask(union);
if (uCtxTask != null) {
// get task associated with this union
Task<?> uTask = ctx.getUnionTask(union).getUTask();
if (uTask != null) {
if (ctx.getCurrTask() != null && ctx.getCurrTask() != uTask) {
// if ctx.getCurrTask() is in rootTasks, should be removed
ctx.getRootTasks().remove(ctx.getCurrTask());
}
ctx.setCurrTask(uTask);
}
}
UnionParseContext uPrsCtx = uCtx.getUnionParseContext(union);
ctx.getMapCurrCtx().put(union, new GenMapRedCtx(ctx.getCurrTask(), ctx.getCurrAliasId()));
// if the union is the first time seen, set current task to GenMRUnionCtx
uCtxTask = ctx.getUnionTask(union);
if (uCtxTask == null) {
uCtxTask = new GenMRUnionCtx(ctx.getCurrTask());
ctx.setUnionTask(union, uCtxTask);
}
Task<?> uTask = ctx.getCurrTask();
if (uTask.getParentTasks() == null || uTask.getParentTasks().isEmpty()) {
if (!ctx.getRootTasks().contains(uTask)) {
ctx.getRootTasks().add(uTask);
}
}
return true;
}
Aggregations