diff options
author | Joseph E. Gonzalez <joseph.e.gonzalez@gmail.com> | 2014-05-11 18:33:46 -0700 |
---|---|---|
committer | Matei Zaharia <matei@databricks.com> | 2014-05-11 18:33:46 -0700 |
commit | f938a155b2a9c126b292d5403aca31de83d5105a (patch) | |
tree | 58cd123d34694923220ec0a67c0576496bd1b097 /graphx/src | |
parent | 05c9aa9eb1b7f13cd40bbca23e6bc7e1d20e91cd (diff) | |
download | spark-f938a155b2a9c126b292d5403aca31de83d5105a.tar.gz spark-f938a155b2a9c126b292d5403aca31de83d5105a.tar.bz2 spark-f938a155b2a9c126b292d5403aca31de83d5105a.zip |
Fix error in 2d Graph Partitioner
Their was a minor bug in which negative partition ids could be generated when constructing a 2D partitioning of a graph. This could lead to an inefficient 2D partition for large vertex id values.
Author: Joseph E. Gonzalez <joseph.e.gonzalez@gmail.com>
Closes #709 from jegonzal/fix_2d_partitioning and squashes the following commits:
937c562 [Joseph E. Gonzalez] fixing bug in 2d partitioning algorithm where negative partition ids could be generated.
Diffstat (limited to 'graphx/src')
-rw-r--r-- | graphx/src/main/scala/org/apache/spark/graphx/PartitionStrategy.scala | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/graphx/src/main/scala/org/apache/spark/graphx/PartitionStrategy.scala b/graphx/src/main/scala/org/apache/spark/graphx/PartitionStrategy.scala index 0470d74cf9..1526ccef06 100644 --- a/graphx/src/main/scala/org/apache/spark/graphx/PartitionStrategy.scala +++ b/graphx/src/main/scala/org/apache/spark/graphx/PartitionStrategy.scala @@ -78,8 +78,8 @@ object PartitionStrategy { override def getPartition(src: VertexId, dst: VertexId, numParts: PartitionID): PartitionID = { val ceilSqrtNumParts: PartitionID = math.ceil(math.sqrt(numParts)).toInt val mixingPrime: VertexId = 1125899906842597L - val col: PartitionID = ((math.abs(src) * mixingPrime) % ceilSqrtNumParts).toInt - val row: PartitionID = ((math.abs(dst) * mixingPrime) % ceilSqrtNumParts).toInt + val col: PartitionID = (math.abs(src * mixingPrime) % ceilSqrtNumParts).toInt + val row: PartitionID = (math.abs(dst * mixingPrime) % ceilSqrtNumParts).toInt (col * ceilSqrtNumParts + row) % numParts } } |