You don't. That's what filter or the partial function version of collect are for:
val transformedRDD = yourRDD.collect { case (k, v) if k == 1 => v } On Wed, Sep 17, 2014 at 3:24 AM, Deep Pradhan <pradhandeep1...@gmail.com> wrote: > Hi, > I want to make the following changes in the RDD (create new RDD from the > existing to reflect some transformation): > In an RDD of key-value pair, I want to get the keys for which the values > are 1. > How to do this using map()? > Thank You >