【发布时间】:2014-11-10 19:09:08
【问题描述】:
Apache Spark 的新手,我有点困惑如何更新 GraphX 中 .mapTriplets 迭代之外的值。见下文:
def mapTripletsMethod(edgeWeights: Graph[Int, Double], stationaryDistribution: Graph[Double, Double]) = {
val tempMatrix: SparseDoubleMatrix2D = graphToSparseMatrix(edgeWeights)
stationaryDistribution.mapTriplets{ e =>
val row = e.srcId.toInt
val column = e.dstId.toInt
var cellValue = -1 * tempMatrix.get(row, column) + e.dstAttr
tempMatrix.set(row, column, cellValue) // this doesn't do anything to tempMatrix
e
}
}
我猜这是因为RDD 的设计,并且没有简单的方法可以更新tempMatrix 的值。当我运行上面的代码时,tempMatrix.set 方法什么也不做。在调试器中尝试跟踪问题是相当困难的。
有没有人有一个简单的解决方案?谢谢!
编辑
我在上面进行了更新以表明stationaryDistribution 是一个图 RDD。
【问题讨论】:
标签: multithreading scala apache-spark colt rdd