@Override public TCloseOperationResp CloseOperation(TCloseOperationReq req) throws TException { TCloseOperationResp resp = new TCloseOperationResp(); try { cliService.closeOperation(new OperationHandle(req.getOperationHandle())); resp.setStatus(OK_STATUS); } catch (Exception e) { LOG.warn("Error closing operation: ", e); resp.setStatus(HiveSQLException.toTStatus(e)); } return resp; }
/** * Close operation created for underlying CLI service * @param op operation handle */ private void closeCliServiceOp(OperationHandle op) { if (op != null) { try { getCliService().closeOperation(op); } catch (HiveSQLException e) { log.error("Error closing operation " + op.getHandleIdentifier(), e); } } }
@Override protected SessionHandle doOpenHiveSession(Map<String, String> sessionConf) throws HiveSQLException { SessionHandle sessionHandle = super.doOpenHiveSession(sessionConf); // HDP Hive 12 only sets SessionState when an operation is executed. // The SessionState is not set during an openSession call. // Hence execute a dummy statement during openSession, so that SessionState gets set. OperationHandle opHandle = null; try { opHandle = getCliService().executeStatement(sessionHandle, "set cdap_tmp_var=1", Collections.<String, String>emptyMap()); } catch (Throwable t) { LOG.error("Error setting temporary variable to set session state", t); } finally { if (opHandle != null) { try { getCliService().closeOperation(opHandle); } catch (Throwable t) { LOG.debug("Caught exception while closing opHandle", t); } } } return sessionHandle; } }
@Override protected SessionHandle doOpenHiveSession(Map<String, String> sessionConf) throws HiveSQLException { SessionHandle sessionHandle = super.doOpenHiveSession(sessionConf); // HDP Hive 12 only sets SessionState when an operation is executed. // The SessionState is not set during an openSession call. // Hence execute a dummy statement during openSession, so that SessionState gets set. OperationHandle opHandle = null; try { opHandle = getCliService().executeStatement(sessionHandle, "set cdap_tmp_var=1", Collections.<String, String>emptyMap()); } catch (Throwable t) { LOG.error("Error setting temporary variable to set session state", t); } finally { if (opHandle != null) { try { getCliService().closeOperation(opHandle); } catch (Throwable t) { LOG.debug("Caught exception while closing opHandle", t); } } } return sessionHandle; } }
@Override public TCloseOperationResp CloseOperation(TCloseOperationReq req) throws TException { TCloseOperationResp resp = new TCloseOperationResp(); try { cliService.closeOperation(new OperationHandle(req.getOperationHandle())); resp.setStatus(OK_STATUS); } catch (Exception e) { LOG.warn("Error closing operation: ", e); resp.setStatus(HiveSQLException.toTStatus(e)); } return resp; }
@Override public TCloseOperationResp CloseOperation(TCloseOperationReq req) throws TException { TCloseOperationResp resp = new TCloseOperationResp(); try { cliService.closeOperation(new OperationHandle(req.getOperationHandle())); resp.setStatus(OK_STATUS); } catch (Exception e) { LOG.warn("Error closing operation: ", e); resp.setStatus(HiveSQLException.toTStatus(e)); } return resp; }
@Override public TCloseOperationResp CloseOperation(TCloseOperationReq req) throws TException { TCloseOperationResp resp = new TCloseOperationResp(); try { cliService.closeOperation(new OperationHandle(req.getOperationHandle())); resp.setStatus(OK_STATUS); } catch (Exception e) { LOG.warn("Error closing operation: ", e); resp.setStatus(HiveSQLException.toTStatus(e)); } return resp; }
@Override public TCloseOperationResp CloseOperation(TCloseOperationReq req) throws TException { TCloseOperationResp resp = new TCloseOperationResp(); try { cliService.closeOperation(new OperationHandle(req.getOperationHandle())); resp.setStatus(OK_STATUS); } catch (Exception e) { LOG.warn("Error closing operation: ", e); resp.setStatus(HiveSQLException.toTStatus(e)); } return resp; }
@Override public TCloseOperationResp CloseOperation(TCloseOperationReq req) throws TException { TCloseOperationResp resp = new TCloseOperationResp(); try { cliService.closeOperation(new OperationHandle(req.getOperationHandle())); resp.setStatus(OK_STATUS); } catch (Exception e) { LOG.warn("Error closing operation: ", e); resp.setStatus(HiveSQLException.toTStatus(e)); } return resp; }
void closeInternal(QueryHandle handle, OperationInfo opInfo) throws ExploreException, SQLException { try { LOG.trace("Closing operation {}", handle); if (opInfo.getOperationHandle() != null) { cliService.closeOperation(opInfo.getOperationHandle()); } } catch (HiveSQLException e) { throw getSqlException(e); } finally { try { if (opInfo.getSessionHandle() != null) { closeHiveSession(opInfo.getSessionHandle()); } } finally { cleanUp(handle, opInfo); } } }
void closeInternal(QueryHandle handle, OperationInfo opInfo) throws ExploreException, SQLException { try { LOG.trace("Closing operation {}", handle); if (opInfo.getOperationHandle() != null) { cliService.closeOperation(opInfo.getOperationHandle()); } } catch (HiveSQLException e) { throw getSqlException(e); } finally { try { if (opInfo.getSessionHandle() != null) { closeHiveSession(opInfo.getSessionHandle()); } } finally { cleanUp(handle, opInfo); } } }