ashish-kumar-sharma commented on a change in pull request #1964:
URL: https://github.com/apache/hive/pull/1964#discussion_r577585597
##########
File path: service/src/java/org/apache/hive/service/server/KillQueryImpl.java
##########
@@ -116,9 +117,21 @@ public static void killChildYarnJobs(Configuration conf,
String tag, String doAs
private static boolean isAdmin() {
boolean isAdmin = false;
- if (SessionState.get().getAuthorizerV2() != null) {
+ SessionState ss = SessionState.get();
+ if(!HiveConf.getBoolVar(ss.getConf(),
HiveConf.ConfVars.HIVE_AUTHORIZATION_ENABLED)) {
Review comment:
space between if and (
##########
File path: service/src/java/org/apache/hive/service/server/KillQueryImpl.java
##########
@@ -116,9 +117,21 @@ public static void killChildYarnJobs(Configuration conf,
String tag, String doAs
private static boolean isAdmin() {
boolean isAdmin = false;
- if (SessionState.get().getAuthorizerV2() != null) {
+ SessionState ss = SessionState.get();
+ if(!HiveConf.getBoolVar(ss.getConf(),
HiveConf.ConfVars.HIVE_AUTHORIZATION_ENABLED)) {
+ // If authorization is disabled, hs2 process owner should have kill
privileges
try {
- SessionState.get().getAuthorizerV2()
+ String currentUser = ss.getUserName();
+ String loginUser =
UserGroupInformation.getCurrentUser().getShortUserName();
+ return (currentUser != null) && currentUser.equals(loginUser);
Review comment:
if loginUser will never be null then use "return
StringUtils.equals(currentUser, loginUser)". this will handle null values also.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]