I\'m trying JSON-SerDe from below link http://code.google.com/p/hive-json-serde/wiki/GettingStarted.
CREATE TABLE my_table (field1 string, field2
I solved similar problem -
I took the jar from - [http://www.congiu.net/hive-json-serde/1.3.8/hdp23/json-serde-1.3.8-jar-with-dependencies.jar]
Run the command in Hive CLI - add jar /path/to/jar
create table messages (
id int,
creation_date string,
text string,
loggedInUser STRUCT
)
row format serde "org.openx.data.jsonserde.JsonSerDe";
{"id": 1,"creation_date": "2020-03-01","text": "I am on cotroller","loggedInUser":{"id":1,"name":"API"}}
{"id": 2,"creation_date": "2020-04-01","text": "I am on service","loggedInUser":{"id":1,"name":"API"}}
LOAD DATA LOCAL INPATH '${env:HOME}/path-to-json'
OVERWRITE INTO TABLE messages;
select * from messages;1 2020-03-01 I am on cotroller {"id":1,"name:"API"}
2 2020-04-01 I am on service {"id":1,"name:"API"}