unionAll 函数不能在 sparkR 中 运行

unionAll function can't run in sparkR

在 SparkR 中,我有一个 DataFrame data,它也包含 id。我还有一个 liste= 2 9 12 102 154 ... 1451,其中 length(liste)=3001。我想要 data 中的条目,其中 id 等于 liste。在 sparkR 中我这样做

newdata <- unionAll(filter(data, data$id == liste[1] ), filter(data, data$id == liste[2] ))
for(j in 3:10){
newdata <- unionAll(newdata, filter(data, data$id==good[j] ))
}

这10次迭代需要很长时间,大约5分钟。当我想进行所有迭代时,即 3001,sparkR 说 "error returnstatus==0 is not true"。该如何解决呢?

我还没有检查 %in% 是否在 Spark-1.5 中受支持,但总是可以通过连接进行过滤:

DF <- createDataFrame(sqlContext,
                      data.frame(id = c(1,1,2,3,3,4),
                                 value = c(1,2,3,4,5,6)))

goodID <- createDataFrame(sqlContext, data.frame(goodID = c(1,3)))

newData <- join(DF, goodID, DF$id == goodID$goodID)
newData$goodID <- NULL
collect(newData)