Search in sources :

Example 1 with TaskGraphWalkerContext

use of org.apache.hadoop.hive.ql.lib.TaskGraphWalker.TaskGraphWalkerContext in project hive by apache.

the class AbstractJoinTaskDispatcher method dispatch.

@Override
public Object dispatch(Node nd, Stack<Node> stack, Object... nodeOutputs) throws SemanticException {
    if (nodeOutputs == null || nodeOutputs.length == 0) {
        throw new SemanticException("No Dispatch Context");
    }
    TaskGraphWalkerContext walkerCtx = (TaskGraphWalkerContext) nodeOutputs[0];
    Task<? extends Serializable> currTask = (Task<? extends Serializable>) nd;
    // not map reduce task or not conditional task, just skip
    if (currTask.isMapRedTask()) {
        if (currTask instanceof ConditionalTask) {
            // get the list of task
            List<Task<? extends Serializable>> taskList = ((ConditionalTask) currTask).getListTasks();
            for (Task<? extends Serializable> tsk : taskList) {
                if (tsk.isMapRedTask()) {
                    Task<? extends Serializable> newTask = this.processCurrentTask((MapRedTask) tsk, ((ConditionalTask) currTask), physicalContext.getContext());
                    walkerCtx.addToDispatchList(newTask);
                }
            }
        } else {
            Task<? extends Serializable> newTask = this.processCurrentTask((MapRedTask) currTask, null, physicalContext.getContext());
            walkerCtx.addToDispatchList(newTask);
        }
    }
    return null;
}
Also used : TaskGraphWalkerContext(org.apache.hadoop.hive.ql.lib.TaskGraphWalker.TaskGraphWalkerContext) ConditionalTask(org.apache.hadoop.hive.ql.exec.ConditionalTask) Task(org.apache.hadoop.hive.ql.exec.Task) MapRedTask(org.apache.hadoop.hive.ql.exec.mr.MapRedTask) Serializable(java.io.Serializable) ConditionalTask(org.apache.hadoop.hive.ql.exec.ConditionalTask) SemanticException(org.apache.hadoop.hive.ql.parse.SemanticException)

Aggregations

Serializable (java.io.Serializable)1 ConditionalTask (org.apache.hadoop.hive.ql.exec.ConditionalTask)1 Task (org.apache.hadoop.hive.ql.exec.Task)1 MapRedTask (org.apache.hadoop.hive.ql.exec.mr.MapRedTask)1 TaskGraphWalkerContext (org.apache.hadoop.hive.ql.lib.TaskGraphWalker.TaskGraphWalkerContext)1 SemanticException (org.apache.hadoop.hive.ql.parse.SemanticException)1