kee
kee

Reputation: 11629

How to read grouped output and break?

I have a pig output file whose raw data looks likes this (2 fields):

(45578713,45578728,)    8139

The first field is a group field from previous pig job (which I can't change).

Now I need to read this and I want to break the first field - (45578713,45578728,) - into individual numbers like the following (so total 3 fields)

45578713        45578728        8139

How can I do this? I tried to use Pig streaming but I feel like there must be something I can do from Pig directly.

Upvotes: 0

Views: 40

Answers (1)

jaguarpaw
jaguarpaw

Reputation: 122

This should help you.

m = FOREACH g GENERATE FLATTEN(group), number;

Take a look at FLATTEN operator.

Upvotes: 1

Related Questions