Uploaded image for project: 'Pig'
  1. Pig
  2. PIG-3265

Pig uses Python UDF registered in the last name space

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 0.9.2, 0.10.0, 0.11
    • None
    • impl
    • None

    Description

      Pig uses Python UDF registered in the last name space as you can see below using a Pig script like this:

      -- 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 --
      

      A.py

      @outputSchema("word:int")
      def a(v):
          return 'a
      

      B.py

      @outputSchema("word1:int")
      def b(v):
          return 'b'
      

      data.txt

      1
      2
      3
      

      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

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              viraj Viraj Bhat
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: