Pig Error - Unable to open iterator for alias OldMoviesWithFiveStarRatings


i just started learning Pig. I am getting the following error when i run pig script. When i just use DESCRIBE it works fine but fails when I use DUMP.

ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1066: Unable to open iterator for alias OldMoviesWithFiveStarRatings.

Any pointers where i should be looking at? Thanks in advance.


If i run the script in grunt command prompt, it works fine. Only issue is when i run it in the Ambari Pig view i get that unable to open iterator for alias error.


@Naresh2 Can you share the code as well?


here is the code. thanks.
ratings = LOAD ‘/user/nsbigdata/dataset/ml-100k/u.data’ AS (userID:int, movieID:int, rating:int, ratingTime:int);
metadata = LOAD ‘/user/nsbigdata/dataset/ml-100k/u.item’ USING PigStorage(’|’)
AS (movieID:int, movie:chararray, releaseDate:chararray, videoRelease:chararray, url:chararray);

nameLookup = FOREACH metadata GENERATE movieID, movie, ToUnixTime(ToDate(releaseDate, ‘dd-MMM-yyyy’)) AS releaseTime;

moviesByRating = GROUP ratings BY movieID;

DESCRIBE moviesByRating;

avgRatings = FOREACH moviesByRating GENERATE group AS movieID, AVG(ratings.rating) AS avgRating;

DESCRIBE avgRatings;

fiveStarRatings = FILTER avgRatings BY avgRating > 4.0;

DESCRIBE fiveStarRatings;

fiveStarMoviesWithData = JOIN fiveStarRatings By movieID, nameLookup By movieID;

DESCRIBE fiveStarMoviesWithData;

OldMoviesWithFiveStarRatings = ORDER fiveStarMoviesWithData BY nameLookup::releaseTime;
DESCRIBE OldMoviesWithFiveStarRatings;
OldMovieTitleAndRating = FOREACH OldMoviesWithFiveStarRatings GENERATE avgRating, movie;
DESCRIBE OldMovieTitleAndRating;
Top50OldMovies = LIMIT OldMovieTitleAndRating 50;
DUMP Top50OldMovies
–STORE Top50OldMovies INTO ‘/user/nsbigdata/pig/output/old-movies.txt’ USING PigStorage(’|’);