错误1066:无法打开别名的迭代器

时间:2015-01-24 04:31:52

标签: apache-pig

对于使用Pig的简单Unable to open iterator for aliasLOAD操作,我收到错误DUMP。我已经看过了答案:

ERROR 1066: Unable to open iterator for alias - Pig

但他们没有帮助我。

我的环境:

OS: Windows 7
Pig version: 0.13.0
Mode: Local

它在错误中显示异常是'由'无法更改引起的 TMP目录中文件的权限。但是当我检查TMP目录时,没有这样的文件(可能在命令完成后被删除了吗?)。

以下日志(使用-v和-w选项):

'D:\H\HADOOP-2.6.0\bin\hadoop-config.cmd' is not recognized as an internal or external command,
operable program or batch file.
15/01/24 09:20:22 INFO pig.ExecTypeProvider: Trying ExecType : LOCAL
15/01/24 09:20:22 INFO pig.ExecTypeProvider: Picked LOCAL as the ExecType
2015-01-24 09:20:22,909 [main] INFO  org.apache.pig.Main - Apache Pig version 0.13.0 (r1606446) compiled Jun 29 2014, 02:29:34
2015-01-24 09:20:22,909 [main] INFO  org.apache.pig.Main - Logging error messages to: d:\Pig\pig-0.13.0\bin\
2015-01-24 09:20:24,267 [main] INFO  org.apache.pig.impl.util.Utils - Default bootup file C:\Users\Venkat/.pigbootup not found
2015-01-24 09:20:24,438 [main] INFO  org.apache.pig.backend.hadoop.executionengine.HExecutionEngine - Connecting to hadoop file system at: file:///
2015-01-24 09:20:26,205 [main] WARN  org.apache.hadoop.util.NativeCodeLoader - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
2015-01-24 09:20:26,236 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1066: Unable to open iterator for alias a
2015-01-24 09:20:26,236 [main] ERROR org.apache.pig.tools.grunt.Grunt - org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1066: Unable to open iterator for alias a
    at org.apache.pig.PigServer.openIterator(PigServer.java:912)
    at org.apache.pig.tools.grunt.GruntParser.processDump(GruntParser.java:752)
    at org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:372)
    at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:228)
    at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:203)
    at org.apache.pig.tools.grunt.Grunt.exec(Grunt.java:81)
    at org.apache.pig.Main.run(Main.java:479)
    at org.apache.pig.Main.main(Main.java:156)
Caused by: org.apache.pig.backend.datastorage.DataStorageException: ERROR 0: java.io.IOException: Failed to set permissions of path: \tmp\temp946561981 to 0700
    at org.apache.pig.impl.io.FileLocalizer.relativeRoot(FileLocalizer.java:484)
    at org.apache.pig.impl.io.FileLocalizer.getTemporaryPath(FileLocalizer.java:515)
    at org.apache.pig.impl.io.FileLocalizer.getTemporaryPath(FileLocalizer.java:511)
    at org.apache.pig.PigServer.openIterator(PigServer.java:887)
    ... 7 more
Caused by: java.io.IOException: Failed to set permissions of path: \tmp\temp946561981 to 0700
    at org.apache.hadoop.fs.FileUtil.checkReturnValue(FileUtil.java:689)
    at org.apache.hadoop.fs.FileUtil.setPermission(FileUtil.java:662)
    at org.apache.hadoop.fs.RawLocalFileSystem.setPermission(RawLocalFileSystem.java:509)
    at org.apache.hadoop.fs.FilterFileSystem.setPermission(FilterFileSystem.java:286)
    at org.apache.pig.backend.hadoop.datastorage.HPath.setPermission(HPath.java:122)
    at org.apache.pig.impl.io.FileLocalizer.createRelativeRoot(FileLocalizer.java:495)
    at org.apache.pig.impl.io.FileLocalizer.relativeRoot(FileLocalizer.java:481)
    ... 10 more

日志文件中的详细信息:D:\ Pig \ pig-0.13.0 \ bin \ data-1.txt1422071424329.log

猪堆痕迹

错误1066:无法打开别名a的迭代器 org.apache.pig.impl.logicalLayer.FrontendException:错误1066:无法打开别名的迭代器     在org.apache.pig.PigServer.openIterator(PigServer.java:912)     在org.apache.pig.tools.grunt.GruntParser.processDump(GruntParser.java:752)     在org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:372)     在org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:228)     在org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:203)     在org.apache.pig.tools.grunt.Grunt.exec(Grunt.java:81)     在org.apache.pig.Main.run(Main.java:479)     在org.apache.pig.Main.main(Main.java:156) 引起:org.apache.pig.backend.datastorage.DataStorageException:错误0:java.io.IOException:无法将path:\ tmp \ temp946561981的权限设置为0700     在org.apache.pig.impl.io.FileLocalizer.relativeRoot(FileLocalizer.java:484)     在org.apache.pig.impl.io.FileLocalizer.getTemporaryPath(FileLocalizer.java:515)     在org.apache.pig.impl.io.FileLocalizer.getTemporaryPath(FileLocalizer.java:511)     在org.apache.pig.PigServer.openIterator(PigServer.java:887)     ......还有7个 引起:java.io.IOException:无法将path:\ tmp \ temp946561981的权限设置为0700     在org.apache.hadoop.fs.FileUtil.checkReturnValue(FileUtil.java:689)     在org.apache.hadoop.fs.FileUtil.setPermission(FileUtil.java:662)     at org.apache.hadoop.fs.RawLocalFileSystem.setPermission(RawLocalFileSystem.java:509)     在org.apache.hadoop.fs.FilterFileSystem.setPermission(FilterFileSystem.java:286)     在org.apache.pig.backend.hadoop.datastorage.HPath.setPermission(HPath.java:122)     在org.apache.pig.impl.io.FileLocalizer.createRelativeRoot(FileLocalizer.java:495)     在org.apache.pig.impl.io.FileLocalizer.relativeRoot(FileLocalizer.java:481)

......还有10个

Pig文件内容:

a = LOAD 's.csv' AS (NAME:chararray,COUNTRY:chararray,YEAR:int,SPORT:chararray,GOLD:int,SILVER:int,BRONZE:int,TOTAL:int);
DUMP a;

s.csv的内容:

Yang   Yilin    China       2008    Gymnastics  1   0   2   3

Leisel Jones    Australia   2000    Swimming    0   2   0   2

LOAD语句的语法有什么问题吗? 是否有任何需要专门设置的环境变量 比JAVA和JAVA_HOME?

2 个答案:

答案 0 :(得分:1)

通常,由于路径错误或无法访问文件路径,我们将收到“错误org.apache.pig.tools.grunt.Grunt-错误1066:无法为别名打开迭代器”的错误消息。

  1. 检查文件位置是否正确。
  2. 检查您是否可以访问该文件。

我在hadoop namenode safemode开启的情况下遇到了这个问题。 所以我在关闭安全模式下执行了以下命令:

sudo -u hdfs hadoop dfsadmin -safemode leave

然后它对我有用。

答案 1 :(得分:0)

首先检查你的hadoop权限状态,如果它的根目录也改变了用户。

$ sudo chown -R testuser:testuser /( hadoop文件夹的路径

许可问题将得到解决。

我希望这会起作用