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

Jython UDF does not handle boolean output

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.11
    • None
    • None
    • Reviewed

    Description

      When a Jython UDF returns boolean, we still get integer object in Pig, through describe show the right boolean type.
      Jython UDF:

      @outputSchema("retired:boolean")
      def isretired(age):
          if age == None:
              return None
          elif age>=60:
              return True
          else:
              return False
      

      Pig script:

      register 'scriptingudf.py' using jython as myfuncs;
      a = load 'student.txt' as (name:chararray, age:int, gpa:double);
      b = foreach a generate name, myfuncs.isretired(age);
      describe b;
      dump b;
      

      Attachments

        1. PIG-2596.patch
          1.0 kB
          Aniket Namadeo Mokashi
        2. PIG-2596-2.patch
          2 kB
          Daniel Dai

        Issue Links

          Activity

            People

              aniket486 Aniket Namadeo Mokashi
              daijy Daniel Dai
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: