You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Gianmarco De Francisci Morales (JIRA)" <ji...@apache.org> on 2011/06/08 22:33:58 UTC

[jira] [Commented] (PIG-2111) UDF registration for nested classes is unintuitive

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

Gianmarco De Francisci Morales commented on PIG-2111:
-----------------------------------------------------

Definitely +1

> UDF registration for nested classes is unintuitive
> --------------------------------------------------
>
>                 Key: PIG-2111
>                 URL: https://issues.apache.org/jira/browse/PIG-2111
>             Project: Pig
>          Issue Type: Wish
>            Reporter: Gianmarco De Francisci Morales
>            Priority: Minor
>
> Using nested classes by referring to them as "package.OuterClass.InnerClass" does not work with the register command (package.OuterClass\$InnerClass is the correct but unintuitive way to address them).
> {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