I have DataFrame with following schema:
|-- data: struct (nullable = true)
| |-- asin: string (nullable = true)
| |-- customerId: long (nullable = true)
| |-- eventTime: long (nullable = true)
| |-- marketplaceId: long (nullable = true)
| |-- rating: long (nullable = true)
| |-- region: string (nullable = true)
| |-- type: string (nullable = true)
|-- uploadedDate: long (nullable = true)
I want to explode the struct such that all elements like asin, customerId, eventTime become the columns in DataFrame. I tried explode function but it works on Array not on struct type. Is it possible to convert the able data frame to below dataframe:
|-- asin: string (nullable = true)
|-- customerId: long (nullable = true)
|-- eventTime: long (nullable = true)
|-- marketplaceId: long (nullable = true)
|-- rating: long (nullable = true)
|-- region: string (nullable = true)
|-- type: string (nullable = true)
|-- uploadedDate: long (nullable = true)