Given a sorted RDD[String]
, how can I save it to file with a header?
val header: String = "header row"
val foo: RDD[(Int, String)] = ???
foo.coalesce(1).sortByKey().saveAsTextFile("//some/path")
This should save the data in order (I believe). How can I inject the header in the top line?