Hive json 转array

编程入门 行业动态 更新时间:2024-10-10 21:30:15

<a href=https://www.elefans.com/category/jswz/34/1769093.html style=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

本文发布于:2024-03-09 03:01:40,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1723531.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Hive   json   array

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!