java - Pig ERROR 1066: Unable to open iterator for alias returned from UDF -
i trying load own udf in pig. have made jar using eclipse's export function. getting 1066 error when running pig script. not sure b = ..
can dump a, can not dump b.
script
register myudfs.jar; define hour myudfs.hour; = load 'access_log_jul95' using pigstorage(' ') (ip:chararray, dash1:chararray, dash2:chararray, date:chararray, getrequset:chararray, status:int, port:int); b = foreach generate hour(ip); dump b;
function
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); } } }
running command
pig -x mapreduce 2.pig
data format
199.72.81.55 - - [01/jul/1995:00:00:01 -0400] "get /history/apollo/ http/1.0" 200 6245 | | | | | ip date getrequest status port
pig stack trace
error 1066: unable open iterator alias b org.apache.pig.impl.logicallayer.frontendexception: error 1066: unable open iterator alias b @ org.apache.pig.pigserver.openiterator(pigserver.java:836) @ org.apache.pig.tools.grunt.gruntparser.processdump(gruntparser.java:696) @ org.apache.pig.tools.pigscript.parser.pigscriptparser.parse(pigscriptparser.java:320) @ org.apache.pig.tools.grunt.gruntparser.parsestoponerror(gruntparser.java:194) @ org.apache.pig.tools.grunt.gruntparser.parsestoponerror(gruntparser.java:170) @ org.apache.pig.tools.grunt.grunt.exec(grunt.java:84) @ org.apache.pig.main.run(main.java:604) @ org.apache.pig.main.main(main.java:157) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:601) @ org.apache.hadoop.util.runjar.main(runjar.java:208) caused by: java.io.ioexception: job terminated anomalous status failed @ org.apache.pig.pigserver.openiterator(pigserver.java:828) ... 12 more
i extremely unfamiliar pig, , , pointers appreciated. know lot of information at, have had no luck in mutating data in udf, , not sure went wrong.
thanks
Comments
Post a Comment