This topic contains 0 replies, has 1 voice, and was last updated by  Shivraj 3 years, 4 months ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #1199

    Shivraj
    Participant

    The input file contains below data

    I learn big data
    I learn hadoop
    I learn sqoop

    pig commands

    word_temp = LOAD ‘/home/cloudera/Desktop/wordcountproblem’ as (words:chararray);
    word_split = FOREACH word_temp GENERATE FLATTEN(TOKENIZE(words)) as word;
    word_group = GROUP word_split BY word;
    word_count = FOREACH word_group GENERATE COUNT(word_split), group;
    store word_count into ‘/home/cloudera/Desktop/wordcount_pig’;

    output
    3 I
    1 big
    1 data
    3 learn
    1 sqoop
    1 hadoop

    Cheers,
    Shivraj

Viewing 1 post (of 1 total)

The forum ‘General Discussion’ is closed to new topics and replies.