In this video i have demonstrated How to analyze JSON data in hive?
http://www.bigdataanalyst.in
Please follow these steps:
How to analyze json data:
Download from http://files.cloudera.com/samples/hiv...
copy this file into hive/lib path.
start hadoop and hive
CREATE EXTERNAL TABLE originaldata (created_at STRING,
text STRING,
user STRUCT //place less then here its not accept in the description
screen_name:STRING,
name:STRING,
locations:STRING,
description:STRING,
created_at:STRING,
followers_count:INT,
url:STRING //place greater then here its not accept in the description
) ROW FORMAT SERDE 'com.cloudera.hive.serde.JSONSerDe' location '/home/hadoop/work/warehouse/bigsql.db/raw_tables';
create table desiretable as select * from originaldata;
add jar /home/hadoop/work/hive-0.10.0/lib/hive-serdes-1.0-SNAPSHOT.jar;
select * from tablename;
select * from desiretable where user.locations like "%USA%";
select user.name, user.url from desiretable where user.description like "%bigdata%";
If you have any doubt comment below.
Thanks
Your Venu