[ 
https://issues.apache.org/jira/browse/PIG-4880?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15257145#comment-15257145
 ] 

Koji Noguchi commented on PIG-4880:
-----------------------------------

{quote}
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.}}
{quote}

Sample code.

{code:title=macro.pig}
DEFINE mygroupby(REL, key, number) RETURNS G {
   $G = GROUP $REL by $key parallel $number;
};
{code}

{code:title=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, 222);
STORE result INTO 'test.out' USING PigStorage();
{code}

I think we can allow this by simply taking the macro parameter value.

> Overlapping of parameter substitution names inside&outside a macro fails with 
> NPE
> ---------------------------------------------------------------------------------
>
>                 Key: PIG-4880
>                 URL: https://issues.apache.org/jira/browse/PIG-4880
>             Project: Pig
>          Issue Type: Bug
>          Components: parser
>    Affects Versions: 0.12.0
>            Reporter: Koji Noguchi
>            Assignee: Koji Noguchi
>
> With 
> {code:title=macro.pig}
> DEFINE mygroupby(REL, key) RETURNS G {
>    %declare number 333;
>    $G = GROUP $REL by $key parallel $number;
> };
> {code}
> and
> {code:title=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();
> {code}
> 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.}}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to