I am new to Scala/Spark. I would like to convert List of values into Separate rows ONLY USING RDD ( no dataframes). Appreciate if any one can help me with this.
Input :
List( ("A",List(10643, 10692)), ("B",List(10308)),("C",List(1000,2000)) )
Expected Output:
A 10643
A 10692
B 10308
C 1000
C 2000
I am able to do it separately, but not together.
This is what I tried
val Input = sc.makeRDD(List( ("A",List(10643, 10692)), ("B",List(10308)),("C",List(1000,2000)) ))
Input.map(value=>value._1).collect().foreach(println)<
A
B
C
Input.map(value=>value._2).flatMap(x=>x).collect().foreach(println)<br>
10643
10692
10308
1000
2000