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

Overlapping of parameter substitution names inside&outside a macro fails with NPE

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.12.0
    • 0.16.0
    • parser
    • None
    • Reviewed
    • Now, macro argument/return names can overlap with parameter substitution names. Former value is taken for these cases.

    Description

      With

      macro.pig
      DEFINE mygroupby(REL, key) RETURNS G {
         %declare number 333;
         $G = GROUP $REL by $key parallel $number;
      };
      

      and

      test.pig
      -- equivalent of -param number=111
      %declare number 111;
      
      IMPORT 'macro.pig';
      data = LOAD '1234.txt' USING PigStorage() AS (i: int);
      result = mygroupby(data, i);
      STORE result INTO 'test.out' USING PigStorage();
      

      Fails with
      error msg: <file myscript.pig, line 4> Macro inline failed for macro 'mygroupby'. Reason: null

      Similarly, when macro param and command-line param overlap, it fails with
      Macro inline failed for macro 'mygroupby'. Reason: Macro contains argument or return value number which conflicts with a Pig parameter of the same name.

      Attachments

        1. pig-4880-v01_documentudpate.patch
          1 kB
          Koji Noguchi
        2. pig-4880-v01.patch
          7 kB
          Koji Noguchi

        Issue Links

          Activity

            People

              knoguchi Koji Noguchi
              knoguchi Koji Noguchi
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: