Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created 08-07-2017 05:06 PM
I'm trying to create a hive external table using org.apache.hcatalog.data.JsonSerDe library based on this example https://community.hortonworks.com/questions/28684/creating-a-hive-table-with-orgapachehcatalogdatajs.... The thing is that when I try with a very simple json structure it works fine but when I try with a more complex one (such as having a struct inside a struct attribute) I get the org.apache.hive.service.cli.HiveSQLException: java.io.IOException: org.apache.hadoop.hive.serde2.SerDeException: java.io.IOException: Start of Object expected error when I do a simple query.
Data Example:
{ "user": { "userlocation": "California, Santa Clara", "id": 222222, "name": "Hortonworks", "screenname": "hortonworks", "geoenabled": true, "location":[{"x":-88.083131,"y":99.984982},{"x":-88.083131,"y":99.984982}] }, "tweetmessage": "Learn more about #Spark in #HDP 2.3 with @Hortonworks founder @acmurthy in this video overview http://bit.ly/1gOyr9w #hadoop", "createddate": "2015-07-24T16:30:33"}
Query:
CREATE EXTERNAL TABLE tweets ( createddate string, geolocation string, tweetmessage string, `user` struct<geoenabled:boolean, id:int, name:string, screenname:string, userlocation:string, location:struct<x: double, y: double>>) ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe' LOCATION '/user/root/';
Created 08-08-2017 09:20 AM
I guess there are some errors in your DDL. The first one I can see is that location should be:
array<struct<x: double, y: double>>
Please try with this change and see whether it works or there are other problems.
Created 08-08-2017 09:20 AM
I guess there are some errors in your DDL. The first one I can see is that location should be:
array<struct<x: double, y: double>>
Please try with this change and see whether it works or there are other problems.
Created 08-08-2017 02:19 PM
Thanks a lot. That worked.