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

Woody Anderson updated PIG-1824:
--------------------------------

                 Tags: jython, import
        Fix Version/s: 0.8.0
                       0.9.0
    Affects Version/s: 0.9.0
                       0.8.0
         Release Note: 
module import state is determined before and after user code is executed. The 
resolved modules are inspected and added to the pigContext, then they are added 
to the job jar.

this patch addresses the following import modes:
- import re, which will (if configured) find re on the filesystem in the jython 
install root
- import foo (which can import bar), this works now provided bar is resolvable 
JYTHON_HOME, JYTHONPATH, curdir, etc.
- from pkg import *, which works when the cachedir is writable
- import non.jvm.class, which works when the cachedir is writable
               Status: Patch Available  (was: Open)

This patch was developed against 0.8 trunk, i've tested in local mode and on 
the deployed grid.

I deprecated PigContext.scriptFiles because it's odd to have two ways to add 
script files to the jar, and i wanted to have the patch work with 0.8 and any 
code that might be written against the public member variable 'scriptFiles'. 
That code will work with this patch, it'll just produce a deprecation warning.

The name/file pair is needed to register files into the job jar with an 
appropriate relative path to allow jython to resolve it in the jar.

> Support import modules in Jython UDF
> ------------------------------------
>
>                 Key: PIG-1824
>                 URL: https://issues.apache.org/jira/browse/PIG-1824
>             Project: Pig
>          Issue Type: Improvement
>    Affects Versions: 0.8.0, 0.9.0
>            Reporter: Richard Ding
>            Assignee: Woody Anderson
>             Fix For: 0.9.0, 0.10, 0.8.0
>
>         Attachments: 1824.patch
>
>
> Currently, Jython UDF script doesn't support Jython import statement as in 
> the following example:
> {code}
> #!/usr/bin/python
> import re
> @outputSchema("word:chararray")
> def resplit(content, regex, index):
>         return re.compile(regex).split(content)[index]
> {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

Reply via email to