欢迎投稿

今日深度:

hive,

hive,


json

lateral view explode (split( regexp_replace(


112^A{"store":  {"fruit":[{"weight":8,"type":"apple"},{"weight":9,"type":"pear"}], "bicycle":{"price":19.95,"color":"red"}  }, "email":"amy@only_for_json_udf_test.net", "owner":"amy"}



select a.id,fruit from test a lateral view explode(split(regexp_replace(regexp_replace(get_json_object(a.name, '$.store.fruit'),'\\}\\,\\{','\\}\\;\\{'),'\\[|\\]',''),'\\;')) fruitTable as fruit ;
select b.id, count(*), count(distinct get_json_object(b.fruit, '$.weight'))  from (select a.id,fruit from test a lateral view explode(split(regexp_replace(regexp_replace(get_json_object(a.name, '$.store.fruit'),'\\}\\,\\{','\\}\\;\\{'),'\\[|\\]',''),'\\;')) fruitTable as fruit )b group by b.id;



www.htsjk.Com true http://www.htsjk.com/hive/29066.html NewsArticle hive, json lateral view explode (split( regexp_replace( 112^A{"store": {"fruit":[{"weight":8,"type":"apple"},{"weight":9,"type":"pear"}], "bicycle":{"price":19.95,"color":"red"} }, "email":"amy@only_for_json_udf_test.net", "owner":"amy"}...
相关文章
    暂无相关文章
评论暂时关闭