I have the following dataframe, with a list column, that contains a list of lists. In some specific cases, this list contains one unique list, with contains only empty strings.
+--+---------------+
|id|list |
+--+---------------+
|1 |[[1, a],[2, b]]|
|2 |[[,]] |
And I would like to filter out this list, so that I have the following:
+--+---------------+--------------+
|id|list |result |
+--+---------------+--------------+
|1 |[[1, a],[2, b]]|[[1, a],[2, b]|
|2 |[[,]] |[] |
I have tried the following:
data_frame.withColumn("result", array_remove("list", ["",""]))
but I have the following error:
An error occurred while calling z:org.apache.spark.sql.functions.array_remove. Unsupported literal type class java.util.ArrayList [, ]
Any suggestions or ideas?