@Override public SessionHandle openSessionWithImpersonation(String username, String password, Map<String, String> configuration, String delegationToken) throws HiveSQLException { throw new HiveSQLException("Impersonated session is not supported in the embedded mode"); }
@Override public SessionHandle openSessionWithImpersonation(String username, String password, Map<String, String> configuration, String delegationToken) throws HiveSQLException { throw new HiveSQLException("open with impersonation operation is not supported in the client"); }
public HiveSession getSession(SessionHandle sessionHandle) throws HiveSQLException { HiveSession session = handleToSession.get(sessionHandle); if (session == null) { throw new HiveSQLException("Invalid SessionHandle: " + sessionHandle); } return session; }
public void cancelDelegationToken(String delegationToken) throws HiveSQLException { if (delegationTokenManager == null) { throw new HiveSQLException( "Delegation token only supported over kerberos authentication", "08S01"); } try { delegationTokenManager.cancelDelegationToken(delegationToken); } catch (IOException e) { throw new HiveSQLException( "Error canceling delegation token " + delegationToken, "08S01", e); } }
public void renewDelegationToken(String delegationToken) throws HiveSQLException { if (delegationTokenManager == null) { throw new HiveSQLException( "Delegation token only supported over kerberos authentication", "08S01"); } try { delegationTokenManager.renewDelegationToken(delegationToken); } catch (IOException e) { throw new HiveSQLException( "Error renewing delegation token " + delegationToken, "08S01", e); } }
public String getUserFromToken(String delegationToken) throws HiveSQLException { if (delegationTokenManager == null) { throw new HiveSQLException( "Delegation token only supported over kerberos authentication", "08S01"); } try { return delegationTokenManager.getUserFromToken(delegationToken); } catch (IOException e) { throw new HiveSQLException( "Error extracting user from delegation token " + delegationToken, "08S01", e); } }
protected final void assertState(List<OperationState> states) throws HiveSQLException { if (!states.contains(state)) { throw new HiveSQLException("Expected states: " + states.toString() + ", but found " + this.state); } this.lastAccessTime = System.currentTimeMillis(); }
public String verifyDelegationToken(String delegationToken) throws HiveSQLException { if (delegationTokenManager == null) { throw new HiveSQLException( "Delegation token only supported over kerberos authentication", "08S01"); } try { return delegationTokenManager.verifyDelegationToken(delegationToken); } catch (IOException e) { String msg = "Error verifying delegation token " + delegationToken; LOG.error(msg, e); throw new HiveSQLException(msg, "08S01", e); } }
public void setSessionUGI(String owner) throws HiveSQLException { if (owner == null) { throw new HiveSQLException("No username provided for impersonation"); } try { sessionUgi = UserGroupInformation.createProxyUser( owner, UserGroupInformation.getLoginUser()); } catch (IOException e) { throw new HiveSQLException("Couldn't setup proxy user", e); } }
public Operation getOperation(OperationHandle operationHandle) throws HiveSQLException { Operation operation = getOperationInternal(operationHandle); if (operation == null) { throw new HiveSQLException("Invalid OperationHandle: " + operationHandle); } return operation; }
public synchronized void closeSession(SessionHandle sessionHandle) throws HiveSQLException { HiveSession session = handleToSession.remove(sessionHandle); if (session == null) { throw new HiveSQLException("Session does not exist: " + sessionHandle); } LOG.info("Session closed, " + sessionHandle + ", current sessions:" + getOpenSessionCount()); closeSessionInternal(session); }
@Override public IMetaStoreClient getMetaStoreClient() throws HiveSQLException { try { return getSessionHive().getMSC(); } catch (MetaException e) { throw new HiveSQLException("Failed to get metastore connection: " + e, e); } }
public void checkStatus(TStatus status) throws HiveSQLException { if (TStatusCode.ERROR_STATUS.equals(status.getStatusCode())) { throw new HiveSQLException(status); } }
static void verifySuccess(TStatus status, boolean withInfo) throws SQLException { if (status.getStatusCode() == TStatusCode.SUCCESS_STATUS || (withInfo && status.getStatusCode() == TStatusCode.SUCCESS_WITH_INFO_STATUS)) { return; } throw new HiveSQLException(status); }
@Override public String getQueryId(TOperationHandle operationHandle) throws HiveSQLException { try { return cliService.GetQueryId(new TGetQueryIdReq(operationHandle)).getQueryId(); } catch (TException e) { throw new HiveSQLException(e); } }
@Override public void closeSession(SessionHandle sessionHandle) throws HiveSQLException { try { TCloseSessionReq req = new TCloseSessionReq(sessionHandle.toTSessionHandle()); TCloseSessionResp resp = cliService.CloseSession(req); checkStatus(resp.getStatus()); } catch (HiveSQLException e) { throw e; } catch (Exception e) { throw new HiveSQLException(e); } }
@Override public void cancelOperation(OperationHandle opHandle) throws HiveSQLException { try { TCancelOperationReq req = new TCancelOperationReq(opHandle.toTOperationHandle()); TCancelOperationResp resp = cliService.CancelOperation(req); checkStatus(resp.getStatus()); } catch (HiveSQLException e) { throw e; } catch (Exception e) { throw new HiveSQLException(e); } }
private void cancelDelegationToken() throws HiveSQLException { if (hmsDelegationTokenStr != null) { try { Hive.get(getHiveConf()).cancelDelegationToken(hmsDelegationTokenStr); hmsDelegationTokenStr = null; getHiveConf().setVar(HiveConf.ConfVars.METASTORE_TOKEN_SIGNATURE, ""); } catch (HiveException e) { throw new HiveSQLException("Couldn't cancel delegation token", e); } } }
protected HiveSQLException toSQLException(String prefix, CommandProcessorResponse response) { HiveSQLException ex = new HiveSQLException(prefix + ": " + response.getErrorMessage(), response.getSQLState(), response.getResponseCode()); if (response.getException() != null) { ex.initCause(response.getException()); } return ex; }
@Override public void setApplicationName(SessionHandle sh, String value) throws HiveSQLException { try { TSetClientInfoReq req = new TSetClientInfoReq(sh.toTSessionHandle()); req.putToConfiguration("ApplicationName", value); TSetClientInfoResp resp = cliService.SetClientInfo(req); checkStatus(resp.getStatus()); } catch (TException e) { throw new HiveSQLException(e); } } }