You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Eyal Allweil (JIRA)" <ji...@apache.org> on 2015/07/12 15:58:04 UTC

[jira] [Resolved] (PIG-2031) NPE in TOP

     [ https://issues.apache.org/jira/browse/PIG-2031?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eyal Allweil resolved PIG-2031.
-------------------------------
    Resolution: Fixed

The issue, as it's described, no longer occurs.

> 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 was sent by Atlassian JIRA
(v6.3.4#6332)