Reputation: 31
We are reading a file in UTF_8 as RDD[(String,String)], Need help in converting this to RDD[String].
val textRdd = sparkSession.sparkContext.binaryFiles(filePath,12)
.mapValues(content => new String(content.toArray(), StandardCharsets.UTF_8))
Upvotes: 0
Views: 62
Reputation: 5487
You just need to extract value from tuple i.e (string, string).
val outRDD = textRdd.map(t=>t._2) // To get first value use t._1
Upvotes: 1