Merge pull request #471 from metamx/minor-optimization

avoid using Math.abs
This commit is contained in:
fjy 2014-04-08 12:23:41 -06:00
commit 3d6ad1e363
1 changed files with 1 additions and 5 deletions

View File

@ -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)