8

Just started Pig; trying to load the data from a file and dump it henceforth. Loading seems to be proper, no error is thrown. Below is the query:

NYSE = LOAD '/root/Desktop/Works/NYSE-2000-2001.tsv' USING PigStorage() AS (exchange:chararray, stock_symbol:chararray, date:chararray, stock_price_open:float, stock_price_high:float, stock_price_low:float, stock_price_close:float, stock_volume:int, stock_price_adj_close:float);

When I try to do the Dump, it throws the following error:

Pig Stack Trace

ERROR 1066: Unable to open iterator for alias NYSE org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1066: Unable to open iterator for alias NYSE at org.apache.pig.PigServer.openIterator(PigServer.java:857) at org.apache.pig.tools.grunt.GruntParser.processDump(GruntParser.java:682) at org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:303) at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:189) at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:165) at org.apache.pig.tools.grunt.Grunt.run(Grunt.java:69) at org.apache.pig.Main.run(Main.java:490) at org.apache.pig.Main.main(Main.java:111) Caused by: java.io.IOException: Job terminated with anomalous status FAILED at org.apache.pig.PigServer.openIterator(PigServer.java:849)"

Any idea what's causing the issue?

Ufuk Hacıoğulları
  • 36,026
  • 11
  • 106
  • 149
knowone
  • 702
  • 2
  • 11
  • 25
  • how do you start pig? also check if there is a log file with more information. – Frederic Dec 03 '13 at 13:36
  • Pig will defer execution of the LOAD command until it sees STORE. So most likely problem is with the LOAD command itself. If you are running pig in non-local mode, then the INPUT-PATH is supposed to be HDFS path not LOCAL file path – Bharat Jain Dec 04 '13 at 05:04
  • Fred, I'm not sure in what context I should answer your question. I'm using BigInsights as the package which has Pig shell included in it. I simply start it from the option, I didn't checked any input file parameter or do not have to configure any such environment files. – knowone Dec 04 '13 at 06:24
  • @BharatJain: Thanks Bharat for the insight. I almost didn't noticed the fact that Pig is designed for processing in Hadoop framework. I did copy from local to hdfs and then performed the LOAD and DUMP; worked without STORE. Thank you for the help. Appreciate it !! – knowone Dec 04 '13 at 13:59
  • For people who found this post when looking for [ERROR 1066: Unable to open iterator for alias](http://stackoverflow.com/questions/34495085/error-1066-unable-to-open-iterator-for-alias-in-pig-generic-solution) here is a [generic solution](http://stackoverflow.com/a/34495086/983722). – Dennis Jaheruddin Dec 28 '15 at 15:34

4 Answers4

4

Are you running a pig 0.12.0 or earlier jar against hadoop 2.2, if this is the case then I managed to get around this error by recompiling the pig jar from src, here is a summary of the steps involved on a debian type box

  1. download the pig-0.12.0.tar.gz

  2. unpack the jar and set permissions

  3. then inside the unpacked directory compile the src with 'ant clean jar -Dhadoopversion=23'

then you need to 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 libary/dependency

I was getting your exact trace trying to run pig 12 in a hadoop 2.2.0 and the above steps worked for me

UPDATE
I posted my issue on the pig jira and they responded. They have a pig jar already compiled for hadoop2 pig-h2.jar here http://search.maven.org/#artifactdetails|org.apache.pig|pig|0.12.0|jar
a maven tag for this jar is

  <dependency>
       <groupId>org.apache.pig</groupId>
       <artifactId>pig</artifactId>
      <classifier>h2</classifier>
      <version>0.12.0</version>
      <scope>provided</scope>
  </dependency>  
Nigel Savage
  • 661
  • 5
  • 17
2

This could be due to a change in the Pig Version starting 0.12. The specific change is that Pig used to 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. The work around is to delete the column names from the input file and this should solve the problem

Kapil

0

I also meet this problem. And then I see this link: http://www.fanli7.net/a/JAVAbiancheng/ANT/20140325/441264.html

I just replace pig version from 0.12.0 to 0.13.0 and the problem is solved. (Here, my hadoop version is 2.3.0)

Haimei
  • 11,243
  • 3
  • 44
  • 34
0

You can place breakpoint to class PigServer to method store().

for(JobStats js : stats.getJobGraph()){
  if(js.getException() != null) {
    ex = js.getException();
  }
}

Inside the js object there is field errorMessage and it may contain description of the problem