hive - Parsing nested JSON using HiveQL -
hive - Parsing nested JSON using HiveQL -
i have next nested json format info stored syslog need query using hiveql , convert csv file (which used display graph) :
"logaggregate": {"name-1":{"time":"74","count":"1"},"name-2":{"time":"2","count":"1"},"name-3 {"time":"2","count":"5"},"name-4":{"time":"22","count":"1"}, 。 。 。// , on.. 。} the output format looking below:
name-1 time name-2 time name-3 time . . . // on i relatively new hive not sure how should parse json data. tried fiddling lateral view , json_tuple in vain!
any help much apppreciated! orz
take @ blog entry ( http://brickhouseconfessions.wordpress.com/2014/02/07/hive-and-json-made-simple/ ) describes using json udf's provided in brickhouse ( http://github.com/klout/brickhouse ).
for specific case, want parse map, , explode on map.
select key, map_index( value, "time") time_value my_table lateral view explode_map( from_json( json, 'map<map<string,string>>') ) kv1 k, v; json hive hiveql
Comments
Post a Comment