map
Return a new RDD by applying a function to each element of this RDD.
Let us look at the legend and overview of the visual RDD Api.
val x = sc.parallelize(Array("b", "a", "c"))
val y = x.map(z => (z,1))
x: org.apache.spark.rdd.RDD[String] = ParallelCollectionRDD[176] at parallelize at <console>:36
y: org.apache.spark.rdd.RDD[(String, Int)] = MapPartitionsRDD[177] at map at <console>:37
println(x.collect().mkString(","))
println(y.collect().mkString(","))
b,a,c
(b,1),(a,1),(c,1)