我有以下代码抛出如下错误。无法解决问题。
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")))
}
}
}
错误:值
update
不是org.apache.spark.sql.DataFrame的成员someDF1("Action") = "D" ^