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

JsonSerde raises NullPointerException when object key is not lower case

    XMLWordPrintableJSON

    Details

      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

        Attachments

        1. HIVE-7075.1.patch.txt
          2 kB
          Navis Ryu
        2. HIVE-7075.2.patch.txt
          4 kB
          Navis Ryu
        3. HIVE-7075.3.patch.txt
          4 kB
          Navis Ryu

          Issue Links

            Activity

              People

              • Assignee:
                navis Navis Ryu
                Reporter:
                Yibing Yibing Shi
              • Votes:
                1 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: