You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Xuefu Zhang (JIRA)" <ji...@apache.org> on 2013/08/01 18:59:52 UTC

[jira] [Commented] (PIG-2530) Reusing alias name in nested foreach causes incorrect results

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

Xuefu Zhang commented on PIG-2530:
----------------------------------

[~daijy] Looking at the patch, I don't think we can simply removed previous its exprPlan when an alias is redefined. For instance, the query in PIG-3379 doesn't work with this patch.

The fix is probably not at the grammar, but rather at the data structure we use to represent these aliases and their expr plans.

Any thoughts? 
                
> Reusing alias name in nested foreach causes incorrect results
> -------------------------------------------------------------
>
>                 Key: PIG-2530
>                 URL: https://issues.apache.org/jira/browse/PIG-2530
>             Project: Pig
>          Issue Type: Bug
>    Affects Versions: 0.9.2, 0.10.0
>            Reporter: Vivek Padmanabhan
>            Assignee: Daniel Dai
>            Priority: Critical
>             Fix For: 0.10.0, 0.9.3, 0.11
>
>         Attachments: PIG-2530-0.patch, PIG-2530-1.patch, PIG-2530-2.patch
>
>
> The below script results in incorrect output for Pig 0.10 but runs fine with Pig 0.8,
> {code}
> input.txt
> 1	4
> 1	3
> 2	3
> 2	4
> {code}
> {code}
> a = load 'input.txt' as (v1:int, v2:int);
> b = group a by v1;
> c = foreach b { x = a; x = order x by v2 asc; generate flatten(x); }
> store c into 'c1';
> {code}
> Output from Pig 0.10
> --------------------
> 1       4
> 1       3
> 2       3
> 2       4
> Looking at the explain, it seems like the sorting is entirely missed out. 
> The script produces correct results if I change the alias name ie;
> c = foreach b { x = a; x1 = order x by v2 asc; generate flatten(x1); }

--
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