“Apache ERROR 1066: Unable to open iterator for alias” specifies that there is something wrong in the line where alias is used.
Here at Bobcares, we have seen several such apache related errors as part of our Server Management Services for web hosts and online service providers.
Today we’ll take a look at the causes for this error and see the fix.
What causes apache error 1066 to occur
Here are the different reasons why this error message occurs
1. Usually, we come across this error message when something goes wrong before using an alias. So, we need to check whether this is the first error that is thrown along with the error message.
2. Sometimes, in the code, an incorrect path is specified.
3. This error also occurs if there are any changes in the Pig Version starting 0.12. The change here is that Pig would be permissive and automatically ignore the first line in the data file. Or it would interpret that line as column names, in the new version of Pig this permissiveness was removed.
This alternative was to delete the column names from the input file to solve the problem.
How we fix apache error 1066
Now let’s see the different solutions provided by our Support Engineers to resolve this error.
1. Running the code before alias
An easy and effective way to resolve this error is here.
1. The first step is to run your code until just before you first define the alias.
2. Now carefully observe, whether you see any error (often, the error occurs at the last lines but sometimes it occurs earlier).
3. If you have an error now then deal with it and go to Step 1.
4. However, sometimes you will not have an error before encountering the alias, in this case, evaluate the line where the alias occurs.
5. After this, if the error occurs then deal with it and go to step 4. In case, if there is no error then run the code until just before you use the alias for the second time, and go to step 3.
NOTE: To easily run the 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.
2. Right path specification to avoid 1066 error
Ensure that you have specified the right path in the code.
3. Pig and Hadoop version in Apache
If you are using pig 0.12.0 or running earlier jar against Hadoop 2.2, there is a workaround to recompile the pig jar from src.
Here are the steps that you can follow on a Debian type box:
- Initially, download pig-0.12.0.tar.gz
- Then unpack the jar and set permissions
- After that, within the unpacked directory compile the src with ‘ant clean jar -Dhadoopversion=23’
- Finally, get the jar on your class-path in maven, for example, in the same directory
mvn install:install-file -Dfile=pig.jar -DgroupId={set a groupId}- DartifactId={set a artifactId} -Dversion=1.0 -Dpackaging=jar or if in eclipse then add jar as external library/dependency
4. Upgrading Pig and Hadoop version in Apache
Try upgrading the version of the pig to 0.13.0. The Hadoop version is 2.3.0.
[Need any further assistance in fixing Apache errors? – We are here to help you.]
Conclusion
In short, this error occurs if there is something wrong in the line where alias is used. Today, we saw the solution provided by our Support Engineers to this error.
0 Comments