Skip to main content
Kiddo
Bronze ⭐️⭐️⭐️
September 17, 2021
Question

MD5 value of a table

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

Shifu
Gold ⭐️⭐️
Gold ⭐️⭐️
September 17, 2021
smruti
Gold ⭐️⭐️⭐️
Gold ⭐️⭐️⭐️
September 19, 2021

@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.

 

Translate