I have the following code which throws an error as below. Unable to figure out the problem.
val someDF = Seq((8, "bat"),(64, "mouse"),(-27, "horse")).toDF("number", "word")
val someDF2 = Seq((8, "bat"),(64, "cat"),(-45, "tiger")).toDF("number", "word")
val someDF1= someDF.withColumn("Action",lit("A"))
val max_rows= someDF1.count().toInt
for(i <- 0 to max_rows) {
if (someDF1("number") === someDF2("number")) {
if (someDF1("word") === someDF2("word")) {
someDF1("Action") = "D"
} else {
someDF1.unionAll(someDF2.select($"*", lit("D")))
}
}
}
error: value
update
is not a member of org.apache.spark.sql.DataFramesomeDF1("Action") = "D" ^