Skip to content

Commit

Permalink
Change getSparkOrYarnConfig value order
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyum committed Mar 17, 2018
1 parent 0034a58 commit 06bb6f8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions core/src/main/scala/org/apache/spark/util/Utils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2433,12 +2433,12 @@ private[spark] object Utils extends Logging {
* if the key is not set in the Hadoop configuration.
*/
def getSparkOrYarnConfig(conf: SparkConf, key: String, default: String): String = {
val sparkValue = conf.get(key, default)
if (conf.get(SparkLauncher.SPARK_MASTER, null) == "yarn"
&& (key.startsWith("spark.hadoop.") || !key.startsWith("spark."))) {
new YarnConfiguration(SparkHadoopUtil.get.newConfiguration(conf)).get(key, sparkValue)
if (conf.contains(key)) {
conf.get(key, default)
} else if (conf.get(SparkLauncher.SPARK_MASTER, null) == "yarn") {
new YarnConfiguration(SparkHadoopUtil.get.newConfiguration(conf)).get(key, default)
} else {
sparkValue
default
}
}

Expand Down

0 comments on commit 06bb6f8

Please sign in to comment.