I'm working with a dataframe df looks like:
root
|-- array(data1, data2, data3, data4): array (nullable = false)
| |-- element: array (containsNull = true)
| | |-- element: struct (containsNull = true)
| | | |-- k: struct (nullable = false)
| | | | |-- v: string (nullable = true)
| | | | |-- t: string (nullable = false)
| | | |-- resourcename: string (nullable = true)
| | | |-- criticity: string (nullable = true)
| | | |-- v: string (nullable = true)
| | | |-- vn: double (nullable = true)
as described in df.show() in column "data" type array contains four array "data1" ,"data2", "data3","data4" have the same schema and type of data, I get this dataframe after
df.withcolumn("Column1",array(col("data1"),col("data2")
,col("data3"),col("data4"))
I want to get new dataframe that contain all element of "data1" ,"data2", "data3" and "data4" in the same array. the new schema must be:
|-- data: array (nullable = true)
| |-- element: struct (containsNull = true)
| | |-- criticity: string (nullable = true)
| | |-- k: struct (nullable = true)
| | | |-- t: string (nullable = true)
| | | |-- v: string (nullable = true)
| | |-- resourcename: string (nullable = true)
| | |-- v: string (nullable = true)
| | |-- vn: double (nullable = true)