Support Questions

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

MD5 value of a table

avatar
New Contributor

How can we get 1 MD5 value for a hive table? Do not need a MD5 value for each record in the table.  Is there a way to query the MD5() at a table level. Thanks

2 REPLIES 2

avatar
Expert Contributor

avatar
Master Collaborator

@Kiddo you either need to get the md5 of all the records or  you could collect it for the concatenated form of all the column names in a table.

 

e.g.

select md5(concat(col1,col2)) from table1;

 

or.

select md5(concat(*)) from (SELECT collect_list(column_name) as col_name from information_schema.columns where table_schema='db1' and
table_name='table1')e;

 

Hope this answers your question.