Search in sources :

Example 1 with KillQueryImpl

use of org.apache.hive.service.server.KillQueryImpl in project hive by apache.

the class HiveSessionImpl method open.

@Override
public /**
 * Opens a new HiveServer2 session for the client connection.
 * Creates a new SessionState object that will be associated with this HiveServer2 session.
 * When the server executes multiple queries in the same session,
 * this SessionState object is reused across multiple queries.
 * Note that if doAs is true, this call goes through a proxy object,
 * which wraps the method logic in a UserGroupInformation#doAs.
 * That's why it is important to create SessionState here rather than in the constructor.
 */
void open(Map<String, String> sessionConfMap) throws HiveSQLException {
    sessionState = new SessionState(sessionConf, username);
    sessionState.setUserIpAddress(ipAddress);
    sessionState.setIsHiveServerQuery(true);
    sessionState.setForwardedAddresses(SessionManager.getForwardedAddresses());
    sessionState.setIsUsingThriftJDBCBinarySerDe(updateIsUsingThriftJDBCBinarySerDe());
    try {
        if (sessionManager != null) {
            sessionState.setHiveServer2Host(sessionManager.getHiveServer2HostName());
        }
    } catch (Exception e) {
        throw new HiveSQLException(e);
    }
    sessionState.setKillQuery(new KillQueryImpl(operationManager));
    SessionState.start(sessionState);
    try {
        sessionState.loadAuxJars();
        sessionState.loadReloadableAuxJars();
    } catch (IOException e) {
        String msg = "Failed to load reloadable jar file path: " + e;
        LOG.error(msg, e);
        throw new HiveSQLException(msg, e);
    }
    try {
        sessionHive = Hive.get(getHiveConf());
    } catch (HiveException e) {
        throw new HiveSQLException("Failed to get metastore connection", e);
    }
    // Process global init file: .hiverc
    processGlobalInitFile();
    // Set fetch size in session conf map
    sessionConfMap = setFetchSize(sessionConfMap);
    if (sessionConfMap != null) {
        configureSession(sessionConfMap);
    }
    lastAccessTime = System.currentTimeMillis();
}
Also used : SessionState(org.apache.hadoop.hive.ql.session.SessionState) HiveException(org.apache.hadoop.hive.ql.metadata.HiveException) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) KillQueryImpl(org.apache.hive.service.server.KillQueryImpl) IOException(java.io.IOException) MetaException(org.apache.hadoop.hive.metastore.api.MetaException) HiveException(org.apache.hadoop.hive.ql.metadata.HiveException) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 MetaException (org.apache.hadoop.hive.metastore.api.MetaException)1 HiveException (org.apache.hadoop.hive.ql.metadata.HiveException)1 SessionState (org.apache.hadoop.hive.ql.session.SessionState)1 HiveSQLException (org.apache.hive.service.cli.HiveSQLException)1 KillQueryImpl (org.apache.hive.service.server.KillQueryImpl)1