[
https://issues.apache.org/jira/browse/PIG-2322?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Daniel Dai updated PIG-2322:
----------------------------
Attachment: PIG-2322-2.patch
PIG-2322-2.patch fix a unit test related to this patch.
> varargs functions do not get passed the arguments in Python embedding
> ---------------------------------------------------------------------
>
> Key: PIG-2322
> URL: https://issues.apache.org/jira/browse/PIG-2322
> Project: Pig
> Issue Type: Bug
> Reporter: Julien Le Dem
> Assignee: Julien Le Dem
> Fix For: 0.11
>
> Attachments: PIG-2322-2.patch, PIG-2322.patch
>
>
> from Stan:
> Hi,
> I have a simple python udf which takes a variable number of (string)
> arguments and returns the first non-empty one.
> I can see that the udf is invoked from pig but no arguments are being passed.
> Here is the script:
> =========================================================
> #!/usr/bin/python
> from org.apache.pig.scripting import *
> @outputSchema("s:chararray")
> def firstNonempty(*args):
> print args
> for v in args:
> if len(v) != 0:
> return v
> return ''
> if __name__ == "__main__":
> Pig.compile("""
> data = load 'input.txt' AS (string1:chararray, string2:chararray);
> data = foreach data generate firstNonempty(string1, string2) as id,
> string1, string2;
> dump data;
> """).bind().runSingle()
> ===========================================================
> Thanks!
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira