You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by Chris Olston <ol...@yahoo-inc.com> on 2009/01/08 18:28:01 UTC

Re: problem invoking custom Slicer (using "types" branch)

I'll respond to my own question:

Turns out that you have to implement LoadFunc in addition to Slicer (I just
updated the wiki documentation to reflect this):

public class MySlicer implements Slicer, LoadFunc {
 ...
}

-Chris


On 12/23/08 8:37 AM, "Chris Olston" <ol...@yahoo-inc.com> wrote:

> Hi, I followed the instructions for making a custom Slicer in
> http://wiki.apache.org/pig/UDFManual, i.e., I made a class that implements
> "Slicer" and invoked it via the syntax "load X using MySlicer()".
> 
> I get an error saying that my slicer cannot be cast to a LoadFunc (see
> below). I'm guessing that the syntax for invoking a custom slicer has
> changed in the types branch?
> 
> Thanks,
> 
> Chris
> 
> --- error message:
> 
> java.io.IOException: com.yahoo.echo.data.udfs.QueueSlicer cannot be cast to
> org.apache.pig.LoadFunc
>     at
> org.apache.pig.PigServer.parseQuery(PigServer.java:298)
>     at
> org.apache.pig.PigServer.registerQuery(PigServer.java:263)
>     at
> org.apache.pig.PigServer.registerQuery(PigServer.java:349)
>     at
> com.yahoo.echo.data.PigWrapper.registerPigQuerySequence(PigWrapper.java:108)
>     at 
> com.yahoo.echo.data.PigWrapper.registerPigQuerySequence(PigWrapper.java:112)
>     at com.yahoo.echo.data.Main.test3(Main.java:83)
>     at
> com.yahoo.echo.data.Main.main(Main.java:25)
> Caused by:
> org.apache.pig.impl.logicalLayer.parser.ParseException:
> com.yahoo.echo.data.udfs.QueueSlicer cannot be cast to
> org.apache.pig.LoadFunc
>     at
> org.apache.pig.impl.logicalLayer.parser.QueryParser.NonEvalFuncSpec(QueryPar
> ser.java:4271)
>     at
> org.apache.pig.impl.logicalLayer.parser.QueryParser.LoadClause(QueryParser.j
> ava:1063)
>     at 
> org.apache.pig.impl.logicalLayer.parser.QueryParser.BaseExpr(QueryParser.jav
> a:883)
>     at 
> org.apache.pig.impl.logicalLayer.parser.QueryParser.NestedExpr(QueryParser.j
> ava:797)
>     at 
> org.apache.pig.impl.logicalLayer.parser.QueryParser.UnionClause(QueryParser.
> java:2247)
>     at 
> org.apache.pig.impl.logicalLayer.parser.QueryParser.BaseExpr(QueryParser.jav
> a:962)
>     at 
> org.apache.pig.impl.logicalLayer.parser.QueryParser.Expr(QueryParser.java:74
> 2)
>     at 
> org.apache.pig.impl.logicalLayer.parser.QueryParser.Parse(QueryParser.java:5
> 37)
>     at 
> org.apache.pig.impl.logicalLayer.LogicalPlanBuilder.parse(LogicalPlanBuilder
> .java:60)
>     at org.apache.pig.PigServer.parseQuery(PigServer.java:295)
> 
> ... 6 more
> 
> 
> 
> 
> --
> Christopher Olston, Ph.D.
> Sr. Research Scientist
> Yahoo! Research
> 
> 
> 
> 

--
Christopher Olston, Ph.D.
Sr. Research Scientist
Yahoo! Research