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

ANALYZE TABLE ... COMPUTE STATISTICS FOR COLUMNS fails with NPE if the table is empty

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 0.10.0
    • Fix Version/s: 0.11.0
    • Component/s: Statistics
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      ANALYZE TABLE ... COMPUTE STATISTICS FOR COLUMNS fails with NPE if the table is empty

      hive -e "create table empty_table (i int); select compute_stats(i, 16) from empty_table"
      
      
      java.lang.NullPointerException
      	at org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableIntObjectInspector.get(WritableIntObjectInspector.java:35)
      	at org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorUtils.getInt(PrimitiveObjectInspectorUtils.java:535)
      	at org.apache.hadoop.hive.ql.udf.generic.GenericUDAFComputeStats$GenericUDAFLongStatsEvaluator.iterate(GenericUDAFComputeStats.java:477)
      	at org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.aggregate(GenericUDAFEvaluator.java:139)
      	at org.apache.hadoop.hive.ql.exec.GroupByOperator.closeOp(GroupByOperator.java:1099)
      	at org.apache.hadoop.hive.ql.exec.Operator.close(Operator.java:558)
      	at org.apache.hadoop.hive.ql.exec.Operator.close(Operator.java:567)
      	at org.apache.hadoop.hive.ql.exec.Operator.close(Operator.java:567)
      	at org.apache.hadoop.hive.ql.exec.Operator.close(Operator.java:567)
      	at org.apache.hadoop.hive.ql.exec.ExecMapper.close(ExecMapper.java:193)
      	at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:61)
      	at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:428)
      	at org.apache.hadoop.mapred.MapTask.run(MapTask.java:340)
      	at org.apache.hadoop.mapred.LocalJobRunner$Job$MapTaskRunnable.run(LocalJobRunner.java:231)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
      	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      	at java.lang.Thread.run(Thread.java:662)
      org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.NullPointerException
      	at org.apache.hadoop.hive.ql.exec.GroupByOperator.closeOp(GroupByOperator.java:1132)
      	at org.apache.hadoop.hive.ql.exec.Operator.close(Operator.java:558)
      	at org.apache.hadoop.hive.ql.exec.Operator.close(Operator.java:567)
      	at org.apache.hadoop.hive.ql.exec.Operator.close(Operator.java:567)
      	at org.apache.hadoop.hive.ql.exec.Operator.close(Operator.java:567)
      	at org.apache.hadoop.hive.ql.exec.ExecMapper.close(ExecMapper.java:193)
      	at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:61)
      	at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:428)
      	at org.apache.hadoop.mapred.MapTask.run(MapTask.java:340)
      	at org.apache.hadoop.mapred.LocalJobRunner$Job$MapTaskRunnable.run(LocalJobRunner.java:231)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
      	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      	at java.lang.Thread.run(Thread.java:662)
      Caused by: java.lang.NullPointerException
      	at org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableIntObjectInspector.get(WritableIntObjectInspector.java:35)
      	at org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorUtils.getInt(PrimitiveObjectInspectorUtils.java:535)
      	at org.apache.hadoop.hive.ql.udf.generic.GenericUDAFComputeStats$GenericUDAFLongStatsEvaluator.iterate(GenericUDAFComputeStats.java:477)
      	at org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.aggregate(GenericUDAFEvaluator.java:139)
      	at org.apache.hadoop.hive.ql.exec.GroupByOperator.closeOp(GroupByOperator.java:1099)
      	... 15 more
      org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.NullPointerException
      	at org.apache.hadoop.hive.ql.exec.GroupByOperator.closeOp(GroupByOperator.java:1132)
      	at org.apache.hadoop.hive.ql.exec.Operator.close(Operator.java:558)
      	at org.apache.hadoop.hive.ql.exec.Operator.close(Operator.java:567)
      	at org.apache.hadoop.hive.ql.exec.Operator.close(Operator.java:567)
      	at org.apache.hadoop.hive.ql.exec.Operator.close(Operator.java:567)
      	at org.apache.hadoop.hive.ql.exec.ExecMapper.close(ExecMapper.java:193)
      	at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:61)
      	at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:428)
      	at org.apache.hadoop.mapred.MapTask.run(MapTask.java:340)
      	at org.apache.hadoop.mapred.LocalJobRunner$Job$MapTaskRunnable.run(LocalJobRunner.java:231)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
      	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      	at java.lang.Thread.run(Thread.java:662)
      Caused by: java.lang.NullPointerException
      	at org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableIntObjectInspector.get(WritableIntObjectInspector.java:35)
      	at org.apache.hadoop.mapred.MapTask.run(MapTask.java:340)
      	at org.apache.hadoop.mapred.LocalJobRunner$Job$MapTaskRunnable.run(LocalJobRunner.java:231)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
      	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      	at java.lang.Thread.run(Thread.java:662)
      Caused by: java.lang.NullPointerException
      	at org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableIntObjectInspector.get(WritableIntObjectInspector.java:35)
      	at org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorUtils.getInt(PrimitiveObjectInspectorUtils.java:535)
      	at org.apache.hadoop.hive.ql.udf.generic.GenericUDAFComputeStats$GenericUDAFLongStatsEvaluator.iterate(GenericUDAFComputeStats.java:477)
      	at org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.aggregate(GenericUDAFEvaluator.java:139)
      	at org.apache.hadoop.hive.ql.exec.GroupByOperator.closeOp(GroupByOperator.java:1099)
      	... 15 more
      
      

        Attachments

        1. HIVE-4119.2.patch
          28 kB
          Shreepadma Venugopalan
        2. HIVE-4119.1.patch
          28 kB
          Shreepadma Venugopalan

          Activity

            People

            • Assignee:
              shreepadma Shreepadma Venugopalan
              Reporter:
              lskuff Lenni Kuff
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: