HIVE Row_Sequence achieves column auto-Growth
Package org. rowsequence;
Import org.apache.Hadoop.hive.ql.exe c. Description;
Import org.apache.hadoop.hive.ql.exe c. UDF;
Import org. apache. hadoop. hive. ql. udf. UDFType;
Import org. apache. hadoop. io. LongWritable;
/**
* UDFRowSequence.
*/
@ Description (name = "row_sequence ",
Value = "_ FUNC _ ()-Returns a generated row sequence number starting from 1 ")
@ UDFType (deterministic = false)
Public class RowSequence extends UDF {
Private LongWritable result = new LongWritable ();
Public RowSequence (){
Result. set (0 );
}
Public LongWritable evaluate (){
Result. set (result. get () + 1 );
Return result;
}
}
Add jar/home/hadoop/hive_study/hive_udf/hive_udf.jar
Create temporary function row_sequence as 'org. rowsequence. RowSequence ';
Hive details: click here
Hive: click here
Hadoop cluster-based Hive Installation
Differences between Hive internal tables and external tables
Hadoop + Hive + Map + reduce cluster installation and deployment
Install in Hive local standalone Mode
WordCount word statistics for Hive Learning