Github user andrewor14 commented on a diff in the pull request:
https://github.com/apache/spark/pull/931#discussion_r13878347
--- Diff:
core/src/main/scala/org/apache/spark/util/collection/ExternalAppendOnlyMap.scala
---
@@ -292,14 +296,13 @@ class ExternalAppendOnlyMap[K, V, C](
}
// Select a key from the StreamBuffer that holds the lowest key hash
val minBuffer = mergeHeap.dequeue()
- val (minPairs, minHash) = (minBuffer.pairs, minBuffer.minKeyHash)
+ val minPairs = minBuffer.pairs
var (minKey, minCombiner) = minPairs.remove(0)
- assert(minKey.hashCode() == minHash)
// For all other streams that may have this key (i.e. have the same
minimum key hash),
// merge in the corresponding value (if any) from that stream
val mergedBuffers = ArrayBuffer[StreamBuffer](minBuffer)
- while (mergeHeap.length > 0 && mergeHeap.head.minKeyHash == minHash)
{
+ while (mergeHeap.length > 0 &&
comparator.compare(mergeHeap.head.pairs.head, (minKey, minCombiner)) == 0) {
--- End diff --
minor: I would probably add a method in `StreamBuffer` called `minPair`, so
you can just do `mergeHeap.head.minPair`. Then I would declare a val a few
lines above
```
val minPair = minPairs.remove(0)
var (minKey, minCombiner) = minPair
...
```
so this line fits under 100 char and is more readable.
---
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.
---