[
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