I was reading through the hadoop code and found this line in a partitioner.
(key.hashCode() & Integer.MAX_VALUE) % numReduceTasks
Why are they using the bitwise AND?
To remove the sign bit. in the case that the hashCode is a negative number.
its like Math.abs(key.hashCode())
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With