HIVE Row_Sequence achieves column auto-Growth

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.