I have a file with Json data which takes the below form:
Ex:
{
"Name": "xxxx",
"Address": [{
"Street": "aa",
"City": "bbb"
}, {
"Street": "ccc",
"City": "ddd",
"Country": "eee"
}]
}
The above Json is a valid Json. I want to create a hive table on top of data of above form using JsonSerde.
Create table with all possible fields defined. If field is not present in json, select will return NULL:
if you have names in JSON file which conflict with Hive reserved words then add mapping and rename names in table definition:
WITH SERDEPROPERTIES ('mapping.renamed_column'='original_column')
and rename your table columns.Put your file in the table location.
See also docs with some examples here: https://github.com/rcongiu/Hive-JSON-Serde