[ https://issues.apache.org/jira/browse/HIVE-9779?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14335737#comment-14335737 ]
Thejas M Nair commented on HIVE-9779: ------------------------------------- hookContext.getUgi() will always be set. We should use hookContext.getUserName() as long as it is set. Can you also fix the indentation ? Were you able to verify that this change works with Yarn ATS ? {code} + if (hookContext.getUserName() == null){ + user = hookContext.getUserName(); + } + else { + user = hookContext.getUgi().getUserName(); + } {code} > ATSHook does not log the end user if doAs=false (it logs the hs2 server user) > ----------------------------------------------------------------------------- > > Key: HIVE-9779 > URL: https://issues.apache.org/jira/browse/HIVE-9779 > Project: Hive > Issue Type: Bug > Components: HiveServer2 > Affects Versions: 0.13.0, 0.14.0 > Reporter: Abdelrahman Shettia > Assignee: Abdelrahman Shettia > Attachments: 9979.001.patch > > > When doAs=false, ATSHook should log the end username in ATS instead of > logging the hiveserver2 user's name. > The way things are, it is not possible for an admin to identify which query > is being run by which user. The end user information is already available in > the HookContext. -- This message was sent by Atlassian JIRA (v6.3.4#6332)