Splitting an RDD[String,String,Double]

Hi guys,

I have an RDD[String,String,Double] of this form.

(A3AF8FFZAZYNE5,0000000078,5.0)
(AH2L9G3DQHHAJ,0000000116,4.0)

I am trying to split the RDD to get an output in the below form:

A3AF8FFZAZYNE5
0000000078
5.0
AH2L9G3DQHHAJ
0000000116
4.0

I am not able to get it into this format. Any help would be appreciated, guys.

use flatMap(_.split(",") on your RDD[String,String,Double]

val rdd3=rdd1.flatMap(_.split(",")).repartition(1).saveAsTextFile(“path”) has displayed below O/P.

A3AF8FFZAZYNE5
0000000078
5.0
AH2L9G3DQHHAJ
0000000116
4.0

Thank you for your reply, @vishwanath

When I try the same command on my RDD it is throwing an error:

error: value split is not a member of (String, String, Double)
val singleRDD = tempRDD.flatMap(_.split(",")).repartition(1)

Could you please let me know why?

@Avinash
Could you please paste full code

I have a Json file of this format.

{“reviewerID”: “A3AF8FFZAZYNE5”,
“asin”: “0000000078”,
“helpful”: [1, 1],
“reviewText”: "Conversations with God Book ",
“overall”: 5.0,
“summary”: "Impactful!
}

I am trying to filter only reviewerID, asin and overall.

val reviews = spark.read.json(“subset.json”)
reviews: org.apache.spark.sql.DataFrame = [asin: string, helpful: array … 7 more fields]

val tempRDD = reviews.map( {
| r => {
| val reviewerID = r.getAsString
| val asin = r.getAsString
| val overall = r.getAsDouble
| (reviewerID, asin, overall)
| }}).rdd
tempRDD: org.apache.spark.rdd.RDD[(String, String, Double)] = MapPartitionsRDD[7] at rdd at :27

val singleValuesRDD = tempRDD(.split(",")).repartition(1)
error: value split is not a member of (String, String, Double)
val singleValuesRDD = tempRDD.flatMap(
.split(",")).repartition(1)

This is the whole code which I have used. Thank you for help @vishwanath