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

Julien Le Dem commented on PIG-928:
-----------------------------------

ScriptEvalFunc does not do much anymore, I would suggest to remove it.
If we want to keep it to add shared code in the future then remove its 
constructor as it forces the schema to be fixed.
The output schema may depend on the input schema in some cases.
{code}
public abstract class ScriptEvalFunc extends EvalFunc<Object> {
    /**
     * Stub constructor to guide derived classes 
     * Avoids extra reference on exec()
     * @param fileName
     * @param functionName
     * @param numArgs
     * @param schema
     */
    public ScriptEvalFunc(String fileName, String functionName, String numArgs, 
String schema) {
    }

    @Override
    public abstract Object exec(Tuple tuple) throws IOException;

    @Override
    public abstract Schema outputSchema(Schema input);

}
{code}

As a side note, my original posting (see pig-greek.tgz) had a second decorator 
to handle that. You would provide the name of the function to compute the 
output schema from the input schema:
{code}
@outputSchemaFunction("fooOutputSchema")
def foo(someParameter):
   ...

def fooOutputSchema(inputSchema):
   ...
{code}

> 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, RegisterPythonUDF2.patch, 
> RegisterPythonUDF3.patch, RegisterPythonUDF4.patch, 
> RegisterPythonUDFFinale.patch, RegisterPythonUDFFinale3.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