mirror of https://github.com/apache/kafka.git
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:
parent
1b0feb6345
commit
da35513245
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue