Skip to content

Commit aa8f086

Browse files
author
Burak Yavuz
committed
[SPARK-3974] Additional comments added
1 parent f378e16 commit aa8f086

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

mllib/src/main/scala/org/apache/spark/mllib/linalg/distributed/BlockMatrix.scala

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import breeze.linalg.{DenseMatrix => BDM}
2222
import org.apache.spark._
2323
import org.apache.spark.mllib.linalg.DenseMatrix
2424
import org.apache.spark.rdd.RDD
25-
import org.apache.spark.SparkContext._
2625
import org.apache.spark.storage.StorageLevel
2726
import org.apache.spark.util.Utils
2827

@@ -218,8 +217,8 @@ class BlockMatrix(
218217
(xDim, yDim)
219218
}
220219

220+
/* Calculates the information for each block and collects it on the driver */
221221
private def calculateBlockInfo(): Unit = {
222-
223222
// collect may cause akka frameSize errors
224223
val blockStartRowColsParts = matrixRDD.mapPartitionsWithIndex { case (partId, iter) =>
225224
iter.map { case (id, block) =>
@@ -274,6 +273,7 @@ class BlockMatrix(
274273
this
275274
}
276275

276+
/* Add a key to the underlying rdd for partitioning and joins. */
277277
private def keyBy(part: BlockMatrixPartitioner = partitioner): RDD[(Int, BlockPartition)] = {
278278
rdd.map { block =>
279279
part match {
@@ -285,6 +285,12 @@ class BlockMatrix(
285285
}
286286
}
287287

288+
/**
289+
* Repartition the BlockMatrix using a different partitioner.
290+
*
291+
* @param part The partitioner to partition by
292+
* @return The repartitioned BlockMatrix
293+
*/
288294
def repartition(part: BlockMatrixPartitioner = partitioner): DistributedMatrix = {
289295
matrixRDD = keyBy(part)
290296
this

0 commit comments

Comments
 (0)