title: autoincrement udf in hive
body: <p>I have created a udf in hive to add auto increment column in hive.  </p>
  
  <pre><code>import org.apache.hadoop.hive.ql.exec.UDF;
  
  public class AutoIncrUdf extends UDF {
      int Value;
  
      public int evaluate() {
          Value++;
          return Value;
      }
  }  
  </code></pre>
  
  <p>I have created a temporary function <code>temp</code> while using on my table as  </p>
  
  <pre><code>Select temp() from table1; 
  </code></pre>
  
  <p>it is giving all rows as: </p>
  
  <pre><code> 1
   1
   1
   1 
  </code></pre>
  
  <p>And so on. But I want it as </p>
  
  <pre><code>1
  2
  3
  4
  </code></pre>