Github user Fokko commented on a diff in the pull request:
https://github.com/apache/spark/pull/10839#discussion_r56143177
--- Diff:
mllib/src/main/scala/org/apache/spark/mllib/linalg/distributed/BlockMatrix.scala
---
@@ -268,8 +268,26 @@ class BlockMatrix @Since("1.3.0") (
def toIndexedRowMatrix(): IndexedRowMatrix = {
require(numCols() < Int.MaxValue, "The number of columns must be
within the integer range. " +
s"numCols: ${numCols()}")
- // TODO: This implementation may be optimized
- toCoordinateMatrix().toIndexedRowMatrix()
+
+ val rows = blocks.map(block => (block._1._1, (block._1._2, block._2)))
+ .groupByKey()
--- End diff --
Thanks @mengxr, that's a very good idea. I'll update the code and push it
within 24 hours. Cheers!
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]