Created 11-13-2017 12:41 PM
I am trying to query the following Json file:
{"a":"a1","b":"b1","d":"{"key1":"pair1","key2":"pair2"}"}
I have created the following table to query it:
CREATE EXTERNAL TABLE database.testingjson( a STRING, b STRING, c STRING, d map<string,string> ) ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe' STORED AS TEXTFILE LOCATION 'location';
Shows the following exception:
SQL Error: java.io.IOException: org.apache.hadoop.hive.serde2.SerDeException: java.io.IOException: Start of Object expected java.io.IOException: org.apache.hadoop.hive.serde2.SerDeException: java.io.IOException: Start of Object expected java.io.IOException: org.apache.hadoop.hive.serde2.SerDeException: java.io.IOException: Start of Object expected org.apache.hadoop.hive.serde2.SerDeException: java.io.IOException: Start of Object expected java.io.IOException: Start of Object expected java.io.IOException: Start of Object expected
If I delete the map from the table there is no problem and queries the data correctly. Is there anything that I'm missing? Or the hcatalog doesn't accept key value fields?
I'm using Hive 1.2
Created 11-13-2017 02:56 PM
The JSON you are using isn't valid, you need to remove the double quotes around the map column value.
So your JSON would be:
{"a":"a1","b":"b1","d":{"key1":"pair1","key2":"pair2"}}
Created 11-13-2017 02:56 PM
The JSON you are using isn't valid, you need to remove the double quotes around the map column value.
So your JSON would be:
{"a":"a1","b":"b1","d":{"key1":"pair1","key2":"pair2"}}
Created 11-13-2017 03:24 PM
Oh god, thank you.