Scala spark数据帧爆炸函数错误
我想在DF上使用explode函数,我只需编写与文档类似的代码:Scala spark数据帧爆炸函数错误,scala,apache-spark,apache-spark-sql,Scala,Apache Spark,Apache Spark Sql,我想在DF上使用explode函数,我只需编写与文档类似的代码: 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 |--
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