Repository: hive Updated Branches: refs/heads/branch-3 baf513cfb -> f3cef0d3c
HIVE-20389: NPE in SessionStateUserAuthenticator when authenticator=SessionStateUserAuthenticator (Daniel Dai, reviewed by Thejas Nair) Project: http://git-wip-us.apache.org/repos/asf/hive/repo Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/f3cef0d3 Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/f3cef0d3 Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/f3cef0d3 Branch: refs/heads/branch-3 Commit: f3cef0d3c7a2916f4af19eccfea03a635c141b38 Parents: baf513c Author: Daniel Dai <[email protected]> Authored: Wed Aug 15 15:35:26 2018 -0700 Committer: Daniel Dai <[email protected]> Committed: Wed Aug 15 15:35:26 2018 -0700 ---------------------------------------------------------------------- .../hadoop/hive/ql/security/SessionStateUserAuthenticator.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hive/blob/f3cef0d3/ql/src/java/org/apache/hadoop/hive/ql/security/SessionStateUserAuthenticator.java ---------------------------------------------------------------------- diff --git a/ql/src/java/org/apache/hadoop/hive/ql/security/SessionStateUserAuthenticator.java b/ql/src/java/org/apache/hadoop/hive/ql/security/SessionStateUserAuthenticator.java index 1ded295..226fbe0 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/security/SessionStateUserAuthenticator.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/security/SessionStateUserAuthenticator.java @@ -18,7 +18,6 @@ package org.apache.hadoop.hive.ql.security; -import java.util.ArrayList; import java.util.List; import org.apache.hadoop.conf.Configuration; @@ -32,15 +31,14 @@ import org.apache.hadoop.security.UserGroupInformation; */ public class SessionStateUserAuthenticator implements HiveAuthenticationProvider { - private final List<String> groupNames = new ArrayList<String>(); - protected Configuration conf; private SessionState sessionState; private List<String> groups; @Override public List<String> getGroupNames() { - if (groups == null) { + // In case of embedded hs2, sessionState.getUserName()=null + if (groups == null && sessionState.getUserName() != null) { groups = UserGroupInformation.createRemoteUser(sessionState.getUserName()).getGroups(); } return groups;
