I have a DataFrame with the following schema
root
|-- col_a: string (nullable = false)
|-- col_b: string (nullable = false)
|-- col_c_a: string (nullable = false)
|-- col_c_b: string (nullable = false)
|-- col_d: string (nullable = false)
|-- col_e: string (nullable = false)
|-- col_f: string (nullable = false)
now I want to convert the Schema for this data frame to something like this.
root
|-- col_a: string (nullable = false)
|-- col_b: string (nullable = false)
|-- col_c: struct (nullable = false)
|-- col_c_a: string (nullable = false)
|-- col_c_b: string (nullable = false)
|-- col_d: string (nullable = false)
|-- col_e: string (nullable = false)
|-- col_f: string (nullable = false)
I can able to do this with the help of map
transformation by explicitly fetching the value of each column from row
type but this is very complex process and does not look good So,
is there any way I can achieve this?
Thanks