Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

what does the code do RDD.map(e => e.split(",")(1)) in spark with scala?

avatar
Rising Star

Hi,

what does the code do RDD.map(e => e.split(",")(1)) in spark with scala?

I know RDD.map(e => e.split(",")) would split a string with ',' separated. But, I don't get the (1) in the code. Could somebody give me some information on this? I would greatly appreciate your answer. Thanks!

1 ACCEPTED SOLUTION

avatar
Master Mentor

I'm not familiar with Scala but their docs are similar to Java so I would guess it would return the item at the first index of the result array.

View solution in original post

3 REPLIES 3

avatar
Master Mentor

I'm not familiar with Scala but their docs are similar to Java so I would guess it would return the item at the first index of the result array.

avatar
Rising Star

Hi Artem Ervits,

Thank you very much for your valuable time . I tried and it did exactly the same what you said. Once again Thanks!

avatar
Master Mentor

Glad to help, I learned something too about Scala, it was a mutual benefit