Skip to content

Instantly share code, notes, and snippets.

View botchniaque's full-sized avatar

Szymon Bochniak botchniaque

View GitHub Profile
@coderfi
coderfi / hive_spark_sql_md5_to_bigint.sql
Created March 23, 2018 18:16
HIVE/SPARK SQL convert md5 to bigint
-- 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)");