#1289

mamthakulal
Participant

Q: Word Size

Step 1:

w = load ‘/words’ as (wd:chararray);
dump w;
(Hi how are you? I am Fine)
(Where are you? I am at Prwatech class)
(Are you learning Hadoop? Yes I am.)

Step 2:

wrdgrp = group w by SIZE(wD);
dump wrdgrp;

result:
(25,{(Hi how are you? I am Fine)})
(34,{(Are you learning Hadoop? Yes I am.)})
(37,{(Where are you? I am at Prwatech class)})

Step 3:
wrdsizec = foreach wrdgrp generate group, COUNT(w);
dump wrdsizec;
result:
(25,1)
(34,1)
(37,1)

Step 4:
store wrdsizec into ‘/Wordsizecount_pig’

Prwatech