Skip to content

Commit e6c3f74

Browse files
watermenyhuai
authored andcommitted
[SPARK-8650] [SQL] Use the user-specified app name priority in SparkSQLCLIDriver or HiveThriftServer2
When run `./bin/spark-sql --name query1.sql` [Before] ![before](https://cloud.githubusercontent.com/assets/1400819/8370336/fa20b75a-1bf8-11e5-9171-040049a53240.png) [After] ![after](https://cloud.githubusercontent.com/assets/1400819/8370189/dcc35cb4-1bf6-11e5-8796-a0694140bffb.png) Author: Yadong Qi <qiyadong2010@gmail.com> Closes apache#7030 from watermen/SPARK-8650 and squashes the following commits: 51b5134 [Yadong Qi] Improve code and add comment. e3d7647 [Yadong Qi] use spark.app.name priority.
1 parent f79410c commit e6c3f74

File tree

1 file changed

+6
-1
lines changed
  • sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver

1 file changed

+6
-1
lines changed

sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLEnv.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,14 @@ private[hive] object SparkSQLEnv extends Logging {
3838
val sparkConf = new SparkConf(loadDefaults = true)
3939
val maybeSerializer = sparkConf.getOption("spark.serializer")
4040
val maybeKryoReferenceTracking = sparkConf.getOption("spark.kryo.referenceTracking")
41+
// If user doesn't specify the appName, we want to get [SparkSQL::localHostName] instead of
42+
// the default appName [SparkSQLCLIDriver] in cli or beeline.
43+
val maybeAppName = sparkConf
44+
.getOption("spark.app.name")
45+
.filterNot(_ == classOf[SparkSQLCLIDriver].getName)
4146

4247
sparkConf
43-
.setAppName(s"SparkSQL::${Utils.localHostName()}")
48+
.setAppName(maybeAppName.getOrElse(s"SparkSQL::${Utils.localHostName()}"))
4449
.set(
4550
"spark.serializer",
4651
maybeSerializer.getOrElse("org.apache.spark.serializer.KryoSerializer"))

0 commit comments

Comments
 (0)