11.4.6 统计每个类别中视频流量Top10
和上个需求基本一样,只是排序方式变成了流量而已(ratings
)
select
*
from(
select
videoId,
ratings,
category_name,
rank() over(partition by category_name order by ratings desc) rank
from(
select
ratings,
videoId,
category_name
from gulivideo_orc
lateral view explode(category) tmp as category_name
) t1
) t2
where rank <= 10;