title: Hive SQL - time interval in 5 minutes
body: <p>My data is too large to analyze since it is collecting every second or so. To reduce the data, I will like to group into interval of 5 minutes. I tried converting into unix timestamp and reverting it back, but didn't work.</p>
  <p>I tried something like this</p>
  <pre><code>SELECT operation, 
  value, 
  from_unixtime(unix_timestamp(update_time)/300) as interval_5
  FORM storage
  
  </code></pre>
  <p>Original data or output</p>
  <pre><code>operation   value   update_time
  ---------- ------- --------------------
  sensor       190    2021-03-18 22:37:04
  sensor       191    2021-03-18 22:37:05
  sensor       190    2021-03-18 22:37:06
  sensor       192    2021-03-18 22:37:07
  sensor       193    2021-03-18 22:37:08
  </code></pre>
  <p>Desired output</p>
  <pre><code>operation   value   update_time
  ---------- ------- --------------------
  sensor       190    2021-03-18 22:37:04
  sensor       195    2021-03-18 22:42:04
  sensor       197    2021-03-18 22:47:04
  sensor       194    2021-03-18 22:52:04
  sensor       190    2021-03-18 22:57:04
  </code></pre>