《Hive数据仓库案例教程》教学课件 第10章 综合案例1:广电大数据分析.pptxVIP

《Hive数据仓库案例教程》教学课件 第10章 综合案例1:广电大数据分析.pptx

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
  4. 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
  5. 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们
  6. 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
  7. 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
第10章 综合案例1:广电大数据分析;10.2.1 原始数据;10.1 案例需求分析;案例数据已经经过ETF,符合数据处理的要求,在此基础上创建数据仓库表并向其中导入数据。;用户观看历史文件486.5MB,共有约3360218条数据,每条记录有17个字段。用户信息数据文件922.8KB,共有约15660条数据,每条记录有7个字段。;数据表的字段及其数据类型等结构信息分别详见表10-1和表10-2。 1.观看历史表;数据表结构;数据表结构;10.2.3 创建表;创建表;用户信息表text_user: create table text_user( phone_no string, owner_name string, run_name string, run_time string, sm_name string, owner_code string) row format delimited fields terminated by , stored as textfile;;2.创建存储格式为ORC的表orc_see和orc_user 观看历史表orc_see: create table orc_see( phone_no string, duration int, station_name string, origin_time string, end_time string, res_name string, owner_code string, owner_name string, category_name string, res_type string, vod_title string,; program_title string, day string, origin_time1 string, end_time1 string, wat_time int, data string) row format delimited fields terminated by , stored as orc;;创建表;观看历史文件存储在本地系统/opt/datas目录下,将其导入表text_see中: load data local inpath /opt/datas/media3.txt into table text_see; 用户信息文件存储在本地系统/opt/datas目录下,将其导入表text_user中: load data local inpath /opt/datas/userevents.txt into table text_user;;将表text_see中数据加载到表orc_see中: insert into table orc_see select * from text_see; 将表text_user中数据加载到表orc_user中: insert into table orc_user select * from text_user; 创建完成的表: show tables; +-------------+--+ | tab_name | +-------------+--+ | orc_user | | orc_see | | text_user | | text_see | +-------------+--+;创建数据仓库表并向其中导入数据后,可以对用户观看历史和用户信息数据进行大数据分析。;查询表orc_see的记录总数: select count(*) from orc_see; +---------+--+ | c0 | +---------+--+ | 3360218 | +---------+--+ 查询表orc_user的记录总数: select count(*) from orc_user; +----------+--+ | c0 | +----------+--+ | 15660 | +----------+--+;基本信息查询;对orc_see表使用Order By按照duration字段做一个全局降序排序,并且设置只显示前20条,即Top20。select phone_no,duration from orc_see order by duration desc limit 20; OK phone_no duration 168032772171680170614016804303072168018463041680271874516803116937

文档评论(0)

139****1983 + 关注
实名认证
文档贡献者

副教授、一级建造师持证人

从事职业教育近20年,高级职称。

领域认证该用户于2023年06月21日上传了副教授、一级建造师

1亿VIP精品文档

相关文档