if (SessionState.get() != null)
SessionState.get().getHiveHistory().startQuery(queryStr, conf.getVar(HiveConf.ConfVars.HIVEQUERYID) );
resStream = null;
BaseSemanticAnalyzer sem = plan.getPlan();
// Get all the pre execution hooks and execute them.
for(PreExecute peh: getPreExecHooks()) {
peh.run(SessionState.get(),
sem.getInputs(), sem.getOutputs(),
UserGroupInformation.getCurrentUGI());
}
int jobs = countJobs(sem.getRootTasks());
if (jobs > 0) {
console.printInfo("Total MapReduce jobs = " + jobs);
}
if (SessionState.get() != null){
SessionState.get().getHiveHistory().setQueryProperty(queryId,
Keys.QUERY_NUM_TASKS, String.valueOf(jobs));
SessionState.get().getHiveHistory().setIdToTableMap(sem.getIdToTableNameMap());
}
String jobname = Utilities.abbreviate(queryStr, maxlen - 6);
int curJobNo = 0;
// A very simple runtime that keeps putting runnable tasks on a list and
// when a job completes, it puts the children at the back of the list
// while taking the job to run from the front of the list
Queue<Task<? extends Serializable>> runnable = new LinkedList<Task<? extends Serializable>>();
for (Task<? extends Serializable> rootTask : sem.getRootTasks()) {
if (runnable.offer(rootTask) == false) {
LOG.error("Could not insert the first task into the queue");
return (1);
}
}