[
https://issues.apache.org/jira/browse/PIG-1824?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13012608#comment-13012608
]
Woody Anderson commented on PIG-1824:
-------------------------------------
this code originally written cannot work:
{code}
import re
@outputSchema("y:bag{t:tuple(word:chararray)}")
def strsplittobag(content,regex):
return re.compile(regex).split(content
{code}
the reason is that split returns a list of strings, not a list of tuples, and
jythonfunction casting will fail. i've created a ticket for these kinds of
'obvious' type coercions: https://issues.apache.org/jira/browse/PIG-1942
and, as such, i am going to change the code for this ticket to something that
will work when 'import re' works.
> Support import modules in Jython UDF
> ------------------------------------
>
> Key: PIG-1824
> URL: https://issues.apache.org/jira/browse/PIG-1824
> Project: Pig
> Issue Type: Improvement
> Reporter: Richard Ding
> Assignee: Woody Anderson
> Fix For: 0.10
>
>
> Currently, Jython UDF script doesn't support Jython import statement as in
> the following example:
> {code}
> #!/usr/bin/python
> import re
> @outputSchema("y:bag{t:tuple(word:chararray)}")
> def strsplittobag(content,regex):
> return re.compile(regex).split(content)
> {code}
> Can Pig automatically locate the Jython module file and ship it to the
> backend? Or should we add a ship clause to let user explicitly specify the
> module to ship?
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira