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

NPE when inserting NULL value in structure and array with HBase table

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 3.0.0
    • HBase Handler
    • None

    Description

      STR (Structure)

      STEP 1. Create tables

      CREATE TABLE IF NOT EXISTS t1 (id INT);
      INSERT INTO TABLE t1 VALUES (1),(2),(3),(4),(5);
      CREATE TABLE IF NOT EXISTS `htable`(
        `id` INT, 
        `map_column` STRUCT<s_int:INT,s_string:STRING,s_date:DATE>) ROW FORMAT SERDE 'org.apache.hadoop.hive.hbase.HBaseSerDe'  STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'  WITH SERDEPROPERTIES (   'hbase.columns.mapping'=':key,id:id',    'serialization.format'='1') TBLPROPERTIES ( 'hbase.table.name'='tmp/h');
      

      STEP 2. Insert into table stored in HBase the struct with NULL value in it

      INSERT INTO `htable` SELECT 2,NAMED_STRUCT("s_int",CAST(NULL AS INT),"s_string","s1","s_date",CAST('2018-03-12' AS DATE)) FROM t1 LIMIT 1;
      

      ACTUAL RESULT

      The query fails with NPE.

      Diagnostic Messages for this Task:
      Error: java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runtime Error while processing row (tag=0) {"key":{},"value":{"_col0":2,"_col1":{"s_int":null,"s_string":"s1","s_date":"2018-03-12"}}}
      	at org.apache.hadoop.hive.ql.exec.mr.ExecReducer.reduce(ExecReducer.java:257)
      	at org.apache.hadoop.mapred.ReduceTask.runOldReducer(ReduceTask.java:444)
      	at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:392)
      	at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:163)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at javax.security.auth.Subject.doAs(Subject.java:422)
      	at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1631)
      	at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)
      Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runtime Error while processing row (tag=0) {"key":{},"value":{"_col0":2,"_col1":{"s_int":null,"s_string":"s1","s_date":"2018-03-12"}}}
      	at org.apache.hadoop.hive.ql.exec.mr.ExecReducer.reduce(ExecReducer.java:245)
      	... 7 more
      Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: org.apache.hadoop.hive.serde2.SerDeException: java.lang.NullPointerException
      	at org.apache.hadoop.hive.ql.exec.FileSinkOperator.process(FileSinkOperator.java:787)
      	at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:879)
      	at org.apache.hadoop.hive.ql.exec.LimitOperator.process(LimitOperator.java:63)
      	at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:879)
      	at org.apache.hadoop.hive.ql.exec.SelectOperator.process(SelectOperator.java:95)
      	at org.apache.hadoop.hive.ql.exec.mr.ExecReducer.reduce(ExecReducer.java:236)
      	... 7 more
      Caused by: org.apache.hadoop.hive.serde2.SerDeException: java.lang.NullPointerException
      	at org.apache.hadoop.hive.hbase.HBaseSerDe.serialize(HBaseSerDe.java:301)
      	at org.apache.hadoop.hive.ql.exec.FileSinkOperator.process(FileSinkOperator.java:714)
      	... 12 more
      Caused by: java.lang.NullPointerException
      	at org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableIntObjectInspector.get(WritableIntObjectInspector.java:36)
      	at org.apache.hadoop.hive.serde2.lazy.LazyUtils.writePrimitiveUTF8(LazyUtils.java:239)
      	at org.apache.hadoop.hive.hbase.HBaseRowSerializer.serialize(HBaseRowSerializer.java:236)
      	at org.apache.hadoop.hive.hbase.HBaseRowSerializer.serialize(HBaseRowSerializer.java:295)
      	at org.apache.hadoop.hive.hbase.HBaseRowSerializer.serialize(HBaseRowSerializer.java:222)
      	at org.apache.hadoop.hive.hbase.HBaseRowSerializer.serializeField(HBaseRowSerializer.java:194)
      	at org.apache.hadoop.hive.hbase.HBaseRowSerializer.serialize(HBaseRowSerializer.java:118)
      	at org.apache.hadoop.hive.hbase.HBaseSerDe.serialize(HBaseSerDe.java:297)
      	... 13 more
      

      EXPECTED RESULT

      The query finished successfully.

      STR (arrays)

      STEP 1. Create tables

      CREATE TABLE hbase_list(id INT, list_column array<string>) ROW FORMAT SERDE 'org.apache.hadoop.hive.hbase.HBaseSerDe' STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ('hbase.columns.mapping'=':key,id:id', 'serialization.format'='1') TBLPROPERTIES ( 'hbase.table.name'='tmp/htest');
      

      STEP 2. Insert into table stored in HBase the array with NULL value in it

      insert into hbase_list SELECT 2, array("a", CAST (NULL AS STRING),  "b") FROM t1 LIMIT 1;
      

      ACTUAL RESULT

      The query fails with NPE.

      Diagnostic Messages for this Task:
      Error: java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runtime Error while processing row (tag=0) {"key":{},"value":{"_col0":2,"_col1":["a",null,"b"]}}
      	at org.apache.hadoop.hive.ql.exec.mr.ExecReducer.reduce(ExecReducer.java:257)
      	at org.apache.hadoop.mapred.ReduceTask.runOldReducer(ReduceTask.java:444)
      	at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:392)
      	at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:163)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at javax.security.auth.Subject.doAs(Subject.java:422)
      	at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1631)
      	at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)
      Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runtime Error while processing row (tag=0) {"key":{},"value":{"_col0":2,"_col1":["a",null,"b"]}}
      	at org.apache.hadoop.hive.ql.exec.mr.ExecReducer.reduce(ExecReducer.java:245)
      	... 7 more
      Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: org.apache.hadoop.hive.serde2.SerDeException: java.lang.NullPointerException
      	at org.apache.hadoop.hive.ql.exec.FileSinkOperator.process(FileSinkOperator.java:787)
      	at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:879)
      	at org.apache.hadoop.hive.ql.exec.LimitOperator.process(LimitOperator.java:63)
      	at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:879)
      	at org.apache.hadoop.hive.ql.exec.SelectOperator.process(SelectOperator.java:95)
      	at org.apache.hadoop.hive.ql.exec.mr.ExecReducer.reduce(ExecReducer.java:236)
      	... 7 more
      Caused by: org.apache.hadoop.hive.serde2.SerDeException: java.lang.NullPointerException
      	at org.apache.hadoop.hive.hbase.HBaseSerDe.serialize(HBaseSerDe.java:301)
      	at org.apache.hadoop.hive.ql.exec.FileSinkOperator.process(FileSinkOperator.java:714)
      	... 12 more
      Caused by: java.lang.NullPointerException
      	at org.apache.hadoop.hive.serde2.lazy.LazyUtils.writePrimitiveUTF8(LazyUtils.java:260)
      	at org.apache.hadoop.hive.hbase.HBaseRowSerializer.serialize(HBaseRowSerializer.java:236)
      	at org.apache.hadoop.hive.hbase.HBaseRowSerializer.serialize(HBaseRowSerializer.java:251)
      	at org.apache.hadoop.hive.hbase.HBaseRowSerializer.serialize(HBaseRowSerializer.java:222)
      	at org.apache.hadoop.hive.hbase.HBaseRowSerializer.serializeField(HBaseRowSerializer.java:194)
      	at org.apache.hadoop.hive.hbase.HBaseRowSerializer.serialize(HBaseRowSerializer.java:118)
      	at org.apache.hadoop.hive.hbase.HBaseSerDe.serialize(HBaseSerDe.java:297)
      	... 13 more
      

      EXPECTED RESULT

      The query finished successfully.

      Attachments

        1. HIVE-18975.1.patch
          7 kB
          Oleksiy Sayankin
        2. HIVE-18975.2.patch
          12 kB
          Oleksiy Sayankin

        Issue Links

          Activity

            People

              osayankin Oleksiy Sayankin
              osayankin Oleksiy Sayankin
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: