what does "Encountered: <EOF> after : "" " mean using pig

16,843

You need to fix three issues in your code to make it work.
1.STORE stmt is not properly ended with semicolon.
2.STORE stmt output file is not properly enclosed with single quotes.
3. Need slight modification in Counts and Results stmt logic.

Modified Script:

Lines = LOAD '/user/hue/pig/examples/data/midsummer.txt' as (line:CHARARRAY);
Words = FOREACH Lines GENERATE FLATTEN(TOKENIZE(line)) AS word;
Groups = GROUP Words BY word;
Counts = FOREACH Groups GENERATE group, COUNT(Words) AS cnt;
Results = ORDER  Counts BY cnt DESC;
Top5 = LIMIT Results 5;
STORE Top5 INTO '/user/hue/pig/examples/data/summertop5';

If you face any issues in the script, let me know.

Share:
16,843
lserlohn
Author by

lserlohn

Updated on June 05, 2022

Comments

  • lserlohn
    lserlohn about 2 years

    I am a beginner on Hadoop and Pig. I examined the example proved in cloudera virtual image, and modefied it to count Top 5 frequent words:

    Lines = LOAD '/user/hue/pig/examples/data/midsummer.txt' as (line:CHARARRAY);
    Words = FOREACH Lines GENERATE FLATTEN(TOKENIZE(line)) AS word;
    Groups = GROUP Words BY word;
    Counts = FOREACH Groups GENERATE group, COUNT(Words);
    Results = ORDER Words BY Counts DESC;
    Top5 = LIMIT Results 5;
    STORE Top5 INTO /user/hue/pig/examples/data/summertop5Hi 
    

    However, when I run this script, I got this message error:

    ERROR org.apache.pig.tools.grunt.Grunt  - ERROR 1000: Error during parsing. Lexical error at line 8, column 0.  Encountered: <EOF> after : ""
    

    What does it mean?