Kshitij Kulshrestha
Kshitij Kulshrestha

Reputation: 2072

Convert RDD[Map[String,Double]] to RDD[(String,Double)]

I did some calculation and returned my values in a RDD containing scala map and now I want to remove this map and want to collect all keys values in a RDD.

Any help will be appreciated.

Upvotes: 0

Views: 708

Answers (1)

Kim Stebel
Kim Stebel

Reputation: 42045

You can call flatMap with the identity function to 'flatten' the structure of your RDD.

rdd.flatMap(identity)

Upvotes: 2

Related Questions