You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Yongzhi Chen (JIRA)" <ji...@apache.org> on 2018/03/17 12:12:00 UTC

[jira] [Comment Edited] (HIVE-18975) NPE when inserting NULL value in structure and array with HBase table

    [ https://issues.apache.org/jira/browse/HIVE-18975?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16403402#comment-16403402 ] 

Yongzhi Chen edited comment on HIVE-18975 at 3/17/18 12:11 PM:
---------------------------------------------------------------

You need fix code style:
{noformat}
./hbase-handler/src/java/org/apache/hadoop/hive/hbase/HBaseRowSerializer.java:251:            if (list.get(i) != null) {: warning: 'if' have incorrect indentation level 12, expected level should be 10.
./hbase-handler/src/java/org/apache/hadoop/hive/hbase/HBaseRowSerializer.java:252:              serialize(list.get(i), eoi, level + 1, ss);: warning: 'if' child have incorrect indentation level 14, expected level should be 12.
./hbase-handler/src/java/org/apache/hadoop/hive/hbase/HBaseRowSerializer.java:253:            }: warning: 'if rcurly' have incorrect indentation level 12, expected level should be 10.
./hbase-handler/src/java/org/apache/hadoop/hive/hbase/HBaseRowSerializer.java:297:            if (list.get(i) != null) {: warning: 'if' have incorrect indentation level 12, expected level should be 10.
./hbase-handler/src/java/org/apache/hadoop/hive/hbase/HBaseRowSerializer.java:298:              serialize(list.get(i), fields.get(i).getFieldObjectInspector(), level + 1, ss);: warning: 'if' child have incorrect indentation level 14, expected level should be 12.
./hbase-handler/src/java/org/apache/hadoop/hive/hbase/HBaseRowSerializer.java:299:            }: warning: 'if rcurly' have incorrect indentation level 12, expected level should be 10.

{noformat}


was (Author: ychena):
You need fix code style:
./hbase-handler/src/java/org/apache/hadoop/hive/hbase/HBaseRowSerializer.java:251:            if (list.get(i) != null) {: warning: 'if' have incorrect indentation level 12, expected level should be 10.
./hbase-handler/src/java/org/apache/hadoop/hive/hbase/HBaseRowSerializer.java:252:              serialize(list.get(i), eoi, level + 1, ss);: warning: 'if' child have incorrect indentation level 14, expected level should be 12.
./hbase-handler/src/java/org/apache/hadoop/hive/hbase/HBaseRowSerializer.java:253:            }: warning: 'if rcurly' have incorrect indentation level 12, expected level should be 10.
./hbase-handler/src/java/org/apache/hadoop/hive/hbase/HBaseRowSerializer.java:297:            if (list.get(i) != null) {: warning: 'if' have incorrect indentation level 12, expected level should be 10.
./hbase-handler/src/java/org/apache/hadoop/hive/hbase/HBaseRowSerializer.java:298:              serialize(list.get(i), fields.get(i).getFieldObjectInspector(), level + 1, ss);: warning: 'if' child have incorrect indentation level 14, expected level should be 12.
./hbase-handler/src/java/org/apache/hadoop/hive/hbase/HBaseRowSerializer.java:299:            }: warning: 'if rcurly' have incorrect indentation level 12, expected level should be 10.

> NPE when inserting NULL value in structure and array with HBase table
> ---------------------------------------------------------------------
>
>                 Key: HIVE-18975
>                 URL: https://issues.apache.org/jira/browse/HIVE-18975
>             Project: Hive
>          Issue Type: Bug
>          Components: HBase Handler
>            Reporter: Oleksiy Sayankin
>            Assignee: Oleksiy Sayankin
>            Priority: Major
>             Fix For: 3.0.0
>
>         Attachments: HIVE-18975.1.patch
>
>
> STR (Structure)
> *STEP 1. Create tables*
> {code}
> 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');
> {code}
> *STEP 2. Insert into table stored in HBase the struct with NULL value in it*
> {code}
> 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;
> {code}
> *ACTUAL RESULT*
> The query fails with NPE.
> {code}
> 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
> {code}
> *EXPECTED RESULT*
> The query finished successfully.
> STR (arrays)
> *STEP 1. Create tables*
> {code}
> 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');
> {code}
> *STEP 2. Insert into table stored in HBase the array with NULL value in it*
> {code}
> insert into hbase_list SELECT 2, array("a", CAST (NULL AS STRING),  "b") FROM t1 LIMIT 1;
> {code}
> *ACTUAL RESULT*
> The query fails with NPE.
> {code}
> 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
> {code}
> *EXPECTED RESULT*
> The query finished successfully.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)