0

I'm attempting to get the most visited IPs from some weblogs.

Sample input:

323.81.303.680 - - [25/Oct/2011:01:41:00 -0500] "GET /download/download6.zip HTTP/1.1" 200 0 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.19) Gecko/2010031422 Firefox/3.0.19"
668.667.44.3 - - [25/Oct/2011:07:38:30 -0500] "GET /download/download3.zip HTTP/1.1" 200 0 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.12) Gecko/20070719 CentOS/1.5.0.12-3.el5.centos Firefox/1.5.0.12"
13.386.648.380 - - [25/Oct/2011:17:06:00 -0500] "GET /download/download6.zip HTTP/1.1" 200 0 "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB6.3; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; InfoPath.2)"
06.670.03.40 - - [26/Oct/2011:13:24:00 -0500] "GET /product/demos/product2 HTTP/1.1" 200 0 "-" "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3"

Script:

D = LOAD 'weblogs_rebuild.txt' USING PigStorage(' ') as 
    (client_ip: chararray,
     indents1: chararray,...
    );
F = Group D by client_ip;
C = foreach F generate COUNT(D) AS count, group;
A = ORDER C by count DESC;

This far into my script I seem to be good, a dump of C gets me output like:

(2,688.644.363.338)
(27,688.645.642.675)
(11,688.646.612.331)

And calling describe gets me this:

grunt> describe A
A: {count: long,group: chararray}
grunt> describe C
C: {count: long,group: chararray}

But when I dump A I get the error:

2013-07-30 15:53:40,434 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1066: Unable to open iterator for alias A

Here is the relevant section in the logs

Pig Stack Trace

ERROR 1066: Unable to open iterator for alias A

org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1066: Unable to open iterator for alias A
    at org.apache.pig.PigServer.openIterator(PigServer.java:836)
    at org.apache.pig.tools.grunt.GruntParser.processDump(GruntParser.java:696)
    at org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:320)
    at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:194)
    at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:170)
    at org.apache.pig.tools.grunt.Grunt.run(Grunt.java:69)
    at org.apache.pig.Main.run(Main.java:538)
    at org.apache.pig.Main.main(Main.java:157)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:160)
Caused by: java.io.IOException: Job terminated with anomalous status FAILED
    at org.apache.pig.PigServer.openIterator(PigServer.java:828)
    ... 12 more

My pig version is .11.1

mr2ert
  • 4,956
  • 1
  • 18
  • 31
Chenab
  • 93
  • 8
  • What is A? It's not in the script you posted. Post the whole script. – reo katoa Jul 30 '13 at 21:11
  • Sorry about that... its supposed to be the ordered table. – Chenab Jul 31 '13 at 13:20
  • If you are going to naming your relations with just uppercase letters, then they should follow a logical order. `A` is the input to `B` which is the input to `C` etc. Also, what version of pig are you using? – mr2ert Jul 31 '13 at 20:16
  • Could you please show us the full trace? – Tariq Jul 31 '13 at 20:23
  • Please give some simple data of your **weblogs_rebuild.txt** – Sandeep Singh Aug 01 '13 at 10:49
  • Edits done as well as I could get them. – Chenab Aug 01 '13 at 14:29
  • I have not been able to reproduce your problem. Your script works for me. – Pradeep Gollakota Aug 01 '13 at 18:50
  • 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:18
  • @Chenab please confirm whether the error actually occurs when you only use the sample data that you provided. If not, please update the sample, if you cannot reproduce it at all, consider deleting the question. – Dennis Jaheruddin Dec 28 '15 at 15:20

0 Answers0