You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "li xiang (JIRA)" <ji...@apache.org> on 2015/07/14 17:46:06 UTC

[jira] [Commented] (PIG-3294) Allow Pig use Hive UDFs

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

li xiang commented on PIG-3294:
-------------------------------

HI Daniel, this is xiang and I am reading the code relating to this JIRA. 

Regarding your change on ExpToPhyTranslationVisitor.java

            if (((POUserFunc)p).getFunc().getInputSchema() == null) {
                ((POUserFunc)p).setFuncInputSchema(op.getSignature());   <-- call setInputSchema() 
                ((EvalFunc) f).setInputSchema(((POUserFunc)p).getFunc().getInputSchema());   <-- add this line, call setInputSchema() again
            }

SetFuncInputSchema() of class POUserFunc will call setInputSchema(), as 
    /**
     * Sets EvalFunc's inputschema based on the signature
     * @param signature
     */
    public void setFuncInputSchema(String signature) {
        Properties props = UDFContext.getUDFContext().getUDFProperties(func.getClass());
        Schema tmpS=(Schema)props.get("pig.evalfunc.inputschema."+signature);
        if(tmpS!=null) {
            this.func.setInputSchema(tmpS);  <-- here
        }
    }

But the line you added calls setInputSchema() in class EvalFunc again.

Why do you mean to call setInputSchema() twice ? 

> Allow Pig use Hive UDFs
> -----------------------
>
>                 Key: PIG-3294
>                 URL: https://issues.apache.org/jira/browse/PIG-3294
>             Project: Pig
>          Issue Type: New Feature
>            Reporter: Daniel Dai
>            Assignee: Daniel Dai
>              Labels: gsoc2013, java
>             Fix For: 0.15.0
>
>         Attachments: PIG-3294-1.patch, PIG-3294-2.patch, PIG-3294-3.patch, PIG-3294-4.patch, PIG-3294-5.patch, PIG-3294-before-refactory.patch
>
>
> It would be nice if Pig provide some interoperability with Hive. We can wrap Hive UDF in Pig so we can use Hive UDF in Pig.
> This is a candidate project for Google summer of code 2013. More information about the program can be found at https://cwiki.apache.org/confluence/display/PIG/GSoc2013



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)