java - Pig error 1070 when doing UDF -


i trying load own udf in pig. have made jar using eclipse's export function. trying run locally can make sure works before put jar on hdfs. when running locally, following error:

error 1070: not resolve myudfs.month using imports: [, org.apache.pig.builtin., org.apache.pig.impl.builtin.]

script

register myudfs.jar;  --define month myudfs.month;  = load 'access_log_jul95' using pigstorage(' ') (ip:chararray, dash1:chararray, dash2:chararray, date:chararray, getrequset:chararray, status:int, port:int); b = foreach generate myudfs.month(date); 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;  @suppresswarnings("deprecation") public class hour extends evalfunc<string> {     public string exec(tuple input) throws ioexception {         if (input == null || input.size() == 0)             return null;         try{             string str = (string)input.get(0);             return str.substring(1, 3);         }catch(exception e){             throw wrappedioexception.wrap("caught exception processing input row ", e);         }     } } 

working directory

1.pig  2.pig  bin  myudfs.jar   pig.jar  pig-withouthadoop.jar  src/ 

running command

pig -x local 2.pig

structure of jar

 0  thu may 02 12:16:26 mdt 2013 meta-inf/ 68  thu may 02 12:16:26 mdt 2013 meta-inf/manifest.mf  0  thu may 02 12:05:50 mdt 2013 myudfs/ 573 thu may 02 12:15:10 mdt 2013 myudfs/hour.java 

i close start chucking monitors, looking , direction. let me know wrong.

your udf class name called hour

so shouldn't pig latin this?

b = foreach generate myudfs.hour(date); 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -