Pig Error Using Dump


2 Answer(s)


hi Faruk,

In the LOAD, you have specified a file in the local file system LOAD '/user/cloudera/pig/web/users.txt', but whereas you have started "pig" in hdfs mode. I suggest you to execute pig in local mode and try it as:

pig -x local
USERS = LOAD '/user/cloudera/pig/web/users.txt'
DUMP USERS;

Thanks for the answer to my first question.

I have run the following in the local pig mode. I am able to see the data when I dump Users and Pages but the dump for Fltrd, Jnd, Grpd, Smmd and Srtd does not return any data but no errors either. Since I am not able to see the dump for Srtd, I am not sure what the outcome of the commands is?

pig -x local
Users = LOAD '/home/cloudera/pig/web/users.txt' AS (user: chararray, age: int);
Pages = LOAD '/home/cloudera/pig/web/pages.txt' AS (user: chararray, url: chararray);
Fltrd = FILTER Users BY age >= 18 and age <=25;
Jnd = JOIN Fltrd By user, Pages By user;
Grpd = GROUP Jnd BY url;
Smmd = FOREACH Grpd GENERATE group, COUNT(Jnd) AS clicks;
Srtd = ORDER Smmd BY clicks DESC;
STORE = Srtd INTO '/home/cloudera/pig/web/resultWeb';

If I run the very last line STORE statement, I get the following error. I am unable to see where the syntax error is:

STORE = Srtd INTO '/home/cloudera/pig/web/resultWeb';
2014-08-10 11:00:30,865 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1200: Syntax error, unexpected symbol at or near '='
Details at logfile: /home/cloudera/pig/web/pig_1407693049480.log