Amit Kumar
Amit Kumar

Reputation: 83

Hive create table for json data

I am trying to create the hive table which can read the json data, but when I am executing the create statement it is throwing an error.

Create statement:

CREATE TABLE employee_exp_json
( id INT,
fname STRING,
lname STRING,
profession STRING,
experience INT,
exp_service STRING
)
ROW FORMAT SERDE 'org.apache.hadoop.hive.contrib.serede2.Jsonserede'
STORED AS TEXTFILE;

Error:

FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. Cannot validate serde: org.apache.hadoop.hive.contrib.serede2.Jsonserede

I have also added the jar hive-json-serde.jar, but I'm still facing the same issue. I am creating this table on cloudera and hive version is 1.1.0.

Upvotes: 0

Views: 1020

Answers (2)

Hegde
Hegde

Reputation: 234

Try adding the json-serde-with-dependencies.jar. You can Download it from Download Hive Serde Also try the class
'org.openx.data.jsonserde.JsonSerDe'

Upvotes: 0

OneCricketeer
OneCricketeer

Reputation: 191681

The correct class name is

org.apache.hive.hcatalog.data.JsonSerDe

Refer: Hive SerDes

As for the other JAR you added, check its documentation. Still a different class

org.openx.data.jsonserde.JsonSerDe

Upvotes: 0

Related Questions