错误:值更新不是org.apache.spark.sql.DataFrame的成员

时间:2019-02-05 15:33:14

标签: scala apache-spark

我有以下代码抛出如下错误。无法解决问题。

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"
                                ^

0 个答案:

没有答案