Skip to content
Snippets Groups Projects
Commit d947cb97 authored by Matei Zaharia's avatar Matei Zaharia
Browse files

Fixed a bug with negative hashcodes

parent 44530c31
No related branches found
No related tags found
No related merge requests found
...@@ -84,7 +84,10 @@ extends Logging ...@@ -84,7 +84,10 @@ extends Logging
new ObjectOutputStream(fs.create(path, true)) new ObjectOutputStream(fs.create(path, true))
}).toArray }).toArray
for ((k, c) <- combiners) { for ((k, c) <- combiners) {
val bucket = k.hashCode % numOutputSplits var bucket = k.hashCode % numOutputSplits
if (bucket < 0) {
bucket += numOutputSplits
}
outputStreams(bucket).writeObject((k, c)) outputStreams(bucket).writeObject((k, c))
} }
outputStreams.foreach(_.close()) outputStreams.foreach(_.close())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment