deniskuzZ commented on code in PR #5649:
URL: https://github.com/apache/hive/pull/5649#discussion_r2019079112


##########
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/KillTriggerActionHandler.java:
##########
@@ -38,28 +39,24 @@ public class KillTriggerActionHandler implements 
TriggerActionHandler<TezSession
   @Override
   public void applyAction(final Map<TezSessionState, Trigger> queriesViolated) 
{
     for (Map.Entry<TezSessionState, Trigger> entry : 
queriesViolated.entrySet()) {
-      switch (entry.getValue().getAction().getType()) {
-      case KILL_QUERY:
-        TezSessionState sessionState = entry.getKey();
-        String queryId = sessionState.getWmContext().getQueryId();
-        try {
-          UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
-          SessionState ss = new SessionState(new HiveConf(), 
ugi.getShortUserName());
-          ss.setIsHiveServerQuery(true);
-          SessionState.start(ss);
-          KillQuery killQuery = sessionState.getKillQuery();
-          // if kill query is null then session might have been released to 
pool or closed already
-          if (killQuery != null) {
-            sessionState.getKillQuery().killQuery(queryId, 
entry.getValue().getViolationMsg(),
-                      sessionState.getConf());
-          }
-        } catch (HiveException|IOException e) {
-          LOG.warn("Unable to kill query {} for trigger violation", queryId);
+        if (entry.getValue().getAction().getType() == Action.Type.KILL_QUERY) {
+            TezSessionState sessionState = entry.getKey();
+            String queryId = sessionState.getWmContext().getQueryId();
+            try {
+                UserGroupInformation ugi = 
UserGroupInformation.getCurrentUser();
+                DriverUtils.setUpSessionState(new HiveConf(), 
ugi.getShortUserName());

Review Comment:
   could we move `conf` to an instance var and initialise it in the constructor?



-- 
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: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to