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

Statistics: NPE when getting Date column partition statistics

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.1, 4.0.0
    • Fix Version/s: 4.0.0
    • Environment:

      Tested on versions `1.2.1` and the latest 4.0.0-SNAPSHOT

      Description

      The issue reproduces only for a date column for a partitioned table. It reproduces only if the date column has all the values set to null, and if the partition is not empty.

      Here is a quick reproducer:

       

       

      CREATE TABLE dummy_table (
      c_date DATE,
      c_bigint BIGINT
      )
      PARTITIONED BY (ds STRING);
      
      INSERT OVERWRITE TABLE dummy_table PARTITION (ds='2018-01-01') SELECT CAST(null AS DATE), CAST(null AS BIGINT) FROM <any non empty table>;
      
      ANALYZE TABLE dummy_table COMPUTE STATISTICS FOR COLUMNS;
      
      DESCRIBE FORMATTED dummy_table.c_bigint PARTITION (ds='2018-01-01');
      DESCRIBE FORMATTED dummy_table.c_date PARTITION (ds='2018-01-01');
      

       

       

      The first `DESCRIBE FORMATTED` statement succeeds, when the second fails with an `NPE`

       

      It happens because the null check is missing when converting Object from the ObjectStore to the Thrift object. The null check is missing only in the date statistics conversion for the partitioned table. 

      Missing: https://github.com/apache/hive/blob/master/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/StatObjectConverter.java#L469

      Present: https://github.com/apache/hive/blob/master/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/StatObjectConverter.java#L298

       

        Attachments

          Activity

            People

            • Assignee:
              arhimondr Andy Rosa
              Reporter:
              arhimondr Andy Rosa
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: