0
val counts = parsed.mapPartitions(iter => {
iter.flatMap(point => {
println("points"+point)
point.indices.map(i => i,point(i)))
})
}).countByValue()
val count = parsed.mapPartitions(iter => {
iter.flatMap(point => {
println("pointsssss" + point.deep)
point.indices.map(i => (i, point(i)))
})
}).countByValue()
當我執行count.foreach(println)
時,我也從counts
得到輸出。我怎樣才能避免這個問題?我們如何避免MapPartition相關的問題?
這不完全清楚你的問題是什麼,也許你可以編輯你的問題? –
無關:您可以使用'point.zipWithIndex.map(_。swap)'而不是'point.indices.map(i =>(i,point(i)))''。 「 –
」也從計數中脫身。「目前還不清楚你的意思。請說明 –