Schema
root
|-- userId: string (nullable = true)
|-- languageknowList: array (nullable = true)
| |-- element: struct (containsNull = false)
| | |-- code: string (nullable = false)
| | |-- description: string (nullable = false)
| | |-- name: string (nullable = false)
In this schema there is a user with userId 0, I have to concatenate the languageknowList in userId 0 with languageknowList of all other users.
How can I do that
Example:
input data to DF
[{
"userId":1,
"languageknowList": [[10,"Hindi","Hindi"],[11,"Spanish","Spanish"]]
},
{
"userId":2,
"languageknowList": [[11,"Spanish","Spanish"]]
},
{
"userId":0,
"languageknowList": [[1,"English","English"],[2,"German","German"]]
}]
output df should be like:
[{
"userId":1,
"languageknowList": [[10,"Hindi","Hindi"],[11,"Spanish","Spanish"],[1,"English","English"],[2,"German","German"]]
},
{
"userId":2,
"languageknowList": [[11,"Spanish","Spanish"],[1,"English","English"],[2,"German","German"]]
}]