So my initial schema looks like this:
root
|-- database: String
|-- table: String
|-- data: struct (nullable = true)
| |-- element1: Int
| |-- element2: Char
The show()
result has one data column that's ugly with [null,2,3]
etc
What I want to do is to make the data struct into it's own dataframe so I can have the nested json's data spread out among columns but something like:
val dfNew = df.select("data")
only really gets me the same gross column when I use show()
instead of the multiple columns specified by the schema (element1, element2)
etc.
Is there a way to do this?