I have a spark cluster version 3.1.2. I have following input data
+-------+------+------------+
| name|gender| arr|
+-------+------+------------+
| James| M| [60000]|
|Michael| M| [70000, 31]|
| Robert| null|[44, 400000]|
| Maria| F|[500000, 12]|
| Jen| | null|
+-------+------+------------+
I have to remove null values from the all columns. "gender" column is StringType while "arr" column is of ArrayType. Some values are null is both columns. When I apply fillna function, values are remove from gender column but not from arr column. Have a look at output
>>> df.fillna("").show()
+-------+------+------------+
| name|gender| arr|
+-------+------+------------+
| James| M| [60000]|
|Michael| M| [70000, 31]|
| Robert| |[44, 400000]|
| Maria| F|[500000, 12]|
| Jen| | null|
+-------+------+------------+
Same happens if I use na.drop or na.fill functions. Where is the problem ? How can I remove null from arr column