title: Rank/ group in hive
body: <p>I have the first three columns from the screenshot arranged by record time.
  I want to give the same range to the group until the occurrence of area 'CDEF'. Can you please suggest, how can I achieve this result in hive.</p>
  
  <p><a href="https://i.stack.imgur.com/mTrQz.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mTrQz.jpg" alt="enter image description here"></a></p>
  
  <pre><code>CREATE TABLE TEST (RECORD_DATE STRING, AREA STRING, REASON STRING);
  
  INSERT INTO TEST (RECORD_DATE, AREA, REASON)
  VALUES ('10/11/2017','A','a'), 
  ('10/12/2017','A','a'), 
  ('10/13/2017','B','b'), 
  ('10/14/2017','CDEF','A:B'), 
  ('10/15/2017','E','e') ,
  ('10/16/2017','F','f'),
  ('10/17/2017','CDEF','E:F');
  </code></pre>
  
  <p>Thanks.</p>