Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Json to hive convertion

Highlighted

Re: Json to hive convertion

New Contributor

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