Reply
Highlighted
New Contributor
Posts: 1
Registered: ‎03-08-2018

Re: Json to hive convertion

I am facing similar issue with top level array. can anyone suggest me a solution.

[{"user_id": "a"," previous_user_id": "b"},{"user_id": "c"," previous_user_id": "d"},{"user_id": "e"," previous_user_id": "f"}]
create external table array_tmp (User array<struct<user_id: String, previous_user_id:String>>) ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe'

on executing below

select user.user_id from array_tmp

 

it gives exception as Row is not a valid JSON Object. I followed what is there in https://github.com/rcongiu/Hive-JSON-Serde. But no luck for top level arrays. Any help is much appreciated

Announcements