forked from myui/hivemall
-
Notifications
You must be signed in to change notification settings - Fork 0
Adding rowid for each row
myui edited this page Dec 26, 2014
·
9 revisions
CREATE TABLE xxx
AS
SELECT
regexp_replace(reflect('java.util.UUID','randomUUID'), '-', '') as rowid,
*
FROM
..;
Another option to generate rowid is to use row_number(). However, the query execution would become too slow for large dataset because the rowid generation is executed on a single reducer.
CREATE TABLE xxx
AS
select
row_number() over () as rowid,
*
from a9atest;
You can use rowid() function to generate an unique rowid in Hivemall v0.2 or later.
select
rowid() as rowid, -- returns ${task_id}-${sequence_number}
*
from
xxx
``