Anton Belev
Anton Belev

Reputation: 13523

Pig ERROR 1066: Unable to open iterator for alias tweetsReduced

I'm running Pig in local mode and I'm getting this error.

The script that I'm executing is:

REGISTER '/users/level3/1103816b/Desktop/HotOrNot_repo/DataMining/Pig/piggybank.jar';

venues = LOAD '/users/level3/1103816b/Desktop/HotOrNot_repo/DataMining/Pig/venues_extended.csv' USING org.apache.pig.piggybank.storage.CSVLoader();

venuesReduced = foreach venues generate venues::Name;

DUMP tweetsReduced;

The error log:

2013-12-01 21:06:59,270 [main] ERROR org.apache.pig.tools.grunt.Grunt - org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1066: Unable to open iterator for alias venuesReduced
    at org.apache.pig.PigServer.openIterator(PigServer.java:880)
    at org.apache.pig.tools.grunt.GruntParser.processDump(GruntParser.java:774)
    at org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:372)
    at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:198)
    at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:173)
    at org.apache.pig.tools.grunt.Grunt.exec(Grunt.java:84)
    at org.apache.pig.Main.run(Main.java:607)
    at org.apache.pig.Main.main(Main.java:156)
Caused by: org.apache.pig.PigException: ERROR 1002: Unable to store alias venuesReduced
    at org.apache.pig.PigServer.storeEx(PigServer.java:982)
    at org.apache.pig.PigServer.store(PigServer.java:942)
    at org.apache.pig.PigServer.openIterator(PigServer.java:855)
    ... 7 more
Caused by: org.apache.pig.impl.plan.PlanValidationException: ERROR 1025: 
<file /users/level3/1103816b/Desktop/HotOrNot_repo/DataMining/Pig/venues_count.pig, line 7, column 40> Invalid field projection. Projected field [venues::Name] does not exist.
    at org.apache.pig.newplan.logical.expression.ProjectExpression.findColNum(ProjectExpression.java:191)
    at org.apache.pig.newplan.logical.expression.ProjectExpression.setColumnNumberFromAlias(ProjectExpression.java:174)
    at org.apache.pig.newplan.logical.visitor.ColumnAliasConversionVisitor$1.visit(ColumnAliasConversionVisitor.java:53)
    at org.apache.pig.newplan.logical.expression.ProjectExpression.accept(ProjectExpression.java:215)
    at org.apache.pig.newplan.DependencyOrderWalker.walk(DependencyOrderWalker.java:75)
    at org.apache.pig.newplan.PlanVisitor.visit(PlanVisitor.java:52)
    at org.apache.pig.newplan.logical.optimizer.AllExpressionVisitor.visit(AllExpressionVisitor.java:142)
    at org.apache.pig.newplan.logical.relational.LOInnerLoad.accept(LOInnerLoad.java:128)
    at org.apache.pig.newplan.DependencyOrderWalker.walk(DependencyOrderWalker.java:75)
    at org.apache.pig.newplan.logical.optimizer.AllExpressionVisitor.visit(AllExpressionVisitor.java:124)
    at org.apache.pig.newplan.logical.relational.LOForEach.accept(LOForEach.java:76)
    at org.apache.pig.newplan.DependencyOrderWalker.walk(DependencyOrderWalker.java:75)
    at org.apache.pig.newplan.PlanVisitor.visit(PlanVisitor.java:52)
    at org.apache.pig.PigServer$Graph.compile(PigServer.java:1716)
    at org.apache.pig.PigServer$Graph.compile(PigServer.java:1708)
    at org.apache.pig.PigServer$Graph.access$200(PigServer.java:1409)
    at org.apache.pig.PigServer.storeEx(PigServer.java:977)
    ... 9 more

I'm not sure what may be the problem I believe the CSV file is correct. Can it be the CSV file that is the problem? It's kind of large so I cannot put it here. Also is interesting that the error is saying Invalid field projection. Projected field [venues::Name] does not exist. but there is a field in he CSV file called like that.

Any thoughts on what may cause this error to happen are more than welcome!

Upvotes: 0

Views: 9106

Answers (2)

user5959436
user5959436

Reputation: 1

It seems as if your namenode is in safemode. Forcefully , move your namenode out of safe mode by using this cmd.

hdfs dfsadmin -safemode leave

then use pig latin "dump " command.

Upvotes: 0

Bharat Jain
Bharat Jain

Reputation: 664

Looks like the error is "Invalid field projection. Projected field [venues::Name] does not exist". Which means you are missing "AS" clause when LOADING data.

venues = LOAD '/input' USING org.apache.pig.piggybank.storage.CSVLoader() AS (Name:chararray, ...);

Upvotes: 2

Related Questions