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

    https://github.com/apache/spark/pull/1710#discussion_r15681299
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/mllib/stat/correlation/SpearmanCorrelation.scala
 ---
    @@ -89,20 +89,17 @@ private[stat] object SpearmanCorrelation extends 
Correlation with Logging {
         val ranks: RDD[(Long, Double)] = sorted.mapPartitions { iter =>
           // add an extra element to signify the end of the list so that 
flatMap can flush the last
           // batch of duplicates
    -      val padded = iter ++
    -        Iterator[((Double, Long), Long)](((Double.NaN, -1L), -1L))
    -      var lastVal = 0.0
    -      var firstRank = 0.0
    -      val idBuffer = new ArrayBuffer[Long]()
    +      val padded = iter ++ Iterator[((Double, Long), Long)](((Double.NaN, 
-1L), -1L))
    +      val firstEntry = padded.next()
    +      var lastVal = firstEntry._1._1
    +      var firstRank = firstEntry._2.toDouble
    +      val idBuffer = new ArrayBuffer[Long]() += firstEntry._1._2
    --- End diff --
    
    `ArrayBuffer(firstEntry._1._2)`


---
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.
---

Reply via email to