title: Calculated column in Hive
body: <p>I am having this table and I want to make the calculated column form the far right.</p>
  
  <p><img src="https://i.stack.imgur.com/dglH5.jpg" alt="Sample Table"></p>
  
  <p>My logic is the following:</p>
  
  <pre><code>For all IDs 
     For all rows 
       IF (delta &lt;= 2 OR delta = NULL) { "Observation " + counter' }
       ELSE { counter +1; "Observation " + counter; }
     reset counter to 1
  </code></pre>
  
  <p>But I can translate it in SQL</p>