Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

How to create auto increment key for a table in hive?

avatar
New Contributor
 
1 ACCEPTED SOLUTION

avatar
Expert Contributor

Use the reflect UDF to generate UUIDs.

reflect("java.util.UUID", "randomUUID")

View solution in original post

4 REPLIES 4

avatar
Expert Contributor

Use the reflect UDF to generate UUIDs.

reflect("java.util.UUID", "randomUUID")

avatar
New Contributor

Thanks siva

Note : The following syntax worked and helpful

select reflect("java.util.UUID", "randomUUID") mykey, name, .. from table_name

avatar
Explorer

When I try this I get the error:

H110 Unable to submit statement. Error while compiling statement: FAILED: SemanticException UDF reflect is not allowed [ERROR_STATUS]

avatar

How to add auto increment culumn id in hive external table where we have to read the data from hdfs, i am not going to load or insert so please give the proper solution and syntax for that.

Thanks,

Sunny kumar