我想在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)
添加以下导入:
import org.apache.spark.sql.Row