By Dennis Jaheruddin


2015-12-28 14:09:25 8 Comments

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 ?

2 comments

@Dennis Jaheruddin 2015-12-28 14:09:25

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:

  1. Run the code untill just before you first define the the alias.
  2. Look carefully, whether you see any mention of ERROR (often it is in the last lines, but sometimes this can happen earlier)
  3. By now you probably have an error, if so: deal with it and go to 1.
  4. It is possible that you don't have an error before encountering the alias, in this case evaluate the line where the alias occurs.
  5. 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 pigor pig -useHCatalog for example)
  • If you get confused, make sure you only define the alias once. (I believe this is good practice in general)

@Dennis Jaheruddin 2015-12-28 15:17:04

This intends to be a generic approach for the error message, as such comments/improvements are very welcome!

@zach 2018-03-11 19:20:14

I once received this error when using the SUM function. I was summing values that had nulls among them. After filtering out the null values in the prior lines, it worked properly.

Related Questions

Sponsored Content

33 Answered Questions

[SOLVED] Reference - What does this error mean in PHP?

5 Answered Questions

ERROR 1066: Unable to open iterator for alias in pig

0 Answered Questions

apache-pig: ERROR 1066: Unable to open iterator for alias

7 Answered Questions

[SOLVED] What is a stack trace, and how can I use it to debug my application errors?

1 Answered Questions

ERROR 1066: Unable to open iterator for alias

  • 2015-01-24 04:31:52
  • Venkat Ramakrishnan
  • 5010 View
  • 0 Score
  • 1 Answer
  • Tags:   apache-pig

4 Answered Questions

[SOLVED] ERROR 1066: Unable to open iterator for alias - Pig

  • 2013-12-03 11:38:06
  • knowone
  • 26163 View
  • 8 Score
  • 4 Answer
  • Tags:   apache-pig

0 Answered Questions

PIG SCRIPT FAILS with ERROR 1066: Unable to open iterator for alias. Backend error : null

  • 2016-02-25 13:39:04
  • Madhuri Shrivatsa
  • 63 View
  • 0 Score
  • 0 Answer
  • Tags:   hadoop apache-pig

1 Answered Questions

Pig error: unable to open iterator for alias

1 Answered Questions

Unable to open iterator for alias -Pig

  • 2015-08-03 05:33:14
  • Arnab
  • 518 View
  • 0 Score
  • 1 Answer
  • Tags:   hadoop apache-pig

1 Answered Questions

PigLatin - Local Mode - ERROR 1066: Unable to open iterator for alias B

  • 2013-03-27 12:28:56
  • Sumod
  • 2517 View
  • 0 Score
  • 1 Answer
  • Tags:   hadoop apache-pig

Sponsored Content