Advertisement
Guest User

Untitled

a guest
Feb 24th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. lines = LOAD '/user/root/pig_demo.txt' USING PigStorage() AS (line:chararray);
  2. filtered_lines = FILTER lines by $0 is not null;
  3. words = FOREACH filtered_lines GENERATE FLATTEN(TOKENIZE(line)) AS word;
  4. grouped_words = GROUP words by word;
  5. word_count = FOREACH grouped_words GENERATE group,COUNT_STAR(words);
  6. ordered_wc = ORDER word_count by $0;
  7. STORE ordered_wc INTO '/user/root/pig/wordcount' USING PigStorage(':');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement