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

Johnny Zhang commented on PIG-2244:
-----------------------------------

[~xuefuz], thanks for your comments! I think the current patch 
https://issues.apache.org/jira/secure/attachment/12578105/PIG-2244.patch.txt 
address the issue:

1) without the patch, 'a' is substituted to macro_simple_macro_a_0 by following 
logic
{noformat}
    return params.contains( alias )
        ? alias
        : "macro_" + macroName + "_" + alias + "_" + index;
{noformat}

2) with the patch, 'a' is still kept as 'a' by following change
{noformat}
    if (params.contains("'" + alias + "'")) {
        return "'" + alias + "'";
    } else if (params.contains( alias )) {
        return alias;
    } else {
        return "macro_" + macroName + "_" + alias + "_" + index;
    }
{noformat}

'a' is later on catch by AstValidator.g and throw cleaner exception message 
{noformat}
Undefined alias: should not use quoted alias 'a' as macro arguments
{noformat}

overall, I think this patch disallow quoted alias like 'a', and throw better 
error message in meanwhile.

                
> Macros cannot be passed relation names
> --------------------------------------
>
>                 Key: PIG-2244
>                 URL: https://issues.apache.org/jira/browse/PIG-2244
>             Project: Pig
>          Issue Type: Bug
>          Components: parser
>    Affects Versions: 0.9.0
>            Reporter: Alan Gates
>            Assignee: Johnny Zhang
>            Priority: Minor
>         Attachments: PIG-2244.patch.txt, PIG-2244.patch.txt, 
> PIG-2244.patch.txt
>
>
> If an alias is passed quoted, it gets expanded as if it were an alias in the 
> macro, which leads to a very strange error message.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to