title: How to md5 an entire row in Hive?
body: <p>Using Hive, I want to hash an entire row in the query.</p>
  
  <p>I tried the following (don't mind the ${xxx}, query is built from a bash script):</p>
  
  <pre><code>    SELECT md5(*) FROM ${DATABASE_NAME_SUFFIXE}.${DATABASE_PREFIXE}_${TABLE_NAME} WHERE 
  ${TABLE_DATE_FIELD} &lt;= '${LIMIT_DATE}' ORDER BY ${CREATION_DATE_FIELD} DESC LIMIT 1
  </code></pre>
  
  <p>This returns the following error:</p>
  
  <blockquote>
    <p>Line 1:7 Wrong arguments 'md5': No matching method for class
    org.apache.hadoop.hive.ql.udf.UDFMd5 with (bigint, int, varchar(128),
    timestamp, timestamp, varchar(64), varchar(64), varchar(64), int,
    bigint, int, varchar(50), varchar(255), bigint, timestamp, timestamp,
    varchar(64), bigint, timestamp, timestamp, varchar(64), int, int,
    char(38), varchar(40), varchar(1)). Possible choices: <em>FUNC</em>(binary) 
    <em>FUNC</em>(string)</p>
  </blockquote>
  
  <p>If I understand correctly from the error and from the documentation of md5 function, I need to pass binary or string. How can I achieve that ?</p>
  
  <p>Edit: also tried:</p>
  
  <pre><code>SELECT md5(SELECT * FROM ${DATABASE_NAME_SUFFIXE}.${DATABASE_PREFIXE}_${TABLE_NAME} WHERE ${TABLE_DATE_FIELD} &lt;= '${LIMIT_DATE}' ORDER BY ${CREATION_DATE_FIELD} DESC LIMIT 1) 
  </code></pre>
  
  <p>which returns </p>
  
  <blockquote>
    <p>cannot recognize input near 'SELECT' '*' 'FROM' in function
    specification</p>
  </blockquote>