HIVE简单实战

本文介绍了使用Hive进行大数据分析的实战案例,详细步骤包括:从MySQL导入数据到Hive,创建城市和产品信息表,关联表并统计各区域产品点击次数,使用窗口函数找出每个区域的Top 3热门产品,最后通过Sqoop将结果导出到MySQL。同时,文章提及了离线处理的调度和数据倾斜的处理问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

需求:统计各个城市所属区域下最受欢迎的Top 3产品

数据准备:
mysql:
city_info : 城市信息表
在这里插入图片描述
product_info: 产品信息表
在这里插入图片描述
hive:
user_click:用户行为点击日志表
在这里插入图片描述

create table user_click(
user_id int,
session_id string,
action_time string,
city_id int,
product_id int
) partitioned by (day string)
row format delimited fields terminated by ',';

一、在hive中创建city_info,product_info

create table city_info(
city_id int,
city_name string,
area string
)row format delimited fields terminated by '\t';

create table product_info(
product_id int,
product_name string,
extend_info string
)row format d
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值