trival fix to make hash code positive; patched by Joel Koshy; reviewed by Jun Rao

git-svn-id: https://svn.apache.org/repos/asf/incubator/kafka/trunk@1177516 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jun Rao 2011-09-30 05:44:13 +00:00
parent 1b0feb6345
commit da35513245
1 changed files with 1 additions and 1 deletions

View File

@ -24,6 +24,6 @@ private[kafka] class DefaultPartitioner[T] extends Partitioner[T] {
if(key == null)
random.nextInt(numPartitions)
else
key.hashCode % numPartitions
math.abs(key.hashCode) % numPartitions
}
}