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

Woody Anderson commented on PIG-1824:
-------------------------------------

ok. i understand your thoughts on static, and mostly i have them too, but the 
PythonInterpreter is a static member of the Interperter class, and the code i 
wrote must run BEFORE that interpreter is constructed.

Interpeter is a private inner class, so it cannot be caused to load before 
normal use patterns. So, moving the static block into the static block for 
Interpreter addresses your concerns.

import will not cause the static block to be executed btw, it's the first 
executed reference to the class. However, i take the point that some code could 
have been:
{code}
Class = JythonScriptEngine.class;
{code}
or something like that to cause the class to be loaded. Still, as i said: 
Interpreter static block addresses this, and the ctor is out b/c of the static 
nature of Interpreter.interpreter.

on second point:
i dont' see the point of a includeResources() method, if it can be done, it can 
be done in init(), if not it won't be done. Why add a new method?


> 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
>
>         Attachments: 1824.patch, 1824a.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