diff --git service/src/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java service/src/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java index e79b129..b55d08f 100644 --- service/src/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java +++ service/src/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java @@ -49,6 +49,14 @@ public HiveSessionImplwithUGI(TProtocolVersion protocol, String username, String super(protocol, username, password, hiveConf, sessionConf, ipAddress); setSessionUGI(username); setDelegationToken(delegationToken); + + // create a new metastore connection for this particular user session + Hive.set(null); + try { + sessionHive = Hive.get(getHiveConf()); + } catch (HiveException e) { + throw new HiveSQLException("Failed to setup metastore connection", e); + } } // setup appropriate UGI for the session @@ -116,13 +124,6 @@ private void setDelegationToken(String delegationTokenStr) throws HiveSQLExcepti } catch (IOException e) { throw new HiveSQLException("Couldn't setup delegation token in the ugi", e); } - // create a new metastore connection using the delegation token - Hive.set(null); - try { - sessionHive = Hive.get(getHiveConf()); - } catch (HiveException e) { - throw new HiveSQLException("Failed to setup metastore connection", e); - } } }