how to change a column type in array struct by pyspark, for example, I would like to change userid
from int to long
root
|-- id: string (nullable = true)
|-- numbers: array (nullable = true)
| |-- element: struct (containsNull = true)
|-- m1: long (nullable = true)
|-- m2: long (nullable = true)
|-- m3: struct (nullable = true)
|-- userid: integer (nullable = true)
Would have been useful if you provide a reproducible df as well.
Following you comments below see the following code.
Solution