[ https://issues.apache.org/jira/browse/HIVE-7075?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14005498#comment-14005498 ]
Navis commented on HIVE-7075: ----------------------------- Test fails seemed not related to this. bq. Can a test case be added as well Sure. bq. Hive explicitly appears to make them lower case though Yes, but this means all of the fields in json are regarded as lower case literal. Highly not realistic, but for example, { "empid" : 123, "empId" : 234 } 'empId' will return 123, which was 234 before this patch. > JsonSerde raises NullPointerException when object key is not lower case > ----------------------------------------------------------------------- > > Key: HIVE-7075 > URL: https://issues.apache.org/jira/browse/HIVE-7075 > Project: Hive > Issue Type: Bug > Components: HCatalog, Serializers/Deserializers > Affects Versions: 0.12.0 > Reporter: Yibing Shi > Attachments: HIVE-7075.1.patch.txt > > > 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 -- This message was sent by Atlassian JIRA (v6.2#6252)