我想在DF上使用爆炸功能,我只需编写类似文档的代码:
case class Url(url:String)
val temp3 = temp2.explode($"urls"){
case Row(urls:Array[String]) => urls.map(Url(_))
}
然而,它出来了:
error: not found: value Row
DF temp2就像:
temp2.printSchema()
root
|-- userid: string (nullable = true)
|-- urls: array (nullable = true)
| |-- element: string (containsNull = true)
答案 0 :(得分:14)
添加以下导入:
import org.apache.spark.sql.Row