Created 07-19-2018 05:26 PM
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
@Mani
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
https://stackoverflow.com/questions/39235704/split-spark-dataframe-string-column-into-multiple-colum...
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
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.