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

NullPointerException when I have multiple python udfs

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Trivial
    • Resolution: Invalid
    • 0.8.1, 0.9.1
    • 0.9.2
    • None
    • None

    Description

      When I have multiple python udfs registered, the script fails at compile phase while trying to get the udf ouputschema.

      register 'a.py' using org.apache.pig.scripting.jython.JythonScriptEngine as a_func;
      register 'b.py' using org.apache.pig.scripting.jython.JythonScriptEngine as b_func;
      a = load 'i1' as (f1:chararray);
      b = foreach a generate a_func.helloworld(), b_func.square(3);
      dump b;
      

      a.py

      @outputSchema("word:chararray")
      def helloworld():  
        return 'Hello, World'
      

      b.py

      @outputSchemaFunction("squareSchema")
      def square(num):
        return ((num)*(num))
      

      Moreover , in the log we can see duplicate and incorrect registration of udfs which I believe the cause for the script failure.
      INFO org.apache.pig.scripting.jython.JythonScriptEngine - Register scripting UDF: a_func.helloworld
      INFO org.apache.pig.scripting.jython.JythonScriptEngine - Register scripting UDF: b_func.square
      INFO org.apache.pig.scripting.jython.JythonScriptEngine - Register scripting UDF: b_func.helloworld

      This issue is observed in 0.9,0.8 and in trunk also.

      Attachments

        Issue Links

          Activity

            People

              xutingz xuting zhao
              vivekp Vivek Padmanabhan
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: