You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by Navis Ryu <na...@nexr.com> on 2014/05/23 03:02:13 UTC

Review Request 21834: JsonSerde raises NullPointerException when object key is not lower case

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/21834/
-----------------------------------------------------------

Review request for hive.


Bugs: HIVE-7075
    https://issues.apache.org/jira/browse/HIVE-7075


Repository: hive-git


Description
-------

We have noticed that the JsonSerde produces a NullPointerException if a JSON object has a key value that is not lower case. For example. Assume we have the file "one.json": 

{ "empId" : 123, "name" : "John" } 
{ "empId" : 456, "name" : "Jane" } 

hive> CREATE TABLE emps (empId INT, name STRING) 
ROW FORMAT SERDE "org.apache.hive.hcatalog.data.JsonSerDe"; 

hive> LOAD DATA LOCAL INPATH 'one.json' INTO TABLE emps; 

hive> SELECT * FROM emps; 

Failed with exception java.io.IOException:java.lang.NullPointerException 

-------- 

Notice, it seems to work if the keys are lower case. Assume we have the file 'two.json': 
{ "empid" : 123, "name" : "John" } 
{ "empid" : 456, "name" : "Jane" } 

hive> DROP TABLE emps; 

hive> CREATE TABLE emps (empId INT, name STRING) 
ROW FORMAT SERDE "org.apache.hive.hcatalog.data.JsonSerDe"; 

hive> LOAD DATA LOCAL INPATH 'two.json' INTO TABLE emps;

hive> SELECT * FROM emps; 
OK 
123	John 
456	Jane


Diffs
-----

  hcatalog/core/src/main/java/org/apache/hive/hcatalog/data/schema/HCatSchema.java 59e18b4 
  hcatalog/core/src/test/java/org/apache/hive/hcatalog/data/TestJsonSerDe.java da5ae97 

Diff: https://reviews.apache.org/r/21834/diff/


Testing
-------


Thanks,

Navis Ryu