0

Suppose I have a bunch of databags generated from a Pig UDF that holds several tuples of Strings. How can I pull all of them out of the databags and simple make each String its own "row" of data.

databags = FOREACH data GENERATE pigUdfThatMakesDataBags(data::someText); strings = FOREACH databags { ??? };

kk415kk
  • 1,227
  • 1
  • 14
  • 30

2 Answers2

1

Am I understand it right that you're looking for the FLATTEN?

kecso
  • 2,387
  • 2
  • 18
  • 29
1
databags = FOREACH data GENERATE pigUdfThatMakesDataBags(data::someText);
datatuples = FOREACH databags FLATTEN($0);      -- Bag to Tuples 
strings = FOREACH datatuples FLATTEN(TOBAG(*)); -- Tuples to Tokens'
DUMP strings;
nobody
  • 10,892
  • 8
  • 45
  • 63