You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Jacob Perkins (JIRA)" <ji...@apache.org> on 2011/05/03 15:31:03 UTC
[jira] [Created] (PIG-2031) NPE in TOP
NPE in TOP
----------
Key: PIG-2031
URL: https://issues.apache.org/jira/browse/PIG-2031
Project: Pig
Issue Type: Bug
Reporter: Jacob Perkins
If a NULL DataBag is passed to org.apache.pig.builtin.TOP then a NPE is thrown. Consider:
{code}
$: cat foo.tsv
a {(foo,1),(bar,2)}
b
c {(fyha,4),(asdf,9)}
{code}
then:
{code}
data = LOAD 'foo.tsv' AS (key:chararray, a_bag:bag {t:tuple (name:chararray, value:int)});
tpd = FOREACH data {
top_n = TOP(1, 1, a_bag);
GENERATE
key AS key,
top_n AS top_n
;
};
DUMP tpd;
{code}
will throw an NPE when it gets to the row with no bag.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (PIG-2031) NPE in TOP
Posted by "Dmitriy V. Ryaboy (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIG-2031?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13028810#comment-13028810 ]
Dmitriy V. Ryaboy commented on PIG-2031:
----------------------------------------
Patch seems fine, thanks for doing that.
A new test that tries the null bag would be good.
> NPE in TOP
> ----------
>
> Key: PIG-2031
> URL: https://issues.apache.org/jira/browse/PIG-2031
> Project: Pig
> Issue Type: Bug
> Reporter: Jacob Perkins
> Attachments: toppatch.txt
>
>
> If a NULL DataBag is passed to org.apache.pig.builtin.TOP then a NPE is thrown. Consider:
> {code}
> $: cat foo.tsv
> a {(foo,1),(bar,2)}
> b
> c {(fyha,4),(asdf,9)}
> {code}
> then:
> {code}
> data = LOAD 'foo.tsv' AS (key:chararray, a_bag:bag {t:tuple (name:chararray, value:int)});
> tpd = FOREACH data {
> top_n = TOP(1, 1, a_bag);
> GENERATE
> key AS key,
> top_n AS top_n
> ;
> };
> DUMP tpd;
> {code}
> will throw an NPE when it gets to the row with no bag.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (PIG-2031) NPE in TOP
Posted by "Jakob Homan (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIG-2031?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jakob Homan updated PIG-2031:
-----------------------------
Assignee: Jacob Perkins
> NPE in TOP
> ----------
>
> Key: PIG-2031
> URL: https://issues.apache.org/jira/browse/PIG-2031
> Project: Pig
> Issue Type: Bug
> Reporter: Jacob Perkins
> Assignee: Jacob Perkins
> Labels: newbie
> Attachments: toppatch.txt
>
>
> If a NULL DataBag is passed to org.apache.pig.builtin.TOP then a NPE is thrown. Consider:
> {code}
> $: cat foo.tsv
> a {(foo,1),(bar,2)}
> b
> c {(fyha,4),(asdf,9)}
> {code}
> then:
> {code}
> data = LOAD 'foo.tsv' AS (key:chararray, a_bag:bag {t:tuple (name:chararray, value:int)});
> tpd = FOREACH data {
> top_n = TOP(1, 1, a_bag);
> GENERATE
> key AS key,
> top_n AS top_n
> ;
> };
> DUMP tpd;
> {code}
> will throw an NPE when it gets to the row with no bag.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (PIG-2031) NPE in TOP
Posted by "Dmitriy V. Ryaboy (Updated) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIG-2031?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dmitriy V. Ryaboy updated PIG-2031:
-----------------------------------
Attachment: PIG-2031.patch
Added a test (and while I was in there, simplified out some unnecessary casts in TestBuiltin).
I think this is good to commit, I intend to commit to both 0.10 branch and trunk tomorrow .
> NPE in TOP
> ----------
>
> Key: PIG-2031
> URL: https://issues.apache.org/jira/browse/PIG-2031
> Project: Pig
> Issue Type: Bug
> Reporter: Jacob Perkins
> Assignee: Jacob Perkins
> Labels: newbie
> Attachments: PIG-2031.patch, toppatch.txt
>
>
> If a NULL DataBag is passed to org.apache.pig.builtin.TOP then a NPE is thrown. Consider:
> {code}
> $: cat foo.tsv
> a {(foo,1),(bar,2)}
> b
> c {(fyha,4),(asdf,9)}
> {code}
> then:
> {code}
> data = LOAD 'foo.tsv' AS (key:chararray, a_bag:bag {t:tuple (name:chararray, value:int)});
> tpd = FOREACH data {
> top_n = TOP(1, 1, a_bag);
> GENERATE
> key AS key,
> top_n AS top_n
> ;
> };
> DUMP tpd;
> {code}
> will throw an NPE when it gets to the row with no bag.
--
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-2031) NPE in TOP
Posted by "Jacob Perkins (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIG-2031?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jacob Perkins updated PIG-2031:
-------------------------------
Attachment: toppatch.txt
Trivial fix but the case described runs through. Are there tests for this I should modify?
> NPE in TOP
> ----------
>
> Key: PIG-2031
> URL: https://issues.apache.org/jira/browse/PIG-2031
> Project: Pig
> Issue Type: Bug
> Reporter: Jacob Perkins
> Attachments: toppatch.txt
>
>
> If a NULL DataBag is passed to org.apache.pig.builtin.TOP then a NPE is thrown. Consider:
> {code}
> $: cat foo.tsv
> a {(foo,1),(bar,2)}
> b
> c {(fyha,4),(asdf,9)}
> {code}
> then:
> {code}
> data = LOAD 'foo.tsv' AS (key:chararray, a_bag:bag {t:tuple (name:chararray, value:int)});
> tpd = FOREACH data {
> top_n = TOP(1, 1, a_bag);
> GENERATE
> key AS key,
> top_n AS top_n
> ;
> };
> DUMP tpd;
> {code}
> will throw an NPE when it gets to the row with no bag.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira