欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

hive中get_json_object()和json_tuple()

程序员文章站 2022-07-13 12:31:08
...

hive中get_json_object()和json_tuple()
将每一行数据存储为string,属性名line

get_json_object()
select get_json_object(line,'$.movie') as movie,
	get_json_object(line,'$.rate') as rate,
	get_json_object(line,'$.timeStamp') as time,  
	get_json_object(line,'$.uid') as uid
from rate_json;

hive中get_json_object()和json_tuple()

json_tuple()
select b.movie,b.rate,b.time,b.uid
from rate_json
lateral view json_tuple(line,'movie','rate','timeStamp','uid') b
as movie,rate,time,uid;

hive中get_json_object()和json_tuple()