[
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