0
以下のコードがあります。一般にマップ関数は、引数に関数を取り、関数を使用して要素を評価する上位関数です。 しかし、この場合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/)