How to install, configure Json capability in CDH distribution
The Cloudera(CDH) distribution is not coming with json capability, in order to use that you will need to add/install your own
There are 3 options to add/load a jar file if you use the cloudera(CDH) distribution
- add yourjar.jar
- Create an .hiverc, an example in the link below
http://hadooped.blogspot.in/2013/08/hive-hiverc-file.html - Add the jar to your class path under the below property.
hive.aux.jars.path
Get the JSONSerDe compiled jar file from the below link
http://www.congiu.net/hive-json-serde/1.3.7/cdh5/
Get the source from the below link and compile your self
https://github.com/rcongiu/Hive-JSON-Serde
How to compile the java library
Get the JSONSerDe java source from
https://github.com/cloudera/cdh-twitter-example/blob/master/hive-serdes/src/main/java/com/cloudera/hive/serde/JSONSerDe.java
Now compile the java library
cd /opt/cloudera/parcels/CDH/lib/hive/lib cl_path=`ls |perl -p -i -e 's,\n,:,'` cd /usr/share/cmf/lib/cdh5/ cl_path2=`ls |perl -p -i -e 's,\n,:/usr/share/cmf/lib/cdh5/,'` cd /opt/cloudera/parcels/CDH/lib/hive/lib javac -classpath $cl_path2:$cl_path /var/tmp/JSONSerDe.java # Create the jar cd /var/tmp/ mkdir temp; cd temp jar -cvf ../JSONSerDe.jar * cp JSONSerDe.jar /opt/cloudera/parcels/CDH/lib/hive/lib/.