Pig
  1. Pig
  2. PIG-2322

varargs functions do not get passed the arguments in Python embedding

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major 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!

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

        Activity

        Hide
        Julien Le Dem added a comment -

        Thanks Daniel. That was bad.

        Show
        Julien Le Dem added a comment - Thanks Daniel. That was bad.
        Hide
        Daniel Dai added a comment -

        PIG-2322-2.patch fix a unit test related to this patch.

        Show
        Daniel Dai added a comment - PIG-2322 -2.patch fix a unit test related to this patch.
        Hide
        Julien Le Dem added a comment -

        Patch allows using vararg UDFs in Jython

        Show
        Julien Le Dem added a comment - Patch allows using vararg UDFs in Jython
        Hide
        Alan Gates added a comment -

        +1

        Show
        Alan Gates added a comment - +1
        Hide
        Julien Le Dem added a comment -

        PIG-2322.patch fixes it and adds a test based on the example above

        Show
        Julien Le Dem added a comment - PIG-2322 .patch fixes it and adds a test based on the example above

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development