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

TOBAG wraps tuple parameters in another tuple

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.9.0
    • Fix Version/s: 0.10.0
    • Component/s: internal-udfs
    • Labels:
      None
    • Patch Info:
      Patch Available
    • Release Note:
      If the argument to TOBAG is a tuple, it does not get inserted into another tuple before being added to the bag.

      Description

      The TOBAG function indiscriminately wraps all parameters in a tuple. When I pass a list of tuples to the function, I would expect it to return a bag containing those tuples. Instead, it returns a bag containing single element tuples, where each tuple contains one of the tuples passed in.

      Example:

      tuples.txt
      (mike,608)
      (ryan,11624)
      (justin,2317)
      
      Demonstration using pig 0.9.0
      grunt> TUPLE_DATA = LOAD 'tuples.txt' AS (T:tuple(name:chararray,street_number:int));
      grunt> BAGGED = FOREACH TUPLE_DATA GENERATE TOBAG(T);
      grunt> DESCRIBE BAGGED;
      BAGGED: {{(name: chararray,street_number: int)}}
      grunt> DUMP BAGGED;
      ({((mike,608))})
      ({((ryan,11624))})
      ({((justin,2317))})
      

        Attachments

        1. pig-2290.1.patch
          4 kB
          Thejas M Nair
        2. pig-2290.patch
          3 kB
          Ryan Hoegg

          Activity

            People

            • Assignee:
              ryan.hoegg Ryan Hoegg
              Reporter:
              ryan.hoegg Ryan Hoegg
            • Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: