pig-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Olga Natkovich (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (PIG-2111) UDF registration does not work for nested classes
Date Wed, 08 Jun 2011 17:31:58 GMT

    [ https://issues.apache.org/jira/browse/PIG-2111?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13046099#comment-13046099
] 

Olga Natkovich commented on PIG-2111:
-------------------------------------

I believe that need to escape $ is documented as part of parameter substitution but we could
make this more clear when talking about UDFs

> UDF registration does not work for nested classes
> -------------------------------------------------
>
>                 Key: PIG-2111
>                 URL: https://issues.apache.org/jira/browse/PIG-2111
>             Project: Pig
>          Issue Type: Bug
>            Reporter: Gianmarco De Francisci Morales
>
> Using nested classes as below does not work with the register command.
> {code}
> package mypackage
> public class URLFuncs {
> public static class MyEvalFunc extends EvalFunc<String> {
>     @Override
>     public String exec(Tuple input) throws IOException {
>         if (input == null || input.size() == 0)
>             return null;
>         try {
>             Object value = input.get(0);
>             if (!(value instanceof String))
>                 throw new IOException("Cannot convert a " + DataType.findTypeName(value));
>             String url = (String) value;
>             return url.toUpperCase();
>         } catch (ExecException ee) {
>             throw new IOException("Caught exception processing input row ", ee);
>         }
>     }
> }
> {code}
> The error is as follows:
> {code}
> [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1070: Could not resolve mypackage.URLFuncs.MyEvalFunc
using imports: 
> [org.apache.pig.builtin., org.apache.pig.impl.builtin., com.yahoo.yst.sds.ULT., myna.,
> org.apache.pig.piggybank.evaluation., org.apache.pig.piggybank.evaluation.datetime.,

> org.apache.pig.piggybank.evaluation.decode., org.apache.pig.piggybank.evaluation.math.,

> org.apache.pig.piggybank.evaluation.stats., org.apache.pig.piggybank.evaluation.string.,

> org.apache.pig.piggybank.evaluation.util., org.apache.pig.piggybank.evaluation.util.apachelogparser.,

> string., util., math., datetime., sequence., util., org.apache.hadoop.zebra.pig., , 
> org.apache.pig.builtin., org.apache.pig.impl.builtin.]
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message