Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Pig >> mail # user >> Failed to generate logical plan


+
Baraa Mohamad 2011-03-22, 18:40
+
Xuefu Zhang 2011-03-22, 18:52
+
Baraa Mohamad 2011-03-22, 19:04
+
Xuefu Zhang 2011-03-22, 19:18
+
Baraa Mohamad 2011-03-22, 19:37
Copy link to this message
-
RE: Failed to generate logical plan
That means your class need to be a subclass of org.apache.pig.EvalFunc.

--Xuefu

-----Original Message-----
From: Baraa Mohamad [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 22, 2011 12:38 PM
To: [EMAIL PROTECTED]
Subject: Re: Failed to generate logical plan

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(PigScriptP
> arser.java:386)
> >    at
> >
> >
> org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.ja
> va:176)
> >    at
> >
> >
> org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.ja
> va: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)