Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

The Hash Function over different values gives same reesults.What is the logic behind hashing function and how to get unique results to unique values.

avatar

select hash ('9SH305EJ5'); OK -339500666

select hash ('9SH305EIT'); OK -339500666

1 ACCEPTED SOLUTION

avatar
Rising Star
hide-solution

This problem has been solved!

Want to get a detailed solution you have to login/registered on the community

Register/Login
3 REPLIES 3

avatar
Rising Star
hide-solution

This problem has been solved!

Want to get a detailed solution you have to login/registered on the community

Register/Login

avatar
Rising Star

@Amol Kulkarni - does that answer your question? Solved?

avatar

@Amol Kulkarni

Yes that's a known one. Hash function in hive functions similar to hash algorithm or hash sort logic in data structures.

Like modulo of odd number by 2 is always 1. The same way the two values provided by you results in having same hash value. In order to generate unique values make use of md5() function in hive to generate unique values. However I suggest not to this logic for generation of primary key for a table as the values out of md5() will be a total mess.