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

Richard Ding commented on PIG-1999:
-----------------------------------

The proposed solution is, in 0.9 release, disallow user defined schema inside a 
macro to have names that conflict with alias in the macro. Parser will throw an 
exception when it detects a name conflict in macro.

This is not a perfect solution. But this kind of name-conflict is not common in 
Pig scripts and any conflict can be easily fixed with clear error messages.

As mentioned before, we need schema context to solve this problem. Now schema 
resolution happens after parsing. If needed, we'll address this problem in 
future release.

 

> Macro alias masker should consider schema context 
> --------------------------------------------------
>
>                 Key: PIG-1999
>                 URL: https://issues.apache.org/jira/browse/PIG-1999
>             Project: Pig
>          Issue Type: Bug
>          Components: impl
>    Affects Versions: 0.9.0
>            Reporter: Richard Ding
>            Assignee: Richard Ding
>             Fix For: 0.9.0
>
>
> Macro alias masker doesn't consider the current schema context. This results 
> errors when deciding with alias to mask. Here is an example:
> {code}
> define toBytearray(in, intermediate) returns e { 
>    a = load '$in' as (name:chararray, age:long, gpa: float);
>    b = group a by  name;
>    c = foreach b generate a, (1,2,3);
>    store c into '$intermediate' using BinStorage();
>    d = load '$intermediate' using BinStorage() as (b:bag{t:tuple(x,y,z)}, 
> t2:tuple(a,b,c));
>    $e = foreach d generate COUNT(b), t2.a, t2.b, t2.c;
> };
>  
> f = toBytearray ('data', 'output1');
> {code} 
> Now the alias masker mistakes b in COUNT(b) as an alias instead of b in the 
> current schema.
> The workaround is to not use alias as as names in the schema definition. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to