hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anurag Phadke <apha...@mozilla.com>
Subject iterating through JSON
Date Wed, 15 Feb 2012 22:28:50 GMT
Hive version: 0.7.1
Does hive support extracting data from jsons which begin with @ as part 
of the key?

Sample Data:
{"@fields":{},"timestamp":"2012-02-09T21:58:42.420085","@timestamp":"2012-02-09T21:58:42.472000Z","@source":"unknown","env_version":"0.8","@type":null,"@tags":["output_hdfs","output_text","output_statsd"],"logger":"","payload":"1","severity":6,"type":"counter","fields":{"name":"foo"}}

{"@fields":{},"timestamp":"2012-02-09T22:19:59.261948","@timestamp":"2012-02-09T22:19:59.266000Z","@source":"unknown","env_version":"0.8","@type":null,"@tags":["output_hdfs","output_text","output_statsd"],"logger":"server-core-app","payload":"1","severity":6,"type":"timer","fields":{"rate":1,"name":"syncstorage.controller.get_collections"}}



For eg:
select get_json_object(line, '$.env_version') from apachelog limit 10;
works BUT

select get_json_object(line, '$.env_version'), 
get_json_object(line,'$.@source') from apachelog limit 10;
returns NULL for @source.

Tried escaping as:
select get_json_object(line, '$.env_version'), 
get_json_object(line,'$.\\@source') from apachelog limit 10;
same error.

-anurag

Mime
View raw message