i have following spark dataframe schema
root
|-- UserId: long (nullable = true)
|-- VisitedCountry: array (nullable = true)
| |-- element: struct (containsNull = true)
| | |-- Name: string (nullable = false
| | |-- Id: long (nullable = false)
i want to convert each VisitedCountry as seprate row within new dataframe
root
|-- UserId: long (nullable = true)
|-- CountryName: string (nullable = false)
|-- CountryId: long (nullable = false)
explodeand then put the values in the struct into their own separate columns. (and no, I'm not the one who downvoted if you were wondering).