Created 11-09-2016 02:01 PM
i am trying json with hive using below link
http://thornydev.blogspot.in/2013/07/querying-json-records-via-hive.html
But i do not find any jar file in the link:-
Created 11-09-2016 02:34 PM
Hi @vamsi valiveti. In order to get the jar you will need to build it using Maven.
1. Download and install Maven - https://maven.apache.org/. Make sure you add the bin directory to your PATH
2. Clone (download) rongiu's github and unzip.
3. Navigate to the directory with the pom.xml
4. Run the following command - mvn -Pcdh5 -Dcdh5.hive.version=1.0.0 clean package
5. You will find the jar in /json-serde/target
Keep in mind also that Hive comes with a native JSON Serde. https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-RowFormats&Ser...
Created 11-09-2016 03:21 PM
1)Thanks for inputs.I will try and let you know.
2)one more clarification how to get Collapsed version?If it is small json document means i will do it let us assume a big jsob document is present?How to get collapses version if source file is in below format.
{ "DocId": "ABC", "User": { "Id": 1235, "Username": "fred1235", "Name": "Fred", "ShippingAddress": { "Address1": "456 Main St.", "Address2": "", "City": "Durham", "State": "NC" } } } { "DocId": "ABC", "User": { "Id": 1236, "Username": "larry1234", "Name": "Larry", "ShippingAddress": { "Address1": "789 Main St.", "Address2": "", "City": "Durham", "State": "NC", "PostalCode": "27713" }, "Orders": [ { "ItemId": 1111, "OrderDate": "11/11/2012" }, { "ItemId": 2222, "OrderDate": "12/12/2012" } ] } }
Collapsed version:
{"DocId":"ABC","User":{"Id":1235,"Username":"fred1235","Name":"Fred","ShippingAddress":{"Address1":"456 Main St.","Address2":"","City":"Durham","State":"NC"}}} {"DocId":"ABC","User":{"Id":1236,"Username":"larry1234","Name":"Larry","ShippingAddress":{"Address1":"789 Main St.","Address2":"","City":"Durham","State":"NC","PostalCode":"27713"},"Orders":[{"ItemId":1111,"OrderDate":"11/11/2012"},{"ItemId":2222,"OrderDate":"12/12/2012"}]}
Created 11-09-2016 04:07 PM
I use this http://www.jsoneditoronline.org/
Click on the icons on the upper-left corner to flatten it out.
Created on 11-10-2016 08:24 AM - edited 08-18-2019 03:43 AM
Hi @Scott Shaw.
1)I can get the to get Collapsed version using above url.It is working.Thanks but how we will do this in Prod environment.
This is manual work.Is there anyway to automate this?
2)Regarding https://github.com/rcongiu/Hive-JSON-Serde initially I do not see any target folder in json-serde,json-udf.
I ran all the steps as you mentioned previously.Now so many jar files are present in target directory of json-serde,json-udf.
Not sure which one i need to consider.Both screenshots are attached with this comment.Could you please guide me which jar file i need to use?Please correct me if i miss anything
json-serde-target:-
json-udf target:-
Created 11-10-2016 02:38 PM
Any Input on my request