mirror of https://github.com/apache/druid.git
Merge pull request #471 from metamx/minor-optimization
avoid using Math.abs
This commit is contained in:
commit
3d6ad1e363
|
@ -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