I'm attempting to print the contents of a collection to the Spark console.
I have a type:
linesWithSessionId: org.apache.spark.rdd.RDD[String] = FilteredRDD
scala> linesWithSessionId.map(line => println(line))
res1: org.apache.spark.rdd.RDD[Unit] = MappedRDD at map at :19
map function is a transformation, which means that Spark will not actually evaluate your RDD until you run an action on it.
To print it, you can use
foreach (which is an action):
To write it to disk you can use one of the
saveAs... functions (still actions) from the RDD API