Package org.apache.pinot.common.utils
Class HashUtil
- java.lang.Object
-
- org.apache.pinot.common.utils.HashUtil
-
public class HashUtil extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static intMIN_FASTUTIL_HASHSET_SIZETests show that even for smaller set sizes, setting the hash size to this min value improves performance at an insignificant increase of memory footprint.
-
Method Summary
Modifier and Type Method Description static longcompute(ByteBuffer buff)static longcompute(IntBuffer buff)static intgetHashMapCapacity(int expectedSize)Returns a capacity that is sufficient to keep the map from being resized as long as it grows no larger than expectedSize and the load factor is >= its default (0.75).static intgetMinHashSetSize(int expected)Returns the min size for the fast-util hash-set given the expected size of values stored in the hash-set.static longhash64(byte[] data, int length)static longhash64(byte[] data, int length, int seed)static intmurmur2(byte[] data)Generates 32 bit murmur2 hash from byte array
-
-
-
Field Detail
-
MIN_FASTUTIL_HASHSET_SIZE
public static final int MIN_FASTUTIL_HASHSET_SIZE
Tests show that even for smaller set sizes, setting the hash size to this min value improves performance at an insignificant increase of memory footprint.- See Also:
- Constant Field Values
-
-
Method Detail
-
getMinHashSetSize
public static int getMinHashSetSize(int expected)
Returns the min size for the fast-util hash-set given the expected size of values stored in the hash-set.- Parameters:
expected- the expected/actual number of values to be stored- Returns:
- the optimal min value
-
getHashMapCapacity
public static int getHashMapCapacity(int expectedSize)
Returns a capacity that is sufficient to keep the map from being resized as long as it grows no larger than expectedSize and the load factor is >= its default (0.75).
-
compute
public static long compute(IntBuffer buff)
-
compute
public static long compute(ByteBuffer buff)
-
hash64
public static long hash64(byte[] data, int length)
-
hash64
public static long hash64(byte[] data, int length, int seed)
-
murmur2
public static int murmur2(byte[] data)
Generates 32 bit murmur2 hash from byte array- Parameters:
data- byte array to hash- Returns:
- 32 bit hash of the given array
-
-