0
votes

I am trying to read json data using Hive External table but I am getting Null pointer exception while using json serde..

Below is the table command and error:

hive> create external table json_tab
    > (
> name string, age string, passion string
> )
> row format SERDE 'org.apache.hadoop.hive.contrib.serde2.JsonSerde' location '/home/pandi/hive_in';

FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. java.lang.NullPointerException

I have added below jar as well: add jar /usr/local/apache-hive-2.1.1-bin/lib/hive-contrib-2.1.1.jar; add jar /usr/local/apache-hive-2.1.1-bin/lib/hive-json-serde.jar;

Please help.

1

1 Answers

0
votes

It looks like an issue with the SerDe class.

Try to make use of this implementation: 'org.apache.hive.hcatalog.data.JsonSerDe' present in hive-hcatalog-core-0.13.0.jar;

This works for me.