Skip to content
This repository has been archived by the owner on Sep 20, 2022. It is now read-only.

Commit

Permalink
Added documentation about rownum()
Browse files Browse the repository at this point in the history
  • Loading branch information
myui committed Feb 10, 2017
1 parent 389a9e3 commit 247e1ae
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions docs/gitbook/tips/rowid.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,23 @@
<!-- toc -->

# Rowid generator provided in Hivemall
You can use [rowid() function](https://github.com/myui/hivemall/blob/master/src/main/java/hivemall/tools/mapred/RowIdUDF.java) to generate an unique rowid in Hivemall v0.2 or later.
You can use [rowid() function](https://github.com/apache/incubator-hivemall/blob/master/core/src/main/java/hivemall/tools/mapred/RowIdUDF.java) to generate an unique rowid in Hivemall v0.2 or later.
```sql
select
rowid() as rowid, -- returns ${task_id}-${sequence_number}
rowid() as rowid, -- returns ${task_id}-${sequence_number} as string
*
from
xxx
xxx;
```

Also, [rownum()](https://github.com/apache/incubator-hivemall/blob/master/core/src/main/java/hivemall/tools/mapred/RowNumberUDF.java) is supported since Hivemall v0.5-rc.1 or later.

```sql
select
rownum() as rowid, -- returns sprintf(`%d%04d`,sequence,taskId) as long
*
from
xxx;
```

# Other Rowid generation schemes using SQL
Expand Down

0 comments on commit 247e1ae

Please sign in to comment.