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 17:28:58 UTC

[jira] [Created] (PIG-2111) UDF registration does not work for nested classes

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

[jira] [Commented] (PIG-2111) UDF registration does not work for nested classes

Posted by "Gianmarco De Francisci Morales (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-2111?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13046129#comment-13046129 ] 

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

OK, I was wrong :)

I was thinking about the use in Java programs where you use the dot '.' to refer to inner classes as well.

I think you can close the bug.

> 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

[jira] [Commented] (PIG-2111) UDF registration does not work for nested classes

Posted by "Dmitriy V. Ryaboy (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-2111?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13046111#comment-13046111 ] 

Dmitriy V. Ryaboy commented on PIG-2111:
----------------------------------------

bq. Maybe it would be a good idea to document it, because '$' is not part of the fully qualified class name in Java.

It is.

{code}

package sink.kitchen;

public class Sink {

  public static class InnerClass {}

  public static void main(String[] args) throws Exception {
    System.err.println(InnerClass.class.getName());
  }
}

{code}

sink.kitchen.Sink$InnerClass


> 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

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

Posted by "Dmitriy V. Ryaboy (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIG-2111?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dmitriy V. Ryaboy updated PIG-2111:
-----------------------------------

    Description: 
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}

  was:
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}

       Priority: Minor  (was: Major)
     Issue Type: Wish  (was: Bug)
        Summary: UDF registration for nested classes is unintuitive  (was: UDF registration does not work for nested classes)

> 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

[jira] [Commented] (PIG-2111) UDF registration does not work for nested classes

Posted by "Olga Natkovich (JIRA)" <ji...@apache.org>.
    [ 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

[jira] [Commented] (PIG-2111) UDF registration does not work for nested classes

Posted by "Dmitriy V. Ryaboy (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-2111?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13046190#comment-13046190 ] 

Dmitriy V. Ryaboy commented on PIG-2111:
----------------------------------------

The reason I know this is that I've made the same mistake :)
In Elephant-Bird we did a bit of trickery where if we don't find a class foo.bar.baz, we check if there is a class foo.bar which has an inner class baz, specifically because we didn't want people to have to keep track of which classes are inner and which aren't. It might be a good idea to add this to Pig.

> 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

[jira] [Commented] (PIG-2111) UDF registration does not work for nested classes

Posted by "Gianmarco De Francisci Morales (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-2111?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13046097#comment-13046097 ] 

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

It works, thanks.
Maybe it would be a good idea to document it, because '$' is not part of the fully qualified class name in Java.

> 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

[jira] [Commented] (PIG-2111) UDF registration does not work for nested classes

Posted by "Gianmarco De Francisci Morales (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-2111?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13046083#comment-13046083 ] 

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

In interactive mode it seems to work.
When running a script the preprocesser catches it and tries to do parameter substitution.


> 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

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

Posted by "Gianmarco De Francisci Morales (JIRA)" <ji...@apache.org>.
    [ 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

[jira] [Commented] (PIG-2111) UDF registration does not work for nested classes

Posted by "Olga Natkovich (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-2111?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13046087#comment-13046087 ] 

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

try and escape the $ sign _. \$

> 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

[jira] [Commented] (PIG-2111) UDF registration does not work for nested classes

Posted by "Dmitriy V. Ryaboy (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-2111?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13046078#comment-13046078 ] 

Dmitriy V. Ryaboy commented on PIG-2111:
----------------------------------------

try addressing inner classes using $:

mypackage.URLFuncs$MyEvalFunc

> 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