You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Rohini Palaniswamy (Jira)" <ji...@apache.org> on 2022/08/12 22:32:00 UTC

[jira] [Resolved] (PIG-5425) Pig 0.15 and later don't set context signature correctly

     [ https://issues.apache.org/jira/browse/PIG-5425?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rohini Palaniswamy resolved PIG-5425.
-------------------------------------
    Hadoop Flags: Reviewed
      Resolution: Fixed

> Pig 0.15 and later don't set context signature correctly
> --------------------------------------------------------
>
>                 Key: PIG-5425
>                 URL: https://issues.apache.org/jira/browse/PIG-5425
>             Project: Pig
>          Issue Type: Improvement
>            Reporter: Jacob Tolar
>            Assignee: Jacob Tolar
>            Priority: Major
>             Fix For: 0.18.0
>
>         Attachments: PIG-5425.0.patch
>
>
> As an author of Pig UDFs, my expectation in EvalFunc ( [https://github.com/apache/pig/blob/release-0.17.0/src/org/apache/pig/EvalFunc.java] ) is that {{setUDFContextSignature}} would be called before {{setInputSchema}}. This was previously the case up through Pig 0.14
>  
> In Pig 0.15 and later (according to the git tags, at least; I've only checked 0.17), this is not true.
> This commit introduces the problem behavior: [https://github.com/apache/pig/commit/8af34f1971628d1eeb0cd1f07fe03397ca887b81]
> The issue is in src/org/apache/pig/newplan/logical/expression/ExpToPhyTranslationVisitor.java  line 513 ([git blame link|https://github.com/apache/pig/blame/release-0.17.0/src/org/apache/pig/newplan/logical/expression/ExpToPhyTranslationVisitor.java#L513]) introduced in that commit. 
>  
> There, {{f.setInputSchema()}} is called without previously calling {{f.setUDFContextSignature(signature)}}. 
> Note that on line 509, {{((POUserFunc)p).setSignature(op.getSignature());}} is called, but POUserFunc [re-instantiates the EvalFunc and does not actually use the func argument passed in its constructor|https://github.com/apache/pig/blame/release-0.17.0/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POUserFunc.java#L119-L128] (quite confusing, but probably attributable to changes over time). 
> {{f}} is discarded, so it should be safe to simply call {{f.setUdfContextSignature(signature)}} as a simple fix.
> The code here is arguably unnecessarily complex and could probably be cleaned up further, but I propose the simple fix above without a larger refactoring.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)