Created
March 23, 2018 18:16
-
-
Save coderfi/93e1b8f6e7210504b6ea3381c5e1e902 to your computer and use it in GitHub Desktop.
HIVE/SPARK SQL convert md5 to bigint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- takes the leftmost 16 hex-characters of the md5 hash of foo, converts it to base-10, and casts it to a 64-bit number | |
-- Note: this decreases the possible space of hashes! | |
SELECT CAST(conv(substring(md5("foo"), 0, 16), 16, 10) AS BIGINT)"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment