Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-1011

GenericUDTFExplode() throws NPE when given nulls

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.6.0
    • Query Processor
    • None
    • Reviewed

    Description

      When explode() is called on rows where the array column is null, a null pointer exception is thrown.

      For example consider having a table named test with the following rows

      key     value
      1       [1,2,3]
      2       null 
      

      Then running the query

      SELECT explode(value) AS myCol FROM test;
      
      or
      
      SELECT * FROM test LATERAL VIEW explode(value) myTab AS myCol;
      

      will throw a null pointer exception when explode() gets the null value from the 2nd row.

      Possible options are:

      1. Treat null values as an error and make the user fix null values in data
      2. explode(null) generates a null output value.
      3. explode(null) generates no output values

      #2 means that explode(null) and explode(array(null)) will behave identically. Because of that, I think #3 makes the most sense.

      Attachments

        1. HIVE-1011.1.patch
          2 kB
          Paul Yang

        Activity

          People

            pauly Paul Yang
            pauly Paul Yang
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: