Ammar
Ammar

Reputation: 5640

Spark getting keys from key-value RDD

If I have an RDD that has key-value pair and I want to get only the key part, what is the most efficient way of doing it?

Upvotes: 8

Views: 17959

Answers (1)

lanenok
lanenok

Reputation: 2749

It is very simple yourRDD.keys()

Similarly you can get RDD with values by youRDD.values()

For this and other RDD transformations and actions see examples here

Upvotes: 19

Related Questions