psmith
psmith

Reputation: 1813

Add ID for each row while loading using pig

Let's imagine I have a log file, but there is no date field, or any other field that could by used for sorting. The only hint is that rows in the file are already sorted (but for example I need descent sorting instead of ascent) What I would like to do, is generate an aftificial ID for each row while loading using Pig. Is there aby build-in variable that I could use? Something like RowId?

Have you got any idea?

Regards, Pawel

Upvotes: 0

Views: 150

Answers (1)

reo katoa
reo katoa

Reputation: 5801

New in Pig 0.11 is the RANK operator, which will accomplish what you need to do.

Upvotes: 2

Related Questions