我在dataframe中使用了UDF函数。喜欢
def manhattanUDF(firstPoint:linalg.Vector) = udf((features: linalg.Vector) => {
firstPoint.toArray.zip(features.toArray).foldLeft(0.0) { case (sum, (v1, v2)) => {
sum + Math.abs(v1 - v2)
}}
})我不知道如何在spark中使用UDTF?请给我举个例子。
发布于 2018-08-18 22:26:49
explode和posexplode函数是UDTF函数,DataFrame接口支持这些函数。但是在Spark中没有UDTF的自定义实现。
https://stackoverflow.com/questions/51907793
复制相似问题