MURMURHASH
Description
The murmurhash3_32
and murmurhash3_64
functions use the MurmurHash3 algorithm to compute the hash value of a given expression. MurmurHash3 is a non-cryptographic hash function suitable for hash computations in distributed systems, offering good distribution and performance.
Parameter Description
expr
: Basic data type, can be a string, integer, float, etc.
Return Results
murmurhash3_32
: Returns an integer (int) representing the 32-bit hash value.murmurhash3_64
: Returns a long integer (bigint) representing the 64-bit hash value.
Example
- Compute the 32-bit hash value of a string:
- Calculate the 64-bit hash value of a string:
- Calculate and compare the hash values of different strings:
- Calculate the hash value of a numeric type:
Through the above example, you can see how to use the MURMURHASH hash function to compute data of different types. These functions are very useful in scenarios such as data distribution and load balancing, and can help you quickly generate hash values for data.