I am a beginner of PySpark. Suppose I have a Spark dataframe like this:
test_df = spark.createDataFrame(pd.DataFrame({"a":[[1,2,3], [None,2,3], [None, None, None]]}))
Now I hope to filter rows that the array DO NOT contain None value (in my case just keep the first row).
I have tried to use:
test_df.filter(array_contains(test_df.a, None))
But it does not work and throws an error:
AnalysisException: "cannot resolve 'array_contains(
a, NULL)' due to data type mismatch: Null typed values cannot be used as arguments;;\n'Filter array_contains(a#166, null)\n+- LogicalRDD [a#166], false\n
How should I filter in the correct way? Many thanks!