0
這是我的函數:爲什麼foreach操作符在使用Dataset時會失敗並出現NullPointerException?
def TestForeach(dataFrame: DataFrame)={
dataFrame.select("user_id").dropDuplicates().foreach(row =>{
dataFrame.filter("user_id == "+row.getString(0))
})
}
我得到這個錯誤:
ERROR Executor: Exception in task 2.0 in stage 4.0 (TID 16)
java.lang.NullPointerException
at org.apache.spark.sql.Dataset.filter(Dataset.scala:1318)
如何用相同的USER_ID得到Dataframes?
您能否包括該問題的例外情況?這將使它更完整。謝謝! –