0
我有下面的代码,一般来说映射函数是一个高阶函数,它在其参数中使用一个函数并使用该函数计算元素。 但是在这种情况下,map没有使用Map类型的函数。无法理解map函数的工作方式?RDD映射函数的工作方式不同
Spark context available as sc (master = yarn-client, app id = application_1473775536920_2711).
SQL context available as sqlContext.
scala> val pws = Map("Apache Spark" -> "http://spark.apache.org/", "Scala" -> "http://www.scala-lang.org/")
pws: scala.collection.immutable.Map[String,String] = Map(Apache Spark -> http://spark.apache.org/, Scala -> http://www.scala-lang.org/)
scala> val websites = sc.parallelize(Seq("Apache Spark", "Scala")).map(pws).collect
16/09/23 02:50:15 WARN util.ClosureCleaner: Expected a closure; got scala.collection.immutable.Map$Map2
[Stage 0:> (0 + 0)/2]16/09/23 02:50:31 WARN cluster.YarnScheduler: Initial job has not accepted any resources; check your cluster UI to ensure that workers are registered and have sufficient resources
websites: Array[String] = Array(http://spark.apache.org/, http://www.scala-lang.org/)