hzxiongyinke commented on code in PR #4821:
URL: https://github.com/apache/hive/pull/4821#discussion_r1378694480


##########
ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java:
##########
@@ -731,6 +734,24 @@ private static void start(SessionState startSs, boolean 
isAsync, LogHelper conso
       // that would cause ClassNoFoundException otherwise
       throw new RuntimeException(e);
     }
+    try {
+      if(!startSs.isHiveServerQuery){
+        if (getSessionConf().getBoolVar(ConfVars.METASTORE_USE_THRIFT_SASL)) {
+          UserGroupInformation UGI = Utils.getUGI();
+          String hmsDelegationTokenStr = 
Hive.get().getDelegationToken(UGI.getShortUserName(), UGI.getShortUserName());
+          if (hmsDelegationTokenStr != null) {
+            getSessionConf().setVar(ConfVars.METASTORE_TOKEN_SIGNATURE, 
CLITOKEN);
+            try {
+              SecurityUtils.setTokenStr(UGI, hmsDelegationTokenStr, CLITOKEN);
+            } catch (IOException e) {
+              throw new IOException("Couldn't setup delegation token in the 
ugi: " + e, e);

Review Comment:
   > I think this is better - `throw new IOException("Couldn't set delegation 
token in the UGI due to: " + e.getMessage(), e);`
   
   You're right,I will follow your suggestion.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to