Github user MLnick commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17742#discussion_r113761692
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/mllib/recommendation/MatrixFactorizationModel.scala
 ---
    @@ -277,39 +277,38 @@ object MatrixFactorizationModel extends 
Loader[MatrixFactorizationModel] {
           num: Int): RDD[(Int, Array[(Int, Double)])] = {
         val srcBlocks = blockify(rank, srcFeatures)
         val dstBlocks = blockify(rank, dstFeatures)
    -    val ratings = srcBlocks.cartesian(dstBlocks).flatMap {
    -      case (users, items) =>
    -      val m = users.size
    -      val n = math.min(items.size, num)
    +    val ratings = srcBlocks.cartesian(dstBlocks).flatMap { case (srcIter, 
dstIter) =>
    +      val m = srcIter.size
    +      val n = math.min(dstIter.size, num)
           val output = new Array[(Int, (Int, Double))](m * n)
           var j = 0
    -      users.foreach (user => {
    +      srcIter.foreach { case (srcId, srcFactor) =>
               def order(a: (Int, Double)) = a._2
               val pq: BoundedPriorityQueue[(Int, Double)] =
    --- End diff --
    
    We could remove the type sig from the `val` definition here to make it fit 
on one line


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to