Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Hive >> mail # user >> Re: Issue with Json tuple lateral view


Copy link to this message
-
Re: Issue with Json tuple lateral view


*************************
Here is the json-data that i load:
*************************
{ "blogID" : "FJY26J1333", "date" : "2012-04-01", "name" : "vpxnksu", "comment" : "good stuff", "contact" : { "email" : "[EMAIL PROTECTED]", "website" : "vpxnksu.wordpress.com" } }
{ "blogID" : "VSAUMDFGSD", "date" : "2012-04-01", "name" : "yhftrcx", "comment" : "another comment",}

*************************

Here is the hive commands :
*************************
CREATE  EXTERNAL  TABLE json_comments(value STRING) LOCATION  '/user/json-comments';

LOAD DATA LOCAL INPATH '/home/satish/data/inputSai/json-comments.txt' OVERWRITE INTO TABLE json_comments;

SELECT b.blogID, c.email FROM json_comments a LATERAL VIEW json_tuple(a.value, 'blogID', 'contact') b AS blogID, contact LATERAL VIEW json_tuple(b.contact, 'email', 'website') c AS email, website;
*************************

Here r the results of  map reduce:
*************************
blogidemail

[EMAIL PROTECTED]
NULLNULL

*************************

My question is why the 2nd row is coming up as Null values, i was expecting the results to be like this:
*************************
blogidemail
[EMAIL PROTECTED]
VSAUMDFGSDNULL

Any input is appreciated in understanding this.
Thanks
S
+
Navis류승우 2013-05-27, 06:45
+
Sai Sai 2013-05-27, 07:21