Pradeep Yadav
Pradeep Yadav

Reputation: 15

Combing Multiple RDD's in scala

I have 4 data of type RDD[Double,Double]. I want to join them together and want output of type RDD[Double, (Double,Double,Double,Double)] but using join function I'm getting output as RDD[Double, (((Double,Double),Double),Double)]. Here just want to clearify that first value in each data is same.

Upvotes: 0

Views: 134

Answers (1)

Jean Logeart
Jean Logeart

Reputation: 53869

Simply map the values to the expected type:

val original: RDD[Double, (((Double,Double),Double),Double)] = // ...
val res: RDD[Double, (Double,Double,Double,Double)] = 
  original.mapValues { case (((d1, d2), d3), d4) => (d1, d2, d3, d4) }

Upvotes: 2

Related Questions