hive 解析jason字符串
经常有jason字符串需要解析后,取对应位置的数据,jason字符串可能是这样的:
{"Id":1,"type":1}
{"Id":2,"type":2}
{"Id":3,"type":3}
(这个只有两个字段,但是道理是一样的嘛)
这时只需要使用窗口函数get_json_object,具体代码如下:
select
get_json_object(info,'$.type') as type,
get_json_object(info,'$.id') as id
from t0
其中info是
原创
2020-06-01 16:51:24 ·
851 阅读 ·
0 评论