case class ACase( name: String)
case class BCase( name: String, num: Int)
我有ACase的数据集,并希望通过添加列将其更改为BCase类型。这是我的尝试。
def makeBCase( aCase: ACase, num: Int) : BCase = {
BCase( aCase.name, num)
}
def change( aDS: Dataset[ACase]): Dataset[BCase] = {
val bDS = aDS.map { a =>
makeBCase( a, 123)
}
....
bDS // error - type mismatch; required : org.apache.spark.sql.Dataset[ACase]
}
如何更改其类型?