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

generated field in nested foreach does not inherit the variable name as the field name

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.11, 0.12.0
    • None
    • None

    Description

      raw_data = load 'xyz' using Loader() as (field_a, field_b, field_c);
      records = foreach raw_data {
        generated_field = (field_a is null ? '-' : someUDF(field_b)); 
        GENERATE
          field_c,
          generated_field
        ;
      }
      describe records;
      

      One would expect the generated_field to have a field name, similar to the field_c that is from the original relation. However, Pig currently doesn't assign the field name by default. It'd be nice if we can assign the variable name as the default field name.

      Attachments

        1. PIG-2937-4_whitespace.patch
          73 kB
          Jonathan Coveney
        2. PIG-2937-3_whitespace.patch
          73 kB
          Jonathan Coveney
        3. PIG-2937-3_nowhitespace.patch
          23 kB
          Jonathan Coveney
        4. PIG-2937-2.patch
          4 kB
          Jonathan Coveney
        5. PIG-2937-1.patch
          2 kB
          Jonathan Coveney
        6. PIG-2937-0.patch
          2 kB
          Jonathan Coveney

        Activity

          People

            jcoveney Jonathan Coveney
            pengfeng Feng Peng
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: