ssobczak
ssobczak

Reputation: 1845

Pig: extract all values of a bag?

I want to extract all values from a bag. What I mean is:

DESCRIBE x;
x: {data: (id: long, value: long)}

y = (WHAT DO I DO HERE?)

DESCRIBE y;
y: {id: long, value: long}

I've tried the wildcard operator and project-range expressions, but they don't work

y = foreach x generate data.*;                       
ERROR 1200: Syntax error, unexpected symbol at or near '*'

y = foreach x generate data.($0 ..);                       
ERROR 1200: mismatched input '..' expecting RIGHT_PAREN

How do I...?

Upvotes: 0

Views: 594

Answers (1)

Sivasakthi Jayaraman
Sivasakthi Jayaraman

Reputation: 4724

Try to use FLATTEN operator.

FOREACH X GENERATE FLATTEN(data);

If this FLATTEN doesn't work, paste your input values, i will help you.

Upvotes: 1

Related Questions