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

    https://github.com/apache/spark/pull/1447#discussion_r15037098
  
    --- Diff: core/src/main/scala/org/apache/spark/rdd/PairRDDFunctions.scala 
---
    @@ -216,17 +216,17 @@ class PairRDDFunctions[K, V](self: RDD[(K, V)])
     
         def reducePartition(iter: Iterator[(K, V)]): Iterator[JHashMap[K, V]] 
= {
           val map = new JHashMap[K, V]
    -      iter.foreach { case (k, v) =>
    -        val old = map.get(k)
    -        map.put(k, if (old == null) v else func(old, v))
    +      iter.foreach { pair =>
    +        val old = map.get(pair._1)
    +        map.put(pair._1, if (old == null) pair._2 else func(old, pair._2))
           }
           Iterator(map)
         }
     
         def mergeMaps(m1: JHashMap[K, V], m2: JHashMap[K, V]): JHashMap[K, V] 
= {
    -      m2.foreach { case (k, v) =>
    -        val old = m1.get(k)
    -        m1.put(k, if (old == null) v else func(old, v))
    +      m2.foreach { pair =>
    +        val old = m1.get(pair._1)
    --- End diff --
    
    again, create a variable to save the key


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

Reply via email to