Uploaded image for project: 'Pig'
  1. Pig
  2. PIG-2031

NPE in TOP

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • None
    • None

    Description

      If a NULL DataBag is passed to org.apache.pig.builtin.TOP then a NPE is thrown. Consider:

      $: cat foo.tsv
      a  {(foo,1),(bar,2)}
      b
      c  {(fyha,4),(asdf,9)}
      

      then:

      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;
      

      will throw an NPE when it gets to the row with no bag.

      Attachments

        1. PIG-2031.patch
          13 kB
          Dmitriy V. Ryaboy
        2. toppatch.txt
          0.5 kB
          Jacob Perkins

        Activity

          People

            thedatachef Jacob Perkins
            thedatachef Jacob Perkins
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: