我有以下代码试图合并两行:
import org.apache.spark.sql._
def mergeRow(row1:Row, row2:Row):(Boolean, Row)= {
var z:Array[String] = new Array[String](row1.length)
var hasDiff = false
:
:
if (hasDiff) {
(true, new Row(z))
} else {
(true, row2)
}
}
我得到了错误:
error: trait Row is abstract; cannot be instantiated
(true, new Row(z))
有人知道我该如何解决这个问题吗?谢谢!
你应该用Row.fromSeq(z)
替换new Row(z)