I have a string column that contains a JSON array on each row. Calling the 
function get_json_object on that column always returns NULL:

$ hive -e "select cdnbwdata, get_json_object(cdnbwdata, '$'), 
get_json_object(cdnbwdata, '$[0].rtt'), get_json_object(cdnbwdata, '$.rtt') 
from mytable"
[{"id":9,"ip":"173.223.232.50","rtt":71,"bw":41943}] NULL NULL NULL

If I replace the array with its 0th element, then get_json_object works:

$ hive -e "select cdnbwdata, get_json_object(cdnbwdata, '$'), 
get_json_object(cdnbwdata, '$[0].rtt'), get_json_object(cdnbwdata, '$.rtt') 
from mytable"
{"id":9,"ip":"173.223.232.32","rtt":71,"bw":4211}     
{"id":9,"bw":4211,"rtt":71,"ip":"173.223.232.32"}    NULL 71

Is it a get_json_object bug in handling arrays, or am I doing something wrong? 
Hive version is 0.5.

Thanks.
Steven

Reply via email to