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

Builtin TOP udf is sensitive to null input bags

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.11
    • 0.11
    • internal-udfs
    • None
    • Patch Available

    Description

      TOP(max, sortField, inputBag) is sensitive to null inputBag arguments.

      In some cases it is preferable for a UDF to simply return null for null inputs e.g. to avoid conditional logic in a script.

      Most of the UDFs I write act this way, but TOP does not. This patch updates TOP to return null in the case where all input bags are null. Unit tests are included to confirm expected behavior.

      Attachments

        1. pig-null_safe_top.2.patch
          12 kB
          Andy Schlaikjer
        2. pig-null_safe_top.1.patch
          6 kB
          Andy Schlaikjer

        Activity

          People

            hazen Andy Schlaikjer
            hazen Andy Schlaikjer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: