函数

select * read_json()

示例

{
"grade30":{
"visible": True
"score": 0.897
"info": [100, 150, 300, 600]
},
"grade20":{
"visible": True
"score": 0.898
"info": [100, 150, 500, 600]
}
}

行与列互转:首选 PIVOT 和 UNPIVOT 语句
一行↔多行 :UNNEST 负责“一行变多行”
多行变一行:通过 GROUP BY + 聚合函数

Table Functions

unnest
struct :
MAP: map_entries: 将一个 MAP 转换为一个 STRUCT 的列表 (LIST)
json_each 和 json_tree
lateral json_each()

json_each 本质上是一个 lateral join,

Hive

行转列,列转行,多行转一行,
LATERAL VIEW -一行转多行
LATERAL VIEW explode(stu_id)
lateral view posexplode(score )
collect_list

case when

posted on 2026-08-19 18:01  辰令  阅读(3)  评论(0)    收藏  举报