pig-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dmitriy V. Ryaboy (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (PIG-2031) NPE in TOP
Date Wed, 04 May 2011 16:26:03 GMT

    [ 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

Mime
View raw message