aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Graves <tgraves@apache.org>2015-03-29 12:43:30 +0100
committerSean Owen <sowen@cloudera.com>2015-03-30 13:58:33 +0100
commitf8132ded0c89f682e13cb12ecd8aee32b417437e (patch)
treefb3fa5a63580074b12bb5410515d36278f20a417
parent1c59a4bd34a129254300fa8368c40a1e511367f0 (diff)
downloadspark-f8132ded0c89f682e13cb12ecd8aee32b417437e.tar.gz
spark-f8132ded0c89f682e13cb12ecd8aee32b417437e.tar.bz2
spark-f8132ded0c89f682e13cb12ecd8aee32b417437e.zip
[SPARK-6558] Utils.getCurrentUserName returns the full principal name instead of login name
Utils.getCurrentUserName returns UserGroupInformation.getCurrentUser().getUserName() when SPARK_USER isn't set. It should return UserGroupInformation.getCurrentUser().getShortUserName() getUserName() returns the users full principal name (ie user1CORP.COM). getShortUserName() returns just the users login name (user1). This just happens to work on YARN because the Client code sets: env("SPARK_USER") = UserGroupInformation.getCurrentUser().getShortUserName() Author: Thomas Graves <tgraves@apache.org> Closes #5229 from tgravescs/SPARK-6558 and squashes the following commits: 24830bf [Thomas Graves] Utils.getCurrentUserName returns the full principal name instead of login name
-rw-r--r--core/src/main/scala/org/apache/spark/util/Utils.scala2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/src/main/scala/org/apache/spark/util/Utils.scala b/core/src/main/scala/org/apache/spark/util/Utils.scala
index 949bc556eb..c136584b19 100644
--- a/core/src/main/scala/org/apache/spark/util/Utils.scala
+++ b/core/src/main/scala/org/apache/spark/util/Utils.scala
@@ -1998,7 +1998,7 @@ private[spark] object Utils extends Logging {
*/
def getCurrentUserName(): String = {
Option(System.getenv("SPARK_USER"))
- .getOrElse(UserGroupInformation.getCurrentUser().getUserName())
+ .getOrElse(UserGroupInformation.getCurrentUser().getShortUserName())
}
}