编程语言
首页 > 编程语言> > Spark 源码系列 - SparkConf本质

Spark 源码系列 - SparkConf本质

作者:互联网

目录

结论

SparkConf设置的key / value 保存在SparkConf名为settings的变量中,该变量类型为ConcurrentHashMap

属性 SparkConf提供的封装方法
spark.master setMaster
spark.app.name setAppName
spark.default.parallelism

代码

val conf = new SparkConf()
conf.setAppName("my-spark-01")
conf.setMaster("local")
conf.set("spark.default.parallelism", "3")

SparkConf -> setAppName

  def setAppName(name: String): SparkConf = {
    set("spark.app.name", name)
  }

SparkConf -> set 重载方法(两个参数)

  def set(key: String, value: String): SparkConf = {
    set(key, value, false)
  }

SparkConf

  private val settings = new ConcurrentHashMap[String, String]()
  ...
  private[spark] def set(key: String, value: String, silent: Boolean): SparkConf = {
    ...
    settings.put(key, value)
    this
  }

标签:set,String,value,源码,key,spark,SparkConf,Spark
来源: https://www.cnblogs.com/abc608088/p/16218935.html