Return-Path: X-Original-To: apmail-hive-user-archive@www.apache.org Delivered-To: apmail-hive-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0513DEB2B for ; Mon, 18 Feb 2013 12:44:08 +0000 (UTC) Received: (qmail 82364 invoked by uid 500); 18 Feb 2013 12:44:06 -0000 Delivered-To: apmail-hive-user-archive@hive.apache.org Received: (qmail 81808 invoked by uid 500); 18 Feb 2013 12:44:00 -0000 Mailing-List: contact user-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hive.apache.org Delivered-To: mailing list user@hive.apache.org Received: (qmail 81770 invoked by uid 99); 18 Feb 2013 12:43:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Feb 2013 12:43:59 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [209.85.216.44] (HELO mail-qa0-f44.google.com) (209.85.216.44) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Feb 2013 12:43:52 +0000 Received: by mail-qa0-f44.google.com with SMTP id bv4so1239122qab.17 for ; Mon, 18 Feb 2013 04:43:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type:x-gm-message-state; bh=GYaGCiOWAEMB2ni77vkt7E77X3v3nQn0VSvE4o+a828=; b=fuARYfz6bwNfs5riRA6nhmRyvweozZuOFl5UDUDoR0sR2mkEBiVJcpohChwL2nh3Uq kwgR2vSY1Gne0Pv//uojT2CRZm0o7GQ13bexF7jnd195HnbONchY9FFF7jeOef8gIHuT 4tlLi4ZPt/O3skKgkAHyV7oGszMde/JcUF4TbsopZa2cLX1/UxKerODv75vZY29a4frz lcXk11RZZcETjtLjFCI0C9+rLyr68XNsHdMUFTHfzzQhWynKwLvDtbUDCnufpl9stXaJ Nbigrfimsv5IEZDdlM6okT3So/R5f0VXXPDobQGkThViUDh0mzLU3oMqnw54rjcOdDUn ZaNw== MIME-Version: 1.0 X-Received: by 10.49.61.102 with SMTP id o6mr5001078qer.41.1361191411085; Mon, 18 Feb 2013 04:43:31 -0800 (PST) Received: by 10.49.108.162 with HTTP; Mon, 18 Feb 2013 04:43:30 -0800 (PST) Date: Mon, 18 Feb 2013 18:13:30 +0530 Message-ID: Subject: Loading json files into hive table is giving NULL as output(data is in s3 bucket) From: Chunky Gupta To: user@hive.apache.org Content-Type: multipart/alternative; boundary=047d7bdc0e7e87708904d5ff1214 X-Gm-Message-State: ALoCoQkIvSJoTo+IhWD4SccT/rwPJ4iTtzZK5nui6zMjcUmnlSwCHwDauFQltygSycL5qtvNADkY X-Virus-Checked: Checked by ClamAV on apache.org --047d7bdc0e7e87708904d5ff1214 Content-Type: text/plain; charset=ISO-8859-1 Hi, I have data in s3 bucket, which is in json format and is a zip file. I have added this jar file in hive console :- http://code.google.com/p/hive-json-serde/downloads/detail?name=hive-json-serde-0.2.jar&can=2&q= I tried the following steps to create table and load data :- 1. CREATE EXTERNAL TABLE table_test ( uname STRING ) PARTITIONED BY (dt STRING ) ROW FORMAT SERDE "org.apache.hadoop.hive.contrib.serde2.JsonSerde" WITH SERDEPROPERTIES ( "uname"="$._u" ) LOCATION 's3://BUCKET_NAME/test_data/' I tried this also :- CREATE EXTERNAL TABLE table_test ( uname STRING ) PARTITIONED BY (dt STRING ) ROW FORMAT SERDE "org.apache.hadoop.hive.contrib.serde2.JsonSerde" WITH SERDEPROPERTIES ( "uname"="_u" ) LOCATION 's3://BUCKET_NAME/test_data/' 2. alter table table_test add partition (dt='13Feb2012') location 's3n://BUCKET_NAME/test_data/13Feb2012'; and json file is like this :- ------------------------------------- {"_u":"test_name1","_ts":"2012-01-13","_ip":"IP1"} {"_u":"test_name2","_ts":"2012-01-13","_ip":"IP2"} {"_u":"test_name3","_ts":"2012-01-13","_ip":"IP3"} When I query :- select uname from table_test; Output :- NULL 13Feb2012 NULL 13Feb2012 NULL 13Feb2012 Please help me and let me know how to add json data in a table. Thanks, Chunky. --047d7bdc0e7e87708904d5ff1214 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi,

I have data in s3 bucket, which is in json format and is a zip f= ile. I have added this jar file in hive console :-
http://code.google.com/p/hive-json-serde/download= s/detail?name=3Dhive-json-serde-0.2.jar&can=3D2&q=3D

I tried the following steps to create table and load data :-

1. = CREATE EXTERNAL TABLE table_test ( uname STRING ) PARTITIONED BY (dt STRING= ) ROW FORMAT SERDE "org.apache.hadoop.hive.contrib.serde2.JsonSerde&q= uot; WITH SERDEPROPERTIES ( "uname"=3D"$._u" ) LOCATION= 's3://BUCKET_NAME/test_data/'

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 I tried this also :-

CREATE EXTER= NAL TABLE table_test ( uname STRING ) PARTITIONED BY (dt=20 STRING ) ROW FORMAT SERDE=20 "org.apache.hadoop.hive.contrib.serde2.JsonSerde" WITH SERDEPROPE= RTIES ( "uname"=3D"_u" ) LOCATION 's3://BUCKET_NAME/test_data/'



2. alte= r table table_test add partition (dt=3D'13Feb2012') location 's= 3n://BUCKET_NAME/test_data/13Feb2012';

and json file is like this :-
-------------------------------------=
{"_u":"test_name1","_ts":"2012-01-13= ","_ip":"IP1"}
{"_u":"test_name2= ","_ts":"2012-01-13","_ip":"IP2&quo= t;}
{"_u":"test_name3","_ts":"2012-01-13&quo= t;,"_ip":"IP3"}


When I query :-
select un= ame from table_test;

Output :-
NULL 13Feb2012
NULL 13Feb2012
NULL 13Feb2012


Please help me and let= me know how to add json data in a table.

Thanks,
Chunky.
--047d7bdc0e7e87708904d5ff1214--