Pig ERROR 1066:无法打开别名tweetsReduced的迭代器

时间:2013-12-01 21:13:24

标签: apache-pig

我在本地模式下运行Pig,我收到了这个错误。

我正在执行的脚本是:

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;

错误日志:

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

我不确定我认为CSV文件是否正确可能是什么问题。问题可能是CSV文件吗?它有点大,所以我不能把它放在这里。同样有趣的是,错误是Invalid field projection. Projected field [venues::Name] does not exist.,但是CSV文件中有一个字段,就像那​​样。

对可能导致此错误发生的任何想法都非常欢迎!

2 个答案:

答案 0 :(得分:2)

看起来错误是“无效的字段投影。预计字段[场地::名称]不存在”。这意味着您在加载数据时缺少“AS”子句。

  

场地=加载'/输入'使用org.apache.pig.piggybank.storage.CSVLoader()AS(名称:chararray,...);

答案 1 :(得分:0)

好像你的namenode处于安全模式。 强行使用此cmd将您的namenode移出安全模式。

hdfs dfsadmin -safemode leave

然后使用pig latin“dump”命令。