mirror of https://github.com/apache/druid.git
avoid using Math.abs
review comment on - c6f5311
To avoid overflow issues and unnecessary calls to Math.abs.
This commit is contained in:
parent
f726e52e3b
commit
2c8682a1b6
|
@ -51,11 +51,7 @@ public class HashBasedNumberedShardSpec extends NumberedShardSpec
|
|||
@Override
|
||||
public boolean isInChunk(InputRow inputRow)
|
||||
{
|
||||
int hash = Math.abs(hash(inputRow));
|
||||
if (hash == Integer.MIN_VALUE) {
|
||||
hash = 0;
|
||||
}
|
||||
return hash % getPartitions() == getPartitionNum();
|
||||
return (((long) hash(inputRow)) - getPartitionNum()) % getPartitions() == 0;
|
||||
}
|
||||
|
||||
protected int hash(InputRow inputRow)
|
||||
|
|
Loading…
Reference in New Issue