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))
You just need to extract value from tuple ie (string, string).
val outRDD = textRdd.map(t=>t._2) // To get first value use t._1
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.