From ab2248587d1a761058411c9a7f39e2da13f433bd Mon Sep 17 00:00:00 2001 From: liuzhaokun Date: Tue, 8 Aug 2017 14:37:35 +0800 Subject: [PATCH 1/2] [SPARK-21662] modify the appname to [SparkSQL::localHostName] instead of [SparkSQL::lP] --- core/src/main/scala/org/apache/spark/util/Utils.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 d661293e529f9..896f04fd72a92 100644 --- a/core/src/main/scala/org/apache/spark/util/Utils.scala +++ b/core/src/main/scala/org/apache/spark/util/Utils.scala @@ -940,7 +940,7 @@ private[spark] object Utils extends Logging { * Get the local machine's hostname. */ def localHostName(): String = { - customHostname.getOrElse(localIpAddress.getHostAddress) + customHostname.getOrElse(localIpAddress.getCanonicalHostName) } /** From df1bdc0fd5833fc21544e3eabaefff6765c03911 Mon Sep 17 00:00:00 2001 From: liuzhaokun Date: Wed, 9 Aug 2017 16:36:04 +0800 Subject: [PATCH 2/2] modify the annotation --- core/src/main/scala/org/apache/spark/util/Utils.scala | 2 +- .../org/apache/spark/sql/hive/thriftserver/SparkSQLEnv.scala | 2 +- 2 files changed, 2 insertions(+), 2 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 896f04fd72a92..d661293e529f9 100644 --- a/core/src/main/scala/org/apache/spark/util/Utils.scala +++ b/core/src/main/scala/org/apache/spark/util/Utils.scala @@ -940,7 +940,7 @@ private[spark] object Utils extends Logging { * Get the local machine's hostname. */ def localHostName(): String = { - customHostname.getOrElse(localIpAddress.getCanonicalHostName) + customHostname.getOrElse(localIpAddress.getHostAddress) } /** diff --git a/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLEnv.scala b/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLEnv.scala index 01c4eb131a564..dc9c65be48af1 100644 --- a/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLEnv.scala +++ b/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLEnv.scala @@ -35,7 +35,7 @@ private[hive] object SparkSQLEnv extends Logging { def init() { if (sqlContext == null) { val sparkConf = new SparkConf(loadDefaults = true) - // If user doesn't specify the appName, we want to get [SparkSQL::localHostName] instead of + // If user doesn't specify the appName, we will get [SparkSQL::IP] instead of // the default appName [SparkSQLCLIDriver] in cli or beeline. val maybeAppName = sparkConf .getOption("spark.app.name")