尚硅谷大数据项目《在线教育之离线数仓》笔记006
视频地址:尚硅谷大数据项目《在线教育之离线数仓》_哔哩哔哩_bilibili
目录
第11章 数仓开发之ADS层
P087
P088
P089
P090
P091
P092
P093
P094
P095
P096
P097
P098
P099
P100
P101
P102
P103
P104
P105
P106
P107
P108
P109
P110
P111
第11章 数仓开发之ADS层
P087
第11章 数仓开发之ADS层
11.1 流量主题
11.1.1 各来源流量统计
[atguigu@node001 ~]$ nohup /opt/module/hive/hive-3.1.2/bin/hive &
[atguigu@node001 ~]$ nohup /opt/module/hive/hive-3.1.2/bin/hive --service hiveserver2 &
[atguigu@node001 hadoop]$ cd /opt/module/hive/hive-3.1.2/
[atguigu@node001 hive-3.1.2]$ nohup bin/hive &
[1] 11485
[atguigu@node001 hive-3.1.2]$ nohup: 忽略输入并把输出追加到"nohup.out"[atguigu@node001 hive-3.1.2]$ nohup bin/hive --service hiveserver2 &
[2] 11626
[atguigu@node001 hive-3.1.2]$ nohup: 忽略输入并把输出追加到"nohup.out"
[atguigu@node001 hive-3.1.2]$
[atguigu@node001 ~]$ nohup /opt/module/hive/hive-3.1.2/bin/hive &
[1] 3815
[atguigu@node001 ~]$ nohup: 忽略输入并把输出追加到"nohup.out"[atguigu@node001 ~]$
[atguigu@node001 ~]$ jpsall
================ node001 ================
2848 NameNode
3634 JobHistoryServer
3014 DataNode
3815 RunJar
3933 Jps
3422 NodeManager
================ node002 ================
2113 NodeManager
2531 Jps
1989 ResourceManager
1783 DataNode
================ node003 ================
1908 SecondaryNameNode
2055 NodeManager
2270 Jps
1823 DataNode
[atguigu@node001 ~]$
[atguigu@node001 ~]$ nohup /opt/module/hive/hive-3.1.2/bin/hive --service hiveserver2 &
[2] 4038
[atguigu@node001 ~]$ nohup: 忽略输入并把输出追加到"nohup.out"[atguigu@node001 ~]$
[atguigu@node001 ~]$ jpsall
================ node001 ================
2848 NameNode
4225 Jps
3634 JobHistoryServer
4038 RunJar
3014 DataNode
3815 RunJar
3422 NodeManager
================ node002 ================
2113 NodeManager
1989 ResourceManager
1783 DataNode
2591 Jps
================ node003 ================
1908 SecondaryNameNode
2055 NodeManager
2334 Jps
1823 DataNode
[atguigu@node001 ~]$
P088
11.1.2 路径分析
桑基图
P089
11.1.3 各来源下单统计
P090
11.2 用户主题
11.2.1 用户变动统计
P091
11.2.2 用户留存率
P092
11.2.3 用户新增活跃统计
[2023-09-04 10:04:35] org.apache.hadoop.hive.ql.parse.SemanticException:Failed to get a spark session: org.apache.hadoop.hive.ql.metadata.HiveException: Failed to create Spark client for Spark session 1af1be50-bc68-46e3-a27f-ff9bf04c44c0
[atguigu@node001 ~]$ cd /opt/module/hive/hive-3.1.2/
[atguigu@node001 hive-3.1.2]$ bin/hivehive (default)> set hive.spark.client.server.connect.timeout=300000ms;
2023-09-04 10:14:03,044 INFO [fd295ca1-5b9b-4f12-bcff-c5db47bee932 main] conf.HiveConf (HiveConf.java:getLogIdVar(5040)) - Using the default value passed in for log id: fd295ca1-5b9b-4f12-bcff-c5db47bee932
Query returned non-zero code: 1, cause: Cannot modify hive.spark.client.server.connect.timeout at runtime. It is in the list of parameters that can't be modified at runtime or is prefixed by a restricted variable
2023-09-04 10:14:03,091 INFO [fd295ca1-5b9b-4f12-bcff-c5db47bee932 main] conf.HiveConf (HiveConf.java:getLogIdVar(5040)) - Using the default value passed in for log id: fd295ca1-5b9b-4f12-bcff-c5db47bee932
2023-09-04 10:14:03,091 INFO [fd295ca1-5b9b-4f12-bcff-c5db47bee932 main] session.SessionState (SessionState.java:resetThreadName(452)) - Resetting thread name to main
hive (default)>
set hive.spark.client.server.connect.timeout=300000ms;
P093
11.2.4 用户行为漏斗分析
P094
11.2.5 新增交易用户统计
P095
11.2.6 各年龄段下单用户数
P096
11.3 商品主题
11.3.1 各分类课程交易统计
P097
11.3.3 各课程交易统计
P098
11.3.4 各课程评价统计
P099
11.3.5 各分类课程试听留存统计
P100
11.3.6 各学科试听留存统计
P101
11.4 交易主题
11.4.1 交易综合统计
11.4.2 各省份交易统计
P102
11.5 考试主题
11.5.1 各试卷平均统计
P103
11.5.2 各课程考试相关指标统计
P104
11.5.3 各试卷成绩分布
P105
11.5.4 各题正确率
P106
11.6 播放主题
11.6.1 各章节视频播放情况统计
P107
11.6.2 各课程视频播放情况统计
P108
11.7 完课主题
11.7.1 各课程完课人数统计
-- 11.7 完课主题
-- 11.7.1 各课程完课人数统计
-- 1)建表语句
DROP TABLE IF EXISTS ads_complete_complete_user_count_per_course;
CREATE EXTERNAL TABLE ads_complete_complete_user_count_per_course
(`dt` STRING COMMENT '统计日期',`recent_days` BIGINT COMMENT '最近天数,1:最近1天,7:最近7天,30:最近30天',`course_id` STRING COMMENT '课程 id',`user_count` BIGINT COMMENT '完课人数'
) COMMENT '各课程完课人数'ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'LOCATION '/warehouse/edu/ads/ads_complete_complete_user_count_per_course/';-- 2)数据装载
-- 统计用户对应一个课程完成多少个章节
insert overwrite table edu2077.ads_complete_complete_user_count_per_course
select dt,recent_days,course_id,user_count
from edu2077.ads_complete_complete_user_count_per_course
union
select '2022-02-21' dt,recent_days,course_id,count(user_id) order_count
from (select course_id,id,user_id,max_chapter_complete_datefrom (select course_id,user_id,max(first_complete_date) max_chapter_complete_date,count(first_complete_date) user_chapter_complete_countfrom edu2077.dwd_learn_play_stats_fullwhere dt = '2022-02-21'group by course_id, user_id) chapter_completeleft join(select id,chapter_numfrom edu2077.dim_course_fullwhere dt = '2022-02-21') dim_courseon chapter_complete.course_id = dim_course.idwhere user_chapter_complete_count = chapter_num) course_completelateral view explode(array(1, 7, 30)) tmp as recent_days
where max_chapter_complete_date >= date_add('2022-02-21', -recent_days + 1)
group by recent_days, course_id;select * from ads_complete_complete_user_count_per_course;insert overwrite table edu2077.ads_complete_complete_user_count_per_course
select *
from edu2077.ads_complete_complete_user_count_per_course
union
select '2022-02-21' dt,recent_days,course_id,count(user_id) user_conunt
from (-- 完整的用户数据select course_id,user_id,first_complete_datefrom (-- 统计用户对应一个课程完成多少个章节select course_id,user_id,max(first_complete_date) first_complete_date,count(first_complete_date) user_complete_numsfrom dwd_learn_play_stats_fullwhere dt = '2022-02-21'group by course_id, user_id) t1left join (-- 统计课程一共有多少章节select id,chapter_numfrom dim_course_fullwhere dt = '2022-02-21') t2on t1.course_id = t2.id and user_complete_nums = chapter_num) t3 lateral view explode(array(1, 7, 30)) tmp as recent_days
where first_complete_date <= '2022-02-21'and first_complete_date >= date_sub('2022-02-21', recent_days - 1)
group by recent_days, course_id;select * from ads_complete_complete_user_count_per_course;
P109
11.7.2 完课综合指标
-- 11.7.2 完课综合指标
-- 1)建表语句
DROP TABLE IF EXISTS ads_complete_complete_stats;
CREATE EXTERNAL TABLE ads_complete_complete_stats
(`dt` STRING COMMENT '统计日期',`recent_days` BIGINT COMMENT '最近天数,1:最近1天,7:最近7天,30:最近30天',`user_complete_count` BIGINT COMMENT '完课人数',`user_course_complete_count` BIGINT COMMENT '完课人次'
) COMMENT '完课综合指标'ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'LOCATION '/warehouse/edu/ads/ads_complete_complete_stats/';-- 2)数据装载
insert overwrite table edu2077.ads_complete_complete_stats
select dt,recent_days,user_complete_count,user_course_complete_count
from edu2077.ads_complete_complete_stats
union
select '2022-02-21' dt,recent_days,count(distinct user_id) user_complete_count,count(*) user_course_complete_count
from (select course_id,id,user_id,max_chapter_complete_datefrom (select course_id,user_id,max(first_complete_date) max_chapter_complete_date,count(first_complete_date) user_chapter_complete_countfrom edu2077.dwd_learn_play_stats_fullwhere dt = '2022-02-21'group by course_id, user_id) chapter_completeleft join(select id,chapter_numfrom edu2077.dim_course_fullwhere dt = '2022-02-21') dim_courseon chapter_complete.course_id = dim_course.idwhere user_chapter_complete_count = chapter_num) course_completelateral view explode(array(1, 7, 30)) tmp as recent_days
where max_chapter_complete_date >= date_add('2022-02-21', -recent_days + 1)
group by recent_days;select * from ads_complete_complete_stats;insert overwrite table edu2077.ads_complete_complete_stats
select dt,recent_days,user_complete_count,user_course_complete_count
from edu2077.ads_complete_complete_stats
union
select '2022-02-21' dt,recent_days,count(distinct user_id) user_complete_count,count(*) user_course_complete_count
from (-- 完整的用户数据select course_id,user_id,first_complete_datefrom (-- 统计用户对应一个课程完成多少个章节select course_id,user_id,max(first_complete_date) first_complete_date,count(first_complete_date) user_complete_numsfrom dwd_learn_play_stats_fullwhere dt = '2022-02-21'group by course_id, user_id) t1left join (-- 统计课程一共有多少章节select id,chapter_numfrom dim_course_fullwhere dt = '2022-02-21') t2on t1.course_id = t2.id and user_complete_nums = chapter_num) t3 lateral view explode(array(1, 7, 30)) tmp as recent_days
where first_complete_date <= '2022-02-21'and first_complete_date >= date_sub('2022-02-21', recent_days - 1)
group by recent_days;select * from ads_complete_complete_stats;
P110
11.7.3 各个课程人均完成章节数
-- 11.7.3 各个课程人均完成章节数
-- 1)建表语句
DROP TABLE IF EXISTS ads_complete_complete_chapter_count_per_course;
CREATE EXTERNAL TABLE ads_complete_complete_chapter_count_per_course
(`dt` STRING COMMENT '统计日期',`recent_days` BIGINT COMMENT '最近天数,1:最近1天,7:最近7天,30:最近30天',`course_id` STRING COMMENT '课程 id',`complete_chapter_count` DECIMAL(16, 2) COMMENT '用户平均完成章节数'
) COMMENT '各课程人均完成章节视频数'ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'LOCATION '/warehouse/edu/ads/ads_complete_complete_chapter_count_per_course/';-- 2)数据装载
insert overwrite table edu2077.ads_complete_complete_chapter_count_per_course
select dt,recent_days,course_id,complete_chapter_count
from edu2077.ads_complete_complete_chapter_count_per_course
union
select '2022-02-21' dt,recent_days,course_id,count(first_complete_date) / count(distinct user_id) complete_chapter_count
from edu2077.dwd_learn_play_stats_fulllateral view explode(array(1, 7, 30)) tmp as recent_days
where dt = '2022-02-21'and first_complete_date is not nulland first_complete_date >= date_add('2022-02-21', -recent_days + 1)
group by recent_days, course_id;select * from ads_complete_complete_chapter_count_per_course;insert overwrite table edu2077.ads_complete_complete_chapter_count_per_course
select *
from edu2077.ads_complete_complete_chapter_count_per_course
union
select '2022-02-21' dt,recent_days,course_id,cast(count(first_complete_date) / count(distinct user_id) as decimal(16, 2)) complete_chapter_count
from (-- 统计用户对应一个课程完成多少个章节-- 完成的章节数select user_id,course_id,max(first_complete_date) first_complete_date,count(first_complete_date) user_complete_numsfrom dwd_learn_play_stats_fullwhere dt = '2022-02-21'group by user_id, course_id) t1 lateral view explode(array(1, 7, 30)) tmp as recent_days
group by recent_days, course_id;select * from ads_complete_complete_chapter_count_per_course;
P111
11.8 数据装载脚本
相关文章:

尚硅谷大数据项目《在线教育之离线数仓》笔记006
视频地址:尚硅谷大数据项目《在线教育之离线数仓》_哔哩哔哩_bilibili 目录 第11章 数仓开发之ADS层 P087 P088 P089 P090 P091 P092 P093 P094 P095 P096 P097 P098 P099 P100 P101 P102 P103 P104 P105 P106 P107 P108 P109 P110 P111 …...

企业架构LNMP学习笔记2
企业架构分布式集群最终解决方案 集群:多台服务器在一起做同样的事情。 分布式:多台服务器在一起做不同的事情。 最终架构:实现负载均衡LB,高可用HA,数据库主从复制M-S,读写分离R-W,缓存中间件…...

AI「反腐」,德国马普所结合 NLP 和 DNN 开发抗蚀合金
内容一览:在被不锈钢包围的世界中,我们可能都快忘记了腐蚀的存在。然而,腐蚀存在于生活中的方方面面。无论是锈迹斑斑的钢钉,老化漏液的电线,还是失去光泽的汽车,这一切的发生都与腐蚀有关。据统计…...

9-AJAX-2综合案例
AJAX-综合案例 目录 案例-图书管理图片上传案例-网站换肤案例-个人信息设置 学习目标 今天主要就是练,巩固 axios 的使用 完成案例-图书管理系统(增删改查)经典业务掌握图片上传的思路完成案例-网站换肤并实现图片地址缓存完成案例-个人信…...

力扣:86. 分隔链表(Python3)
题目: 给你一个链表的头节点 head 和一个特定值 x ,请你对链表进行分隔,使得所有 小于 x 的节点都出现在 大于或等于 x 的节点之前。 你应当 保留 两个分区中每个节点的初始相对位置。 来源:力扣(LeetCode)…...

联合教育部高等学校科学研究发展中心,阿依瓦科技创新教育专项正式发布!
7 月 24 日,教育部科技发展中心官网发布了《中国高校产学研创新基金-阿依瓦科技创新教育专项申请指南》。 针对高校在人工智能、智能制造、智慧校园、大数据等领域科研和教研的创新研究,教育部高等学校科学研究发展中心与阿依瓦(北京)技术有…...

Ubuntu入门05——磁盘管理与备份压缩
1.检查磁盘空间占用情况 2.统计目录或文件所占磁盘空间大小 3.压缩 3.1 zip、unzip和zipinfo 运行时发现上面命令不成功,换成: (将文件lkw放入压缩文件lkw01.zip中) sudo zip -m lkw01.zip lkw 解压文件: 实操&…...

[github-100天机器学习]day4+5+6 Logistic regression
https://github.com/MLEveryday/100-Days-Of-ML-Code/blob/master/README.md 逻辑回归 逻辑回归用来处理不同的分类问题,这里的目的是预测当前被观察的对象属于哪个组。会给你提供一个离散的二进制输出结果,一个简单例子:判断一个人是否会在…...

【菜鸡学艺–Vue2–001】模板语法声明式渲染
【菜鸡学艺–Vue2–001】模板语法&声明式渲染 🦖我是Sam9029,一个前端 Sam9029的CSDN博客主页:Sam9029的博客_CSDN博客-JS学习,CSS学习,Vue-2领域博主 **🐱🐉🐱🐉恭喜你,若此文你认为写…...

LabVIEW开发感应电机在线匝间短路故障诊断系统
LabVIEW开发感应电机在线匝间短路故障诊断系统 工业中使用的超过85%的电动机是三相感应电动机。它们因其可靠性、设计便利性、高性能和过载能力而被广泛用于不同的应用,例如制造、加工、电力系统、运输等。无论它们的能力如何,它们都被认为是现代工业学…...

Deepin / UOS 安装自带的Qt
Deepin / UOS 安装自带的Qt 安装Qt版本可从官网下载也可以使用Deepin / UOS 自己维护的Qt版本,好处是针对Deepin/UOS系统进行了针对性的优化,比如QtCreator的界面和系统UI保持一致。 查询Qt版本及是否安装 sudo apt policy qtbase5-devsudo apt polic…...

vite+vue3+element-plus
vitevue3element-plus 1.开始 npm create vitelatest app -- --template vuenpm installlnpm run dev2.引入element-ui npm install element-plus修改main.js import ElementPlus from element-plus import element-plus/dist/index.css createApp(App).use(ElementPlus).m…...

uni-app 之 tabBar 底部切换按钮
uni-app 之 tabBar 底部切换按钮 1693289945724.png {"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages{"path": "pages/home/home","style": {"navigatio…...

VSCode 配置 C 语言编程环境
目录 一、下载 mingw64 二、配置环境变量 三、三个配置文件 四、格式化代码 1、安装插件 2、保存时自动格式化 3、左 { 不换行 上了两年大学,都还没花心思去搭建 C 语言编程环境,惭愧,惭愧。 一、下载 mingw64 mingw64 是著名的 C/C…...

LeetCode 热题 100——找到字符串中所有字母异位词(滑动窗口)
题目链接 力扣(LeetCode)官网 - 全球极客挚爱的技术成长平台 题目解析 该题目的意思简而言之就是说,从s字符串中寻找与p字符串含有相同字符(次数和种类均相同)的子串,并且将他们的首字符下标集合进数组中进行返回。 滑动窗口解…...

uniapp从零到一的学习商城实战
涵盖的功能: 安装开发工具HBuilder:HBuilderX-高效极客技巧 创建项目步骤: 1.右键-项目: 2.选择vue2和默认模板: 3.完整的项目目录: 微信开发者工具调试: 1.安装微信开发者工具 2.打开…...

应广单片机实现跑马灯
应广单片机处处体现其mini的特性,非常适合做各种方案开发,特别是点灯,什么跑马灯,氛围灯,遥控灯,感应灯,拍拍灯等,用应广都OK。 跑马灯是基础中的基础,我搭了一个框架&am…...

关于el-input和el-select宽度不一致问题解决
1. 情景一 单列布局 对于上图这种情况,只需要给el-select加上style"width: 100%"即可,如下: <el-select v-model"fjForm.region" placeholder"请选择阀门类型" style"width: 100%"><el-o…...

【Unity3D赛车游戏优化篇】【八】汽车实现镜头的流畅跟随,以及不同角度的切换
👨💻个人主页:元宇宙-秩沅 👨💻 hallo 欢迎 点赞👍 收藏⭐ 留言📝 加关注✅! 👨💻 本文由 秩沅 原创 👨💻 收录于专栏:Uni…...

VScode连接远程JupyterNotebook显示点云ply文件
1. remote ssh的配置文件config中添加 Host Jupyter-ServerHostName <IP>ForwardX11 yesForwardX11Trusted yesForwardAgent yesUser <Username> 2. 在远程服务器的.sshd_config中把X11forward的开关打开为yes 3. 在home文件夹中更改.bashrc,加入以下…...

python安装wind10
一、下载: 官网:Python Releases for Windows | Python.org 二、安装 双击下载的安装程序文件。这将打开安装向导。安装界面图下方两个框的" Use admin privileges wheninstalling py. exe和” Add python. exe to PATH"都要勾选,一定要勾选!一定要勾选…...

uni-app 中 swiper 轮播图高度自适应
方法一 1、首先 swiper 标签的宽度是 width: 100% 2、swiper 标签存在默认高度是 height: 150px ;高度无法实现由内容撑开,在默认情况下,图片的高度显示总是 150px swiper 宽度 / swiper 高度 原图宽度 / 原图高度 swiper 高度 swiper …...

开源风雷CFD软件多物理场耦合接口开发路线分享!!!
本文将基于开发过程中积累的经验,介绍风雷如何基于preCICE开发适配器。 preCICE是一个开源的多物理场数值模拟耦合库,可以用于多个求解器联合求解一个复杂的多场问题,支持在大规模并行系统上应用,具有良好的并行效率。并且可以对…...

浅谈Mysql读写分离的坑以及应对的方案 | 京东云技术团队
一、主从架构 为什么我们要进行读写分离?个人觉得还是业务发展到一定的规模,驱动技术架构的改革,读写分离可以减轻单台服务器的压力,将读请求和写请求分流到不同的服务器,分摊单台服务的负载,提高可用性&a…...

最近在对接电商供应链,说说开放平台API接口
B2B电商开放平台的设计需要从以下几面去思考: 开放平台API接口的设计,主要是从功能需求的角度,设计满足业务需求的接口及对应的字段; 平台与商家之间信息的对接,对接的方法有哪些?对接过程中需要可能会遇到…...

【FusionInsight 迁移】HBase从C50迁移到6.5.1(02)C50上准备FTP Server
【FusionInsight 迁移】HBase从C50迁移到6.5.1(02)C50上准备FTP Server HBase从C50迁移到6.5.1(02)C50上准备FTP Server登录老集群FusionInsight C50的Manager准备FTP User准备FTP Server HBase从C50迁移到6.5.1(02&am…...

Java操作符学习笔记
1、布尔类型的逻辑操作符和按位操作符 & 和 &&、|| 和 | 其实是两种操作符。在使用逻辑判断时,有时不希望产生短路作用,会对两个布尔类型值使用单个的 & 或 |运算。这让我一直将单个 & 和 | 当成时逻辑操作符的一种,而事…...

【STM32】学习笔记-PWR(Power Control)电源控制
PWR(Power Control)电源控制 PWR(Power Control)电源控制是一种技术或设备,用于控制电源的开关和输出。它通常用于电源管理和节能,可以通过控制电源的工作状态来延长电子设备的使用寿命,减少能…...

安卓 MeasureCache优化了什么?
安卓绘制原理概览_油炸板蓝根的博客-CSDN博客 搜了一下,全网居然没有人提过 measureCache。 在前文中提到过,measure的时候,如果命中了 measureCache,会跳过 onMeasure,同时会设置 PFLAG3_MEASURE_NEEDED_BEFORE_LAYOU…...

docker save docker export 区别
docker save用于导出镜像到文件,包含镜像元数据和历史信息;docker export用于将当前容器状态导出至文件,类似快照,所以不包含元数据及历史信息,体积更小,此外从容器快照导入时也可以重新指定标签和元数据信…...