- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Spark-split array to separate column
- Labels:
-
Apache Spark
Created ‎07-19-2018 05:26 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
Can someone please tell me how to split array into separate column in spark dataframe.
Example:
Df:
A|B
-------
1|(a,b,c,d)
2|(e,f)
Output:
A|col1|col2|col3|col4
------------
1|a|b|c|d
2|e|F| |
Thanks
Manivel k
Created ‎07-19-2018 05:39 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please check this link and let me know if that helps:
https://stackoverflow.com/questions/39255973/split-1-column-into-3-columns-in-spark-scala
HTH
*** If you found this answer addressed your question, please take a moment to login and click the "accept" link on the answer.
Created ‎07-19-2018 05:54 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi albani,
Thanks for sharing the links, i found these threads earlier. These static one(defined for 3 elements).
I would expect more dynamic. Eg: Today i may receive 3 elements, tomorrow may be 10 elements. Code should handle it dynamically.
