【发布时间】:2016-12-08 19:57:20
【问题描述】:
当我使用 Spark2.0 Dataset 和 DataFrame 读取数据时,代码是:
def func(docs: DataFrame): RDD[(String, String)] = {
docs.select("id", "title").map{
case Row(id: String, title: String) => (id, title)
}}
但是编译错误是
missing parameter type for expanded function The argument types of an anonymous function must be fully known. (SLS 8.5) Expected type was: ?
我也试试这个方法
def func(docs: DataFrame): RDD[(String, String)] = {
docs.select("id", "title").map{val => val match{
case Row(id: String, title: String) => (id, title)
}}} 但这是行不通的! 'val' 的错误是:
◾missing parameter type
我怎么能喜欢这个!
【问题讨论】:
标签: scala apache-spark