@Override public Future<?> submitBackgroundOperation(Runnable work) { return getSessionManager().submitBackgroundOperation( operationLock == null ? work : new FutureTask<Void>(work, null) { protected void done() { // We assume this always comes from a user operation that took the lock. operationLock.release(); }; }); }
public HiveConf getSessionConf(SessionHandle sessionHandle) throws HiveSQLException { return sessionManager.getSession(sessionHandle).getSessionConf(); }
@Override public void setApplicationName(SessionHandle sh, String value) throws HiveSQLException { sessionManager.getSession(sh).setApplicationName(value); }
@Override public void cancelOperation(OperationHandle opHandle) throws HiveSQLException { acquire(true, false); try { sessionManager.getOperationManager().cancelOperation(opHandle); } finally { release(true, false); } }
@Override public OperationHandle getCatalogs(SessionHandle sessionHandle) throws HiveSQLException { OperationHandle opHandle = sessionManager.getSession(sessionHandle) .getCatalogs(); LOG.debug(sessionHandle + ": getCatalogs()"); return opHandle; }
@Override public void cancelDelegationToken(SessionHandle sessionHandle, HiveAuthFactory authFactory, String tokenStr) throws HiveSQLException { sessionManager.getSession(sessionHandle). cancelDelegationToken(authFactory, tokenStr); LOG.info(sessionHandle + ": cancelDelegationToken()"); }
@Override public OperationHandle getColumns(SessionHandle sessionHandle, String catalogName, String schemaName, String tableName, String columnName) throws HiveSQLException { OperationHandle opHandle = sessionManager.getSession(sessionHandle) .getColumns(catalogName, schemaName, tableName, columnName); LOG.debug(sessionHandle + ": getColumns()"); return opHandle; }
@Override public String getDelegationToken(SessionHandle sessionHandle, HiveAuthFactory authFactory, String owner, String renewer) throws HiveSQLException { String delegationToken = sessionManager.getSession(sessionHandle). getDelegationToken(authFactory, owner, renewer); LOG.info(sessionHandle + ": getDelegationToken()" + " owner: " + owner + ", renewer: " + renewer); return delegationToken; }
@Override public void renewDelegationToken(SessionHandle sessionHandle, HiveAuthFactory authFactory, String tokenStr) throws HiveSQLException { sessionManager.getSession(sessionHandle).renewDelegationToken(authFactory, tokenStr); LOG.info(sessionHandle + ": renewDelegationToken()"); }
@Override public GetInfoValue getInfo(SessionHandle sessionHandle, GetInfoType getInfoType) throws HiveSQLException { GetInfoValue infoValue = sessionManager.getSession(sessionHandle) .getInfo(getInfoType); LOG.debug(sessionHandle + ": getInfo()"); return infoValue; }
@Override public OperationHandle getTypeInfo(SessionHandle sessionHandle) throws HiveSQLException { OperationHandle opHandle = sessionManager.getSession(sessionHandle) .getTypeInfo(); LOG.debug(sessionHandle + ": getTypeInfo()"); return opHandle; }
@Override public OperationHandle getSchemas(SessionHandle sessionHandle, String catalogName, String schemaName) throws HiveSQLException { OperationHandle opHandle = sessionManager.getSession(sessionHandle) .getSchemas(catalogName, schemaName); LOG.debug(sessionHandle + ": getSchemas()"); return opHandle; }
public HiveSessionImplwithUGI(SessionHandle sessionHandle, TProtocolVersion protocol, String username, String password, HiveConf hiveConf, String ipAddress, String delegationToken, final List<String> forwardedAddresses) throws HiveSQLException { super(sessionHandle, protocol, username, password, hiveConf, ipAddress, forwardedAddresses); setSessionUGI(username); setDelegationToken(delegationToken); }
@Override public OperationHandle getPrimaryKeys(SessionHandle sessionHandle, String catalog, String schema, String table) throws HiveSQLException { OperationHandle opHandle = sessionManager.getSession(sessionHandle) .getPrimaryKeys(catalog, schema, table); LOG.debug(sessionHandle + ": getPrimaryKeys()"); return opHandle; }
@Override public OperationHandle executeStatement(String statement, Map<String, String> confOverlay, long queryTimeout) throws HiveSQLException { return executeStatementInternal(statement, confOverlay, false, queryTimeout); }
private void executeSessionHooks(HiveSession session) throws Exception { List<HiveSessionHook> sessionHooks = HookUtils.readHooksFromConf(hiveConf, HiveConf.ConfVars.HIVE_SERVER2_SESSION_HOOK); for (HiveSessionHook sessionHook : sessionHooks) { sessionHook.run(new HiveSessionHookContextImpl(session)); } }
@Override public Integer getValue() { long sum = 0; long currentTime = System.currentTimeMillis(); for (HiveSession s : getSessions()) { sum += currentTime - s.getCreationTime(); } // in case of an overflow return -1 return (int) sum != sum ? -1 : (int) sum; } };
@Override public TableSchema getResultSetMetadata(OperationHandle opHandle) throws HiveSQLException { acquire(true, true); try { return sessionManager.getOperationManager().getOperationResultSetSchema(opHandle); } finally { release(true, true); } }
@Override public OperationHandle executeStatementAsync(String statement, Map<String, String> confOverlay, long queryTimeout) throws HiveSQLException { return executeStatementInternal(statement, confOverlay, true, queryTimeout); }
@Override public OperationHandle executeStatement(String statement, Map<String, String> confOverlay) throws HiveSQLException { return executeStatementInternal(statement, confOverlay, false, 0); }