【发布时间】:2016-08-14 10:02:04
【问题描述】:
我正在尝试在应用于 spark 数据帧的函数中调用 lapply。根据文档,从 Spark 2.0 开始就有可能。
wrapper = function(df){
out = df
out$len <- unlist(lapply(df$value, function(y) length(y)))
return(out)
}
# dd is Spark Data Frame with one column (value) of type raw
dapplyCollect(dd, wrapper)
返回错误:
Error in invokeJava(isStatic = FALSE, objId$id, methodName, ...): org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 37.0 failed 1 times, most recent failure: Lost task 0.0 in stage 37.0 (TID 37, localhost): org.apache.spark.SparkException: R computation failed with
Error in (function (..., deparse.level = 1, make.row.names = TRUE) :
incompatible types (from raw to logical) in subassignment type fix
以下工作正常:
wrapper(collect(dd))
但我们希望计算在节点上运行(而不是在驱动程序上)。
可能是什么问题?有一个related question,但它没有帮助。 谢谢。
【问题讨论】:
标签: sparkr