title: How to assign a unique Id to the dataset row based on some column value in Spark
body: <p>I am trying to assign a unique Id to the row of the dataset based on some column value.
  For eg consider that we have a dataset as follows:</p>
  
  <pre><code>State Country Person
  MH    IN      ABC
  AP    IN      XYZ
  J&amp;K   IN      XYZ
  MH    IN      PQR 
  </code></pre>
  
  <p>Now i want to assign a unique Id based on the State Column Value,if the column value repeats furhter the same Id should be populated.
  Output should be as follows:</p>
  
  <pre><code>State Country Person Unique_ID
  MH    IN      ABC     1
  AP    IN      XYZ     2 
  J&amp;K   IN      XYZ     3
  MH    IN      PQR     1
  </code></pre>
  
  <p>How to solve this problem using Spark Java Programming.
  Any help would be appreciated.</p>