You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Vivek Padmanabhan (Created) (JIRA)" <ji...@apache.org> on 2012/02/13 10:48:59 UTC

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

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
            Reporter: Vivek Padmanabhan
            Priority: Critical


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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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

Posted by "Daniel Dai (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-2530?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13209638#comment-13209638 ] 

Daniel Dai commented on PIG-2530:
---------------------------------

Unit test pass. test-patch:
     [exec] -1 overall.  
     [exec] 
     [exec]     +1 @author.  The patch does not contain any @author tags.
     [exec] 
     [exec]     +1 tests included.  The patch appears to include 3 new or modified tests.
     [exec] 
     [exec]     -1 javadoc.  The javadoc tool appears to have generated 1 warning messages.
     [exec] 
     [exec]     +1 javac. 
     [exec]  The applied patch does not increase the total number of javac compiler warnings.
     [exec] 
     [exec]     +1 findbugs.  The patch does not introduce any new Findbugs warnings.
     [exec] 
     [exec]     -1 release audit.  The applied patch generated 529 release audit warnings (more than the trunk's current 526 warnings).

javac and release audit warning are unrelated.

Patch is ready to review.
                
> 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
>            Reporter: Vivek Padmanabhan
>            Priority: Critical
>         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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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

Posted by "Daniel Dai (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIG-2530?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Dai updated PIG-2530:
----------------------------

    Attachment: PIG-2530-0.patch

Attach a draft patch
                
> 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
>            Reporter: Vivek Padmanabhan
>            Priority: Critical
>         Attachments: PIG-2530-0.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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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

Posted by "Daniel Dai (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIG-2530?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Dai resolved PIG-2530.
-----------------------------

       Resolution: Fixed
    Fix Version/s: 0.11
                   0.10
         Assignee: Daniel Dai
     Hadoop Flags: Reviewed

Patch committed to 0.10/trunk.
                
> 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
>            Reporter: Vivek Padmanabhan
>            Assignee: Daniel Dai
>            Priority: Critical
>             Fix For: 0.10, 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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

Posted by "Daniel Dai (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIG-2530?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Dai updated PIG-2530:
----------------------------

    Attachment: PIG-2530-2.patch

Attach a better fix PIG-2530-2.patch. Thanks Thomas for adding tests.
                
> 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
>            Reporter: Vivek Padmanabhan
>            Priority: Critical
>         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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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

Posted by "Thomas Weise (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIG-2530?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Weise updated PIG-2530:
------------------------------

    Fix Version/s: 0.9.3
    
> 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
>            Reporter: Vivek Padmanabhan
>            Assignee: Daniel Dai
>            Priority: Critical
>             Fix For: 0.10, 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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

Posted by "Thomas Weise (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-2530?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13210782#comment-13210782 ] 

Thomas Weise commented on PIG-2530:
-----------------------------------

Unit tests pass on 0.9 branch, would be good to commit there since it is producing false positives.
                
> 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
>            Reporter: Vivek Padmanabhan
>            Assignee: Daniel Dai
>            Priority: Critical
>             Fix For: 0.10, 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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

Posted by "Thejas M Nair (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-2530?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13209685#comment-13209685 ] 

Thejas M Nair commented on PIG-2530:
------------------------------------

+1 .

Note that this bug happens when an nested foreach operator is assigned to another and then same is reused for another operator. In the example in description -

{code}
c = foreach b { 
        x = a; -- a is assinged to x
        x = order x by v2 asc;      -- x is reused 
        generate flatten(x);        -- because of the bug, x was substituted with a
    }

{code}
                
> 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
>            Reporter: Vivek Padmanabhan
>            Priority: Critical
>         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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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

Posted by "Thomas Weise (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIG-2530?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Weise updated PIG-2530:
------------------------------

    Attachment: PIG-2530-1.patch

Adding test case.
                
> 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
>            Reporter: Vivek Padmanabhan
>            Priority: Critical
>         Attachments: PIG-2530-0.patch, PIG-2530-1.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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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

Posted by "Daniel Dai (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-2530?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13212309#comment-13212309 ] 

Daniel Dai commented on PIG-2530:
---------------------------------

Committed to 0.9 branch as well.
                
> 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
>            Reporter: Vivek Padmanabhan
>            Assignee: Daniel Dai
>            Priority: Critical
>             Fix For: 0.10, 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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

Posted by "Thomas Weise (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-2530?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13209664#comment-13209664 ] 

Thomas Weise commented on PIG-2530:
-----------------------------------

Unit tests pass on 0.10

                
> 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
>            Reporter: Vivek Padmanabhan
>            Priority: Critical
>         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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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

Posted by "Vivek Padmanabhan (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-2530?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13210081#comment-13210081 ] 

Vivek Padmanabhan commented on PIG-2530:
----------------------------------------

Thanks a lot Daniel and Thomas. Does the patch apply for 0.9.2 as well ? or is 0.9.2 having a different behavior.
                
> 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
>            Reporter: Vivek Padmanabhan
>            Assignee: Daniel Dai
>            Priority: Critical
>             Fix For: 0.10, 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira