title: Load multi-line JSON data into HIVE table
body: <p>I have a JSON data which is a multi-line JSON. I have created a hive table to load that data into it. I have another JSON which is a single-line JSON record. When I load the single-line JSON record to its hive table and try to query, it works fine. But when I load the multi-line JSON into its hive table, it gives below exception:</p>
  
  <pre><code>Failed with exception java.io.IOException:org.apache.hadoop.hive.serde2.SerDeExcep‌​tion: org.codehaus.jackson.JsonParseException: Unexpected end-of-input: expected close marker for OBJECT (from [Source: java.io.ByteArrayInputStream@8b89b3a; line: 1, column: 0]) at [Source: java.io.ByteArrayInputStream@8b89b3a; line: 1, column: 3] 
  </code></pre>
  
  <p>Below is my JSON data:</p>
  
  <pre><code>{
    "uploadTimeStamp" : "1486631318873",
    "PDID" : "123",
    "data" : [ {
      "Data" : {
        "unit" : "rpm",
        "value" : "0"
      },
      "EventID" : "E1",
      "PDID" : "123",
      "Timestamp" : 1486631318873,
      "Timezone" : 330,
      "Version" : "1.0",
      "pii" : { }
    }, {
      "Data" : {
        "heading" : "N",
        "loc3" : "false",
        "loc" : "14.022425",
        "loc1" : "78.760587",
        "loc4" : "false",
        "speed" : "10"
      },
      "EventID" : "E2",
      "PDID" : "123",
      "Timestamp" : 1486631318873,
      "Timezone" : 330,
      "Version" : "1.1",
      "pii" : { }
    }, {
      "Data" : {
        "x" : "1.1",
        "y" : "1.2",
        "z" : "2.2"
      },
      "EventID" : "E3",
      "PDID" : "123",
      "Timestamp" : 1486631318873,
      "Timezone" : 330,
      "Version" : "1.0",
      "pii" : { }
    }, {
      "EventID" : "E4",
      "Data" : {
        "value" : "50",
        "unit" : "percentage"
      },
      "Version" : "1.0",
      "Timestamp" : 1486631318873,
      "PDID" : "123",
      "Timezone" : 330
    }, {
      "Data" : {
        "unit" : "kmph",
        "value" : "70"
      },
      "EventID" : "E5",
      "PDID" : "123",
      "Timestamp" : 1486631318873,
      "Timezone" : 330,
      "Version" : "1.0",
      "pii" : { }
    } ]
  }
  </code></pre>
  
  <p>I am using /hive/lib/hive-hcatalog-core-0.13.0.jar</p>
  
  <p>Below is my create table statement:</p>
  
  <pre><code>create table test7(
  uploadtime bigint,
  pdid string,
  data array&lt;
  struct&lt;Data:struct&lt;
  unit:string,
  value:int&gt;,
  eventid:string,
  pdid:bigint,
  time:bigint,
  timezone:int,
  version:int,
  pii:struct&lt;pii:string&gt;&gt;,
  struct&lt;Data:struct&lt;
  heading:string,
  Location:string,
  latitude:bigint,
  longitude:bigint,
  Location2:string,
  speed:int&gt;,
  eventid:string,
  pdid:bigint,
  time:bigint,
  timezone:int,
  version:int,
  pii:struct&lt;pii:string&gt;&gt;,
  struct&lt;Data:struct&lt;
  unit:string,
  value:int&gt;,
  eventid:string,
  pdid:bigint,
  time:bigint,
  timezone:int,
  version:int,
  pii:struct&lt;pii:string&gt;&gt;,
  struct&lt;Data:struct&lt;
  x:int,
  y:int,
  z:int&gt;,
  eventid:string,
  pdid:bigint,
  time:bigint,
  timezone:int,
  version:int,
  pii:struct&lt;pii:string&gt;&gt;,
  struct&lt;Data:struct&lt;
  heading:string,
  loc3:string,
  latitude:bigint,
  longitude:bigint,
  loc4:string,
  speed:int&gt;,
  eventid:string,
  pdid:bigint,
  time:bigint,
  timezone:int,
  version:int,
  pii:struct&lt;pii:string&gt;&gt;
  &gt;
  )
  ROW FORMAT SERDE 
  'org.apache.hive.hcatalog.data.JsonSerDe'
  STORED AS TEXTFILE
  LOCATION
  '/xyz/abc/';
  </code></pre>
  
  <p>Edit:</p>
  
  <p>Adding the single line JSON and new table create stmt with error:</p>
  
  <pre><code>{"uploadTimeStamp":"1487183800905","PDID":"123","data":[{"Data":{"unit":"rpm","value":"0"},"EventID":"event1","PDID":"123","Timestamp":1487183800905,"Timezone":330,"Version":"1.0","pii":{}},{"Data":{"heading":"N","loc1":"false","latitude":"16.032425","longitude":"80.770587","loc2":"false","speed":"10"},"EventID":"event2","PDID":"123","Timestamp":1487183800905,"Timezone":330,"Version":"1.1","pii":{}},{"Data":{"x":"1.1","y":"1.2","z":"2.2"},"event3":"AccelerometerInfo","PDID":"123","Timestamp":1487183800905,"Timezone":330,"Version":"1.0","pii":{}},{"EventID":"event4","Data":{"value":"50","unit":"percentage"},"Version":"1.0","Timestamp":1487183800905,"PDID":"123","Timezone":330},{"Data":{"unit":"kmph","value":"70"},"EventID":"event5","PDID":"123","Timestamp":1487183800905,"Timezone":330,"Version":"1.0","pii":{}}]}
  </code></pre>
  
  <hr>
  
  <pre><code>create table test1(
  uploadTimeStamp string,
  PDID string,
  data array&lt;struct&lt;
  Data:struct&lt;unit:string,value:int&gt;,
  EventID:string,
  PDID:string,
  TimeS:bigint,
  Timezone:int,
  Version:float,
  pii:struct&lt;&gt;&gt;,
  struct&lt;
  Data:struct&lt;heading:string,loc1:string,latitude:double,longitude:double,loc2:string,speed:int&gt;,
  EventID:string,
  PDID:string,
  TimeS:bigint,
  Timezone:int,
  Version:float,
  pii:struct&lt;&gt;&gt;,
  struct&lt;
  Data:struct&lt;x:float,y:float,z:float&gt;,
  EventID:string,
  PDID:string,
  TimeS:bigint,
  Timezone:int,
  Version:float,
  pii:struct&lt;&gt;&gt;,
  struct&lt;
  EventID:string,
  Data:struct&lt;value:int,unit:percentage&gt;,
  Version:float,
  TimeS:bigint,
  PDID:string,
  Timezone:int&gt;,
  struct&lt;
  Data:struct&lt;unit:string,value:int&gt;,
  EventID:string,
  PDID:string,
  TimeS:bigint,
  Timezone:int,
  Version:float,
  pii:struct&lt;&gt;&gt;
  &gt;
  ROW FORMAT SERDE 
  'org.apache.hive.hcatalog.data.JsonSerDe'
  STORED AS TEXTFILE
  LOCATION
  </code></pre>
  
  <h2>    '/ABC/XYZ/';</h2>
  
  <pre><code>MismatchedTokenException(320!=313)
  ...
  ...
  ...
  FAILED: ParseException line 11:10 mismatched input '&lt;&gt;' expecting &lt; near 'struct' in struct type
  </code></pre>