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

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

couple comments on this patch
1. the PigMacro.java and QueryParserDriver.java doesn't have PigServer 
instance, so not be able to get list of all alias, so cannot catch this problem 
there. Even we can get lastest alias from PigContext, but it will not work for 
below case
{noformat}
define simple_macro(in_relation, min_zip, max_age) returns c {
    b = filter $in_relation by zip >= $min_zip and age <= $max_age;
    $c = foreach b generate age, zip;
}
a = load 'users' as (user, age, zip);
d = load 'users' as (user, age, zip);
x = simple_macro('a', '3.0', '40');
store x into 'Macro_DefinitionAndInline_4.out';
{noformat}
so has to catch it in antlr grammer file

2. we could catch this issue in AliasMasker.g file, but it only throw 
RecognitionException, which doesn't have a good way to wrap error message. So 
handle it in AstValidator.g will be able to throw clear error message

3. [~daijy], could you please also take a look work around of PIG-2378? it also 
use single quoted argument as work around, it is not alias though, it is 
tuple.item. Is that workaround OK? Thanks a lot.
                
> 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