Ajay
Ajay

Reputation: 795

Pig - Flatten data bags

I have a below data in apache pig

({(ABC,123,XYZ,{(1,2,3),(4,5,6)},QWE)})

and I want to extract specific fields, like my intended output will be

ABC, 123, 1, 2, 3
ABC, 123, 4, 5, 6

How we can do this using pig?

Upvotes: 1

Views: 428

Answers (1)

Ajay
Ajay

Reputation: 795

I completed it myself with little bit of reading

out = foreach a generate FLATTEN($0);

out1 = foreach out generate $0, $1, flatten($3);

Upvotes: 1

Related Questions