在spark sql中解析json格式数据

一、实际的sql语句:
select app_id,
event_time,
event,
spm_b_code,
spm_c_code,
spm_d_code,
spm_biz_type,
user_id,
user_id_type,
seat_code,
spm_content_type,
source
from xxx_yyy_zzz t
lateral view_json_tuplet(t.ext_props,
'user_id',
'user_id_type',
'seat_code',
'spm_content_type',
'source')a
as user_id,
user_id_type,
seat_code,
spm_content_type,
source

其中:ext_props为表t的一个字段,其中的数据为json格式。

二、相关的函数:
get_json_object
from_json
to_json
explode
selectExpr

posted @   chy_cug  阅读(600)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?
点击右上角即可分享
微信分享提示