use of org.apache.hadoop.hive.ql.history.HiveHistoryImpl in project hive by apache.
the class ResourceMaps method start.
private static synchronized void start(SessionState startSs, boolean isAsync, LogHelper console) {
setCurrentSessionState(startSs);
if (startSs.isStarted) {
return;
}
startSs.isStarted = true;
if (startSs.hiveHist == null) {
if (startSs.getConf().getBoolVar(HiveConf.ConfVars.HIVE_SESSION_HISTORY_ENABLED)) {
startSs.hiveHist = new HiveHistoryImpl(startSs);
} else {
// Hive history is disabled, create a no-op proxy
startSs.hiveHist = HiveHistoryProxyHandler.getNoOpHiveHistoryProxy();
}
}
// while and should be done when we start up.
try {
UserGroupInformation sessionUGI = Utils.getUGI();
FileSystem.get(startSs.sessionConf);
// Create scratch dirs for this session
startSs.createSessionDirs(sessionUGI.getShortUserName());
// Set temp file containing results to be sent to HiveClient
if (startSs.getTmpOutputFile() == null) {
try {
startSs.setTmpOutputFile(createTempFile(startSs.getConf()));
} catch (IOException e) {
throw new RuntimeException(e);
}
}
// Set temp file containing error output to be sent to client
if (startSs.getTmpErrOutputFile() == null) {
try {
startSs.setTmpErrOutputFile(createTempFile(startSs.getConf()));
} catch (IOException e) {
throw new RuntimeException(e);
}
}
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
// that would cause ClassNoFoundException otherwise
throw new RuntimeException(e);
}
String engine = HiveConf.getVar(startSs.getConf(), HiveConf.ConfVars.HIVE_EXECUTION_ENGINE);
if (!engine.equals("tez") || startSs.isHiveServerQuery)
return;
try {
if (startSs.tezSessionState == null) {
startSs.setTezSession(new TezSessionState(startSs.getSessionId()));
}
if (startSs.tezSessionState.isOpen()) {
return;
}
if (startSs.tezSessionState.isOpening()) {
if (!isAsync) {
startSs.tezSessionState.endOpen();
}
return;
}
// Neither open nor opening.
if (!isAsync) {
// should use conf on session start-up
startSs.tezSessionState.open(startSs.sessionConf);
} else {
startSs.tezSessionState.beginOpen(startSs.sessionConf, null, console);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
Aggregations