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

varargs functions do not get passed the arguments in Python embedding

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.11
    • Component/s: None
    • Labels:
      None
    • Patch Info:
      Patch Available

      Description

      from Stan:

      Hi,

      I have a simple python udf which takes a variable number of (string)
      arguments and returns the first non-empty one.
      I can see that the udf is invoked from pig but no arguments are being passed.

      Here is the script:
      =========================================================

      #!/usr/bin/python

      from org.apache.pig.scripting import *

      @outputSchema("s:chararray")
      def firstNonempty(*args):
      print args
      for v in args:
      if len(v) != 0:
      return v
      return ''

      if _name_ == "_main_":
      Pig.compile("""
      data = load 'input.txt' AS (string1:chararray, string2:chararray);
      data = foreach data generate firstNonempty(string1, string2) as id,
      string1, string2;
      dump data;
      """).bind().runSingle()

      ===========================================================

      Thanks!

        Attachments

        1. PIG-2322-2.patch
          0.6 kB
          Daniel Dai
        2. PIG-2322.patch
          4 kB
          Julien Le Dem

          Activity

            People

            • Assignee:
              julienledem Julien Le Dem
              Reporter:
              julienledem Julien Le Dem
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: