Jithesh Gopinathan
Jithesh Gopinathan

Reputation: 448

Map() function giving error in spark

I am new to the spark programming. I have come across a scenario, to map each element of an RDD to another format. So I tried to get the 2nd element of the tuple(x._2). But it is giving an error Value _2 is not a member of Array[String]

Spark map() error

Do I miss something here... Pls helppp....

Upvotes: 0

Views: 198

Answers (1)

Stephen
Stephen

Reputation: 4296

The problem is its not tuple as you expect. Its an Array[Array[String]]. You can get the second element of an array with array(1)

month1.map(x => x(1))

Upvotes: 2

Related Questions