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

Aniket Mokashi commented on PIG-928:
------------------------------------

Commenting on behavior of EvalFunc<Object>, we consider following UDF-
{code}
public class UDF1 extends EvalFunc<Object> {
    class Student{
        int age;
        String name;
        Student(int a, String nm) {
            age = a;
            name = nm;
        }
    }
    @Override
    public Object exec(Tuple input) throws IOException {
        return new Student(12, (String)input.get(0));
    }
    @Override
    public Schema outputSchema(Schema input) {
        return new Schema(new Schema.FieldSchema(null, DataType.BYTEARRAY));
    }
}
{code}
Although, this one define its output schema as ByteArray we fail this one as we 
do not know how to deserialize Student. Clearly, this is due to the bug in 
POUserFunc which fails to convert to ByteArray. Hence, res.result != null 
should be changed to result.result !=null.

> UDFs in scripting languages
> ---------------------------
>
>                 Key: PIG-928
>                 URL: https://issues.apache.org/jira/browse/PIG-928
>             Project: Pig
>          Issue Type: New Feature
>            Reporter: Alan Gates
>            Assignee: Aniket Mokashi
>             Fix For: 0.8.0
>
>         Attachments: calltrace.png, package.zip, PIG-928.patch, 
> pig-greek.tgz, pig.scripting.patch.arnab, pyg.tgz, RegisterPythonUDF3.patch, 
> RegisterPythonUDF4.patch, RegisterPythonUDF_Final.patch, 
> RegisterPythonUDFFinale.patch, RegisterPythonUDFFinale3.patch, 
> RegisterPythonUDFFinale4.patch, RegisterPythonUDFFinale5.patch, 
> RegisterScriptUDFDefineParse.patch, scripting.tgz, scripting.tgz, test.zip
>
>
> It should be possible to write UDFs in scripting languages such as python, 
> ruby, etc.  This frees users from needing to compile Java, generate a jar, 
> etc.  It also opens Pig to programmers who prefer scripting languages over 
> Java.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to