错误1066:无法在Pig,Generic解决方案中为别名打开迭代器 [英] ERROR 1066: Unable to open iterator for alias in Pig, Generic solution
问题描述
在Apache Pig中,一个非常常见的错误消息是:
错误1066:无法为别名打开迭代器
有几个问题提到了这个错误,但没有一个提供通用的处理方法。因此这个问题:
当您收到错误1066时,该怎么办?无法为别名打开迭代器?
消息错误1066:无法打开别名myAlias的迭代器表明在使用myAlias的行中出现了错误。
但是,在尝试使用此别名之前,通常会出现错误。所以首先要做的是沿错误信息进一步查看,看看这是否真的是第一个抛出的错误。
这是我发现是一个有效的方法来处理这个错误,当我不容易发现一个更早的错误:
- 运行代码,直到你先定义别这样,
- 仔细看看你是否看到错误提示(通常是最后一行,但有时可能会发生)
- 现在你可能有一个错误,如果是的话:处理它并转到1。
- 在遇到别名之前,你可能没有错误,在这种情况下评估出现别名的行。
- 如果发生错误:处理并转到4;如果在第二次使用别名之前没有出现任何错误运行代码,然后转到3。
注意
- 逐行轻松运行PIG代码:在命令行中打开pig(只需键入
pig
或pig -useHCatalog
) - 如果您感到困惑,请确保只定义别名。 (我相信这是一般的好习惯)
A very common, error message in Apache Pig is:
ERROR 1066: Unable to open iterator for alias
There are several questions where this error is mentioned, but none of them give a generic approach for dealing with it. Hence this question:
What to do when you get an ERROR 1066: Unable to open iterator for alias ?
The message "ERROR 1066: Unable to open iterator for alias myAlias" suggests that there is something going wrong in the line where you use myAlias.
However, usually you will see this error if something went wrong BEFORE you are trying to use this alias. So the first thing to do is look up further along the error message, and see whether this is truely the first error that is thrown.
Here is what I found to be an efficient way to deal with this error when I did not easily spot an earlier error:
- Run the code untill just before you first define the the alias.
- Look carefully, whether you see any mention of ERROR (often it is in the last lines, but sometimes this can happen earlier)
- By now you probably have an error, if so: deal with it and go to 1.
- It is possible that you don't have an error before encountering the alias, in this case evaluate the line where the alias occurs.
- If the error occurs: Deal with it and go to 4; If no error occurs run the code untill just before you use the alias for the second time, and go to 3.
Notes
- To easily run PIG code line by line: Open pig on the command line (Simply type
pig
orpig -useHCatalog
for example) - If you get confused, make sure you only define the alias once. (I believe this is good practice in general)
这篇关于错误1066:无法在Pig,Generic解决方案中为别名打开迭代器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!