I have a dataframe and I have a column which is a map in dataframe like this -
scala> df.printSchema
root
|-- A1: map (nullable = true)
| |-- key: string
| |-- value: string (valueContainsNull = true)
I need to select all the keys from dataframe as column name and values as rows.
For eg: Let say I have 2 records like this-
1. key1 -> value1, key2 -> value2, key3 -> value3 ....
2. key1 -> value11, key3 -> value13, key4 -> value14 ...
I want the output dataframe as
key1 key2 key3 key4
value1 value2 value3 null
value11 null value13 value14
How can I do this?