Thank you very much for your help , in fact I had some directory structure problems ,
when I did jar -tf mypigudf I get mypigudf/DicomParser.java mypigudf/DicomParser.class But now I have different problem *Failed to generate logical plan. Nested exception: java.lang.ClassCastException: mypigudf.DicomParser cannot be cast to org.apache.pig.EvalFunc* please any idea ??? Baraa On Tue, Mar 22, 2011 at 8:18 PM, Xuefu Zhang <[email protected]> wrote: > I wasn't able to compile your code, but from the steps you listed, I think > you should check the directory structure. > > Once you have a jar, you can do "jar -tf mypigudf" to list the classes in > it. You also need to make sure that the directory structure matches your > class patch. In your case, you should see "mypigudf/DicomParser.class" in > your jar. > > --Xuefu > > -----Original Message----- > From: Baraa Mohamad [mailto:[email protected]] > Sent: Tuesday, March 22, 2011 12:05 PM > To: [email protected] > Subject: Re: Failed to generate logical plan > > Yes I'm using trunk > > this is my class > > package mypigudf; > import java.io.IOException; > import org.apache.pig.data.TupleFactory; import org.apache.pig.data.Tuple; > public class DicomParser{ > public Tuple exec(String input) throws IOException {} } > > and after that I follwed this steps > > cd H:/apps/mypig > javac -cp pig.jar DicomParser.java > jar -cf mypigudf.jar mypigudf > > am I doing something wrong????? > > Baraa > > > > On Tue, Mar 22, 2011 at 7:52 PM, Xuefu Zhang <[email protected]> wrote: > > > Hi Baraa, > > > > I'm assuming you're using trunk for your experiment. Nevertheless, > > this error basically tells you that Pig cannot instanticate your UDF. > > Common cause is misspelling. Is mypigudf.DicomParser fully qualified > > class name of your UDF? I noticed that mypigudf is the jar file name as > well. > > > > Thanks, > > Xuefu > > > > -----Original Message----- > > From: Baraa Mohamad [mailto:[email protected]] > > Sent: Tuesday, March 22, 2011 11:41 AM > > To: [email protected] > > Subject: Failed to generate logical plan > > > > Hi all, > > > > I wrote a simple udf DicomParser which read a line and convert it to > > tuple but when I tried to use like that > > > > register H:/apps/mypig/mypigudf.jar; > > A = load 'dicoms/' using > > org.apache.pig.piggybank.storage.XMLLoader('attr') > > as (x:chararray); > > B = Foreach A generate mypigudf.DicomParser(x); store B into > > 'testUdf'; > > > > > > I get this error > > > > Pig Stack Trace > > --------------- > > ERROR 1000: Error during parsing. Failed to generate logical plan. > > Nested > > exception: java.lang.RuntimeException: Cannot instantiate: > > mypigudf.DicomParser > > > > org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1000: Error > > during parsing. Failed to generate logical plan. Nested exception: > > java.lang.RuntimeException: Cannot instantiate: mypigudf.DicomParser > > at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1568) > > at org.apache.pig.PigServer$Graph.registerQuery(PigServer.java:1513) > > at org.apache.pig.PigServer.registerQuery(PigServer.java:581) > > at > > org.apache.pig.tools.grunt.GruntParser.processPig(GruntParser.java:917) > > at > > > > > org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:386) > > at > > > > > org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:176) > > at > > > > > org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:152) > > at org.apache.pig.tools.grunt.Grunt.exec(Grunt.java:90) > > at org.apache.pig.Main.run(Main.java:537) > > at org.apache.pig.Main.main(Main.java:108) > > > > ====================================================================== > > ========== > > > > why i can't use it i didn't find how I can solve this error > > > > Regards > > > > Baraa > > >
