Pig ERROR 1066:无法打开从UDF返回的别名的迭代器

时间:2013-05-03 00:30:44

标签: java hadoop user-defined-functions apache-pig

我正在尝试在猪身上加载自己的UDF。我使用eclipse的导出功能将它变成了一个jar。运行我的猪脚本时出现此1066错误。我不确定B = ..因为我可以转储A,但我无法转储B.

脚本

REGISTER myudfs.jar; 
DEFINE HOUR myudfs.HOUR;

A = load 'access_log_Jul95' using PigStorage(' ') as (ip:chararray, dash1:chararray, dash2:chararray, date:chararray, getRequset:chararray, status:int, port:int);
B = FOREACH A GENERATE HOUR(ip);
DUMP B;

功能

package myudfs;
import java.io.IOException;
import org.apache.pig.EvalFunc;
import org.apache.pig.data.Tuple;
import org.apache.pig.impl.util.WrappedIOException;

public class HOUR extends EvalFunc<String>
{
    @SuppressWarnings("deprecation")
    public String exec(Tuple input) throws IOException {
        if (input == null || input.size() == 0)
            return null;
        try{
            String str = (String)input.get(0);                
            return str.toUpperCase();
        }catch(Exception e){
            throw WrappedIOException.wrap("Caught exception processing input row ", e);
        }
    }
}

运行命令

pig -x mapreduce 2.pig

数据格式

199.72.81.55 - - [01/Jul/1995:00:00:01 -0400] "GET /history/apollo/ HTTP/1.0" 200 6245
   |                     |                                  |                  |    |
   ip                   date                               getRequest       status port

猪堆痕迹

ERROR 1066: Unable to open iterator for alias B

org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1066: Unable to open iterator for alias B
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.exec(Grunt.java:84)
at org.apache.pig.Main.run(Main.java:604)
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:601)
at org.apache.hadoop.util.RunJar.main(RunJar.java:208)
Caused by: java.io.IOException: Job terminated with anomalous status FAILED
at org.apache.pig.PigServer.openIterator(PigServer.java:828)
... 12 more

我对猪非常不熟悉,任何指针都会非常感激。我知道这有很多信息要看,但是我没有好好改变UDF中的任何数据,我只是不确定我哪里出错了。

由于

0 个答案:

没有答案