Skip to content

Instantly share code, notes, and snippets.

@mashiro
Created September 5, 2013 12:27
Show Gist options
  • Save mashiro/6449440 to your computer and use it in GitHub Desktop.
Save mashiro/6449440 to your computer and use it in GitHub Desktop.
-- data.txt
-- 10 1,2,3
-- 20 1,2
A = LOAD 'data.txt' USING PigStorage('\t') AS (key:int, values:chararray);
-- B = FOREACH A GENERATE key, FLATTEN(TOKENIZE(values, ',')) AS (value:int);
B = FOREACH A GENERATE key, FLATTEN(TOKENIZE(values, ',')) AS value;
C = FOREACH B GENERATE key, (int)value;
D = FILTER C BY value > 1;
DUMP D;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment