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

Viraj Bhat updated PIG-3265:
----------------------------

    Description: 
Pig uses Python UDF registered in the last name space as you can see below 
using a Pig script like this:
{code}
-- test_jython.pig --
register 'B.py' using org.apache.pig.scripting.jython.JythonScriptEngine as B;
register 'A.py' using org.apache.pig.scripting.jython.JythonScriptEngine as A;

I = load 'test.txt' as v;
O = foreach I generate A.a(v) as a, A.b(v) as b;
dump O;
-- END --
{code}

A.py
{code}
@outputSchema("word:int")
def a(v):
    return 'a
{code}

B.py 
{code}
@outputSchema("word1:int")
def b(v):
    return 'b'
{code}

data.txt
{code}
1
2
3
{code}


2013-04-01 20:17:36,338 [main] INFO  
org.apache.pig.scripting.jython.JythonScriptEngine - Register scripting UDF: B.b
2013-04-01 20:17:36,377 [main] INFO  
org.apache.pig.scripting.jython.JythonScriptEngine - Register scripting UDF: A.b
2013-04-01 20:17:36,378 [main] INFO  
org.apache.pig.scripting.jython.JythonScriptEngine - Register scripting UDF: A.a

The class JythonScriptEngine.java, and function: registerFunctions(), a hashmap 
in PigContext is populated with latest namespace and function. This needs to be 
changed and a check should be conducted before populating the hashmap. A unit 
test also needs to be written.

This seems to be related to https://issues.apache.org/jira/browse/PIG-2404 
which was closed as INVALID
Viraj

  was:
Pig uses Python UDF registered in the last name space as you can see below 
using a Pig script like this:
{code}
-- test_jython.pig --
register 'B.py' using org.apache.pig.scripting.jython.JythonScriptEngine as B;
register 'A.py' using org.apache.pig.scripting.jython.JythonScriptEngine as A;

I = load 'test.txt' as v;
O = foreach I generate A.a(v) as a, A.b(v) as b;
dump O;
-- END --
{code}

A.py
{code}
@outputSchema("word:int")
def a(v):
    return 'a
{code}

B.py 
{code}
@outputSchema("word1:int")
def b(v):
    return 'b'
{code}

data.txt
{code}
1
2
3
{code}


{comment}
2013-04-01 20:17:36,338 [main] INFO  
org.apache.pig.scripting.jython.JythonScriptEngine - Register scripting UDF: B.b
2013-04-01 20:17:36,377 [main] INFO  
org.apache.pig.scripting.jython.JythonScriptEngine - Register scripting UDF: A.b
2013-04-01 20:17:36,378 [main] INFO  
org.apache.pig.scripting.jython.JythonScriptEngine - Register scripting UDF: A.a
{comment}

The class JythonScriptEngine.java, and function: registerFunctions(), a hashmap 
in PigContext is populated with latest namespace and function. This needs to be 
changed and a check should be conducted before populating the hashmap. A unit 
test also needs to be written.
Viraj

    
> Pig uses Python UDF registered in the last name space
> -----------------------------------------------------
>
>                 Key: PIG-3265
>                 URL: https://issues.apache.org/jira/browse/PIG-3265
>             Project: Pig
>          Issue Type: Bug
>          Components: impl
>    Affects Versions: 0.9.2, 0.10.0, 0.11
>            Reporter: Viraj Bhat
>
> Pig uses Python UDF registered in the last name space as you can see below 
> using a Pig script like this:
> {code}
> -- test_jython.pig --
> register 'B.py' using org.apache.pig.scripting.jython.JythonScriptEngine as B;
> register 'A.py' using org.apache.pig.scripting.jython.JythonScriptEngine as A;
> I = load 'test.txt' as v;
> O = foreach I generate A.a(v) as a, A.b(v) as b;
> dump O;
> -- END --
> {code}
> A.py
> {code}
> @outputSchema("word:int")
> def a(v):
>     return 'a
> {code}
> B.py 
> {code}
> @outputSchema("word1:int")
> def b(v):
>     return 'b'
> {code}
> data.txt
> {code}
> 1
> 2
> 3
> {code}
> 2013-04-01 20:17:36,338 [main] INFO  
> org.apache.pig.scripting.jython.JythonScriptEngine - Register scripting UDF: 
> B.b
> 2013-04-01 20:17:36,377 [main] INFO  
> org.apache.pig.scripting.jython.JythonScriptEngine - Register scripting UDF: 
> A.b
> 2013-04-01 20:17:36,378 [main] INFO  
> org.apache.pig.scripting.jython.JythonScriptEngine - Register scripting UDF: 
> A.a
> The class JythonScriptEngine.java, and function: registerFunctions(), a 
> hashmap in PigContext is populated with latest namespace and function. This 
> needs to be changed and a check should be conducted before populating the 
> hashmap. A unit test also needs to be written.
> This seems to be related to https://issues.apache.org/jira/browse/PIG-2404 
> which was closed as INVALID
> Viraj

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to