FindBugs is reporting a "Null pointer dereference of ?" in the following Spark/Scala transform:
val df = Seq((10,20)).toDF
df
.transform(addCol1) // <-- Null pointer dereference of ?
def addCol1(df: DataFrame): DataFrame =
df.withColumn("col1", lit("a"))
Report:
Null pointer dereference of ? in new MyClass$...
Bug kind and pattern: NP - NP_ALWAYS_NULL
I don't understand what might be null in this case. Also, the ? may be a lead.
Does anyone have an hint?
Hope below code snippet will help.