Hive json 转array"/>
Hive json 转array
工作的时候遇到hive 查询拼接url的情况,发现json串里有个uri的集合,这个就麻烦了,研究一下,写出了一个builder,如下:
url_builder as (selectitem_id,collect_set(concat('/',get_json_object(image_list, '$.uri'),'~args')) as image_urlsfrom(selectitem_id,split(regexp_replace(concat('{',regexp_extract(image_list,'[^\\[](.+)[^\\]]'),'}'),'\\}\\,\\{','\\}\\|\\|\\{'),'\\|\\|') as image_arrayfromitem_table) as test LATERAL VIEW explode(image_array) Ttable as image_listgroup byitem_id
)
更多推荐
Hive json 转array
发布评论