*************************
Here is the json-data that i load:
*************************


{ "blogID" : "FJY26J1333", "date" : "2012-04-01", "name" : "vpxnksu", "comment" 
: "good stuff", "contact" : { "email" : "vpxn...@gmail.com", "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

fjy26j1333vpxn...@gmail.com
NULLNULL

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

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


blogidemail
fjy26j1333vpxn...@gmail.com
VSAUMDFGSDNULL

Any input is appreciated in understanding this.
Thanks
S

Reply via email to