数据洞察:从零到一的数据仓库与Navicat连接全攻略【实训Day04】[完结篇]

一、数据分析

1 实现数据仓库(在hadoop101上)

1) 创建jobdata数据库

# cd $HIVE_HOME 
# bin/hive 
hive>create database jobdata;
hive>use jobdata;

2) 创建原始职位数据事实表ods_jobdata_orgin(在hadoop101上)

create table ods_jobdata_origin(
city string COMMENT '城市',
salary array<String> COMMENT '薪资',
company array<String> COMMENT '福利',
kill array<String> COMMENT '技能')
COMMENT '原始职位数据表'
ROW FORMAT DELIMITED 
FIELDS TERMINATED BY ',' 
COLLECTION ITEMS TERMINATED BY '-' 
STORED AS TEXTFILE;

3) 将HDFS上预处理的数据导入到ods_jobdata_orgin(在hadoop101上)

hive>load data inpath '/JobData/output/part-r-00000' overwrite into table ods_jobdata_origin ;
				
hive>select * from ods_jobdata_origin;

4) 创建职位数据明细表 ods_jobdata_detail(在hadoop101上)

hive>create table ods_jobdata_detail(
			city string COMMENT '城市',
			salary array<String> COMMENT '薪资',
			company array<String> COMMENT '福利',
			kill array<String> COMMENT '技能',
			low_salary int COMMENT '低薪资',
			high_salary int COMMENT '高薪资',
			avg_salary double COMMENT '平均薪资')
			COMMENT '职位数据明细表'
			ROW FORMAT DELIMITED
			FIELDS TERMINATED BY ','
			STORED AS TEXTFILE;

5) 向职位数据明细表导入数据

hive>insert overwrite table ods_jobdata_detail
				select
				city,salary,company,kill,salary[0],salary[1],(
				salary[0]+salary[1])/2
				from ods_jobdata_origin;

6) 创建临时表t_ods_tmp_salary(在hadoop101上)

hive>create table t_ods_tmp_salary as
				select explode(ojo.salary) from
				ods_jobdata_origin ojo;

7) 创建工资处理表 t_ods_tmp_salary_dist(在hadoop101上)

hive>create table t_ods_tmp_salary_dist as
				select case when col>=0 and col<=5 then '0-5'
				when col>=6 and col<=10 then '6-10'
				when col>=11 and col<=15 then '11-15'
				when col>=16 and col<=20 then '16-20'
				when col>=21 and col<=25 then '21-25'
				when col>=26 and col<=30 then '26-30'
				when col>=31 and col<=35 then '31-35'
				when col>=36 and col<=40 then '36-40'
				when col>=41 and col<=45 then '41-45'
				when col>=46 and col<=50 then '46-50'
				when col>=51 and col<=55 then '51-55'
				when col>=56 and col<=60 then '56-60'
				when col>=61 and col<=65 then '61-65'
				when col>=66 and col<=70 then '66-70'
				when col>=71 and col<=75 then '71-75'
				when col>=76 and col<=80 then '76-80'
				when col>=81 and col<=85 then '81-85'
				when col>=86 and col<=90 then '86-90'
				when col>=91 and col<=95 then '91-95'
				when col>=96 and col<=100 then '96-100'
				when col>=101 then '>101' end from
				t_ods_tmp_salary;

8) 创建福利标签临时表t_ods_tmp_company(在hadoop101上)

hive>create table t_ods_tmp_company as
			select explode(ojo.company)
			from ods_jobdata_origin ojo;

9) 创建技能标签临时表t_ods_tmp_kill(在hadoop101上)

hive>create table t_ods_tmp_kill as
			select explode(ojo.kill)
			from ods_jobdata_origin ojo;

10) 创建技能维度表t_ods_kill(在hadoop101上)

hive>create table t_ods_kill(
			every_kill String comment '技能标签',
			count int comment '词频')
			COMMENT '技能标签词频统计'
			ROW FORMAT DELIMITED
			fields terminated by ','
			STORED AS TEXTFILE;

11)创建福利维度表t_ods_company(在hadoop101上)

hive>create table t_ods_company(
			every_company String comment '福利标签',
			count int comment '词频')
			COMMENT '福利标签词频统计'
			ROW FORMAT DELIMITED
			fields terminated by ','
			STORED AS TEXTFILE;

12)创建城市维度表t_ods_city(在hadoop101上)

hive>create table t_ods_city(
			every_city String comment '城市',
			count int comment '词频')
			COMMENT '城市统计'
			ROW FORMAT DELIMITED
			fields terminated by ','
			STORED AS TEXTFILE;

13) 职位区域分析

hive>insert overwrite table t_ods_city
			select city,count(1)
			from ods_jobdata_origin group by city;
			
hive>select *  from t_ods_city sort by count desc;

14) 创建薪资维度表

hive>create table t_ods_salary(
			every_partition String comment '薪资分布',
			count int comment '聚合统计')
			COMMENT '薪资分布聚合统计'
			ROW FORMAT DELIMITED
			fields terminated by ','
			STORED AS TEXTFILE;

15) 职位薪资分析(全国薪资分布情况)

hive>insert overwrite table t_ods_salary
			select `_c0`,count(1)
			from t_ods_tmp_salary_dist group by `_c0`;
			
hive>select * from t_ods_salary sort by count desc;

16) 职位薪资分析(薪资的平均值、中位数和众数)

hive>select avg(avg_salary) from ods_jobdata_detail;
			
hive>select avg_salary,count(1) as cnt from ods_jobdata_detail group by avg_salary order by cnt desc limit 1;
				
hive>select percentile(cast(avg_salary as BIGINT),0.5) from ods_jobdata_detail;

17) 职位薪资分析(各城市平均薪资待遇)

hive>select city,count(city),round(avg(avg_salary),2) as cnt
				from ods_jobdata_detail
				group by city order by cnt desc;

18) 公司福利分析

hive>insert overwrite table t_ods_company
				select col,count(1)
				from t_ods_tmp_company group by col;
				
hive>select every_company,count
				from t_ods_company
				sort by count desc limit 10;

systemctl status mysqld.service 查看状态

二、连接navicat

           

1.建表

create table t_city_count(
city varchar(30) DEFAULT NULL,
count int(5) DEFAULT NULL)
ENGINE=InnoDB DEFAULT CHARSET=utf8;
create table t_salary_dist(
salary varchar(30) DEFAULT NULL,
count int(5) DEFAULT NULL)
ENGINE=InnoDB DEFAULT CHARSET=utf8;
create table t_company_count(
company varchar(30) DEFAULT NULL,
count int(5) DEFAULT NULL)
ENGINE=InnoDB DEFAULT CHARSET=utf8;
create table t_kill_count(
kills varchar(30) DEFAULT NULL,
count int(5) DEFAULT NULL)
ENGINE=InnoDB DEFAULT CHARSET=utf8;

2.启动sqoop传输文件,把hive数据库传输到mysql数据库

bin/sqoop export \
--connect jdbc:mysql://hadoop101:3306/JobData?characterEncoding=UTF-8 \
--username root \
--password 123456 \
--table t_city_count \
--columns "city,count" \
--fields-terminated-by ',' \
--export-dir /user/hive/warehouse/jobdata.db/t_ods_city;

在这个目录下执行上面的命令

bin/sqoop export \
--connect jdbc:mysql://hadoop101:3306/JobData?characterEncoding=UTF-8 \
--username root \
--password 123456 \
--table t_salary_dist \
--columns "salary,count" \
--fields-terminated-by ',' \
--export-dir /user/hive/warehouse/jobdata.db/t_ods_salary;
bin/sqoop export \
--connect jdbc:mysql://hadoop101:3306/JobData?characterEncoding=UTF-8 \
--username root \
--password 123456 \
--table t_company_count \
--columns "company,count" \
--fields-terminated-by ',' \
--export-dir /user/hive/warehouse/jobdata.db/t_ods_company;

bin/sqoop export \
--connect jdbc:mysql://hadoop101:3306/JobData?characterEncoding=UTF-8 \
--username root \
--password 123456 \
--table t_kill_count \
--columns "kills,count" \
--fields-terminated-by ',' \
--export-dir /user/hive/warehouse/jobdata.db/t_ods_kill;

3.添加依赖

pom.xml添加内容

<dependencies>
    <!--1.阿里云json处理jar包-->
    <dependency>
      <groupId>org.codehaus.jettison</groupId>
      <artifactId>jettison</artifactId>
      <version>1.5.4</version>
    </dependency>

    <!--2.spring-context-->
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-context</artifactId>
      <version>5.2.5.RELEASE</version>
    </dependency>

    <!--3.spring-beans-->
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-beans</artifactId>
      <version>5.2.5.RELEASE</version>
    </dependency>

    <!--4.spring-webmvc 网站设计-->
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-webmvc</artifactId>
      <version>5.2.5.RELEASE</version>
    </dependency>

    <!--5.spring-jdbc连接数据库-->
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-jdbc</artifactId>
      <version>5.2.5.RELEASE</version>
    </dependency>

    <!--6.spring-aspects是AOP切面编程-->
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-aspects</artifactId>
      <version>5.2.5.RELEASE</version>
    </dependency>

    <!--7.spring-jms异步消息通信-->
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-jms</artifactId>
      <version>5.2.5.RELEASE</version>
    </dependency>

    <!--8.spring-context-support框架扩展模块-->
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-context-support</artifactId>
      <version>5.2.5.RELEASE</version>
    </dependency>

    <!--9.mybatis框架-->
    <dependency>
      <groupId>org.mybatis</groupId>
      <artifactId>mybatis</artifactId>
      <version>3.5.1</version>
    </dependency>


    <!--10.mybatis-spring-->
    <dependency>
      <groupId>org.mybatis</groupId>
      <artifactId>mybatis-spring</artifactId>
      <version>1.3.1</version>
    </dependency>

    <!--11.mybatis分页插件-->
    <dependency>
      <groupId>com.github.miemiedev</groupId>
      <artifactId>mybatis-paginator</artifactId>
      <version>1.2.15</version>
    </dependency>

    <!--12.mysql驱动模块-->
    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>5.1.9</version>
    </dependency>

    <!--13.阿里巴巴数据库连接池-->
    <dependency>
      <groupId>com.alibaba</groupId>
      <artifactId>druid</artifactId>
      <version>1.2.16</version>
      <exclusions>
        <exclusion>
          <groupId>com.alibaba</groupId>
          <artifactId>jconsole</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.alibaba</groupId>
          <artifactId>tools</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <!--14.jsp的标准标签库-->
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>jstl</artifactId>
      <version>1.2</version>
    </dependency>

    <!--15.servlet的标准API-->
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
      <version>2.5</version>
    </dependency>

    <!--16.jsp的标准API-->
    <dependency>
      <groupId>javax.servlet.jsp</groupId>
      <artifactId>jsp-api</artifactId>
      <version>2.1</version>
    </dependency>

    <!--17.测试包-->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
    </dependency>
    <!--18.处理JSON数据类型-->
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>2.10.1</version>
    </dependency>

    <!--19.面向切面编程的功能模块-->
    <dependency>
      <groupId>org.aspectj</groupId>
      <artifactId>aspectjweaver</artifactId>
      <version>1.9.22</version>
    </dependency>
  </dependencies>
<build>
    <finalName>JobData-Web</finalName>
    <!--资源搜索设置-->
    <resources>
      <!--1.搜索java文件夹中类型-->
      <resource>
        <directory>src/main/java</directory>
        <includes>
          <include>**/*.properties</include>
          <include>**/*.xml</include>
        </includes>
        <filtering>false</filtering>
      </resource>
      <!--2.搜索resources文件夹的类型-->
      <resource>
        <directory>src/main/resources</directory>
        <includes>
          <include>**/*.properties</include>
          <include>**/*.xml</include>
        </includes>
      </resource>
    </resources>

    <!--插件管理-->
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
          <encoding>UTF-8</encoding>
        </configuration>
      </plugin>
    </plugins>

  </build>

4.db.properties添加内容

jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://hadoop101:3306/JobData?characterEncoding=utf8
jdbc.username=root
jdbc.password=123456

5.echarts-view.js添加内容

6.下载tomcata

将其放在根盘符下,解压缩tomcat到其目录E:\apache-tomcat-8.5.61

7.重启tomcat

删除上方红框内容

8.查看报错内容

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'cityServiceImpl': Unsatisfied dependency expressed through field 'mapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'cn.aust.mapper.CityMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

出现该问题解决方案

最终效果展示:


Day04:完结~

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/774453.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

【测试开发】【postman】按顺序循环执行接口

postman按顺序循环执行接口 新建接口接口排序执行请求集合 新建接口 Request 001 Request 002 Request 003 接口排序 在Request 001的Tests中添加代码 postman.setNextRequest("Request 002");在Request 002的Tests中添加代码 postman.setNextRequest("Requ…

ASP.NET Core 使用Log4net

1. Nuget安装log4net&#xff0c;图里的两个 2.项目根目录下添加log4net.config.添加下面的代码: <?xml version"1.0" encoding"utf-8"?> <configuration><!-- This section contains the log4net configuration settings --><log…

“免费”的可视化大屏案例分享-智慧园区综合管理平台

一.智慧园区是什么&#xff1f; 智慧园区是一种融合了新一代信息与通信技术的先进园区发展理念。它通过迅捷信息采集、高速信息传输、高度集中计算、智能事务处理和无所不在的服务提供能力&#xff0c;实现了园区内及时、互动、整合的信息感知、传递和处理。这样的园区旨在提高…

k8s离线安装安装skywalking9.4

目录 概述资源下载Skywalking功能介绍成果速览实践rbacoapoap-svcuiui-svc 结束 概述 k8s 离线安装安装 skywalking9.4 版本&#xff0c;环境&#xff1a;k8s版本为&#xff1a;1.27.x 、spring boot 2.7.x spring cloud &#xff1a;2021.0.5 、spring.cloud.alibab&#xff1…

IDEA如何引入外部jar包

导了3次&#xff0c;记不住&#xff0c;写篇博客记一下&#xff1b; 1、File->Project Structure->项目名称->JARs or Dircetories... 2、选择所要导入的jar包【可多选】&#xff1b;此处图片略&#xff1b; 3、选中后点击确定&#xff0c;jar会显示在idea的目录中&…

零基础必看html5

文本格式化标签 <!DOCTYPE html> <html lang"en"><head><meta charset"UTF-8"><meta name"viewport" content"widthdevice-width, initial-scale1.0"><title>Document</title> </head&g…

6月30日功能测试Day10

3.4.4拼团购测试点 功能位置&#xff1a;营销-----拼团购 后台优惠促销列表管理可以添加拼团&#xff0c;查看拼团活动&#xff0c;启动活动&#xff0c;编辑活动&#xff0c;删除活动。 可以查看拼团活动中已下单的订单以状态 需求分析 功能和添加拼团 商品拼团活动页 3…

【python】Python中常用的数据结构——列表、元组和字典

python中的数据结构 列表、元组、字典的区别元组&#xff0c;字典&#xff0c;列表三者之间如何实现嵌套生成一个单一元素的元组、列表列表的地址列表、元组和字典的增删改查 列表、元组、字典的区别 列表、元组和字典是Python中常用的数据结构&#xff0c;它们各自有不同的特…

香橙派AIpro测评:yolo8+usb鱼眼摄像头的Camera图像获取及识别

一、前言 近期收到了一块受到业界人士关注的开发板"香橙派AIpro",因为这块板子具有极高的性价比&#xff0c;同时还可以兼容ubuntu、安卓等多种操作系统&#xff0c;今天博主便要在一块832g的香橙派AI香橙派AIpro进行YoloV8s算法的部署并使用一个外接的鱼眼USB摄像头…

14-28 剑和诗人2 - 高性能编程Bend和Mojo

介绍&#xff1a; 在不断发展的计算世界中&#xff0c;软件和硬件之间的界限变得越来越模糊。随着我们不断突破技术可能性的界限&#xff0c;对能够利用现代硬件功能的高效、可扩展的编程语言的需求从未如此迫切。 Bend和 Mojo是编程语言领域的两种新秀&#xff0c;它们有望弥…

RT-Thread Studio与CubeMX联合编程之rtthread启动

看到了好多文章&#xff0c;在rtthread studio中启用mx&#xff0c;后总是复制mx相关msp函数到rt的board.c文件下&#xff0c;实际使用过程中发现并不需要&#xff0c;这里我们看下rt启动流程&#xff0c;看下到底需要不。 1.打开startup_stm32h743xx.S文件&#xff0c;看下芯片…

法国工程师IMT联盟 密码学及其应用 2023年期末考试补考题

1 JAVA 安全 1.1 问题1 1.1.1 问题 用 2 或 3 句话解释 Java 执行模型&#xff08;Java 虚拟机machine virtuelle Java)&#xff09;中引入introduit沙箱bac sable机制 mcanisme d’excution par isolation的目的。 1.1.2 问题解释 在 Java 执行模型&#xff08;Java 虚拟机…

【车载开发系列】J-Link/JFlash 简介与驱动安装方法

【车载开发系列】J-Link/JFlash 简介与驱动安装方法 【车载开发系列】J-Link/JFlash 简介与驱动安装方法 【车载开发系列】J-Link/JFlash 简介与驱动安装方法一. 软件介绍二. 下载安装包二. 开始安装三. 确认安装四. J-Flash的使用 一. 软件介绍 J-Link是SEGGER公司为支持仿真…

昇思25天学习打卡营第07天 | 函数式自动微分

昇思25天学习打卡营第07天 | 函数式自动微分 文章目录 昇思25天学习打卡营第07天 | 函数式自动微分函数与计算图微分函数与梯度Stop GradientAuxiliary data 神经网络梯度计算总结打卡 神经网络的训练主要使用反向传播算法&#xff0c;首先计算模型预测值&#xff08;logits&am…

【IC】mismatch model

由于工艺和制造偏差的存在,相同设计参数的器件会存在参数间额差异,称为mismatch,通常用Monte Carlo去仿真多个mismatch叠加对设计的总影响。 器件偏差mismatch是工艺和制造偏差导致的,在Lot to Lot、Wafer to Wafer、Die to Die 以及in die的Device to Deview之间可见。 …

OZON怎么查看竞品数据,OZON怎么找竞品数据

在跨境电商的激烈竞争中&#xff0c;了解和分析竞品数据是每一位卖家优化销售策略、提升市场竞争力的关键步骤。OZON作为俄罗斯领先的电商平台&#xff0c;为卖家提供了丰富的数据分析工具&#xff0c;而萌啦ozon数据作为第三方数据分析平台&#xff0c;更是为卖家提供了更为全…

四、centos7安装nginx

来源网站&#xff1a;山海同行 来源地址&#xff1a;https://shanhaigo.cn 网站简介&#xff1a;一站式编程学习、资源、导航网站 本篇资源&#xff1a;以整理分类并关联本篇地址 本篇地址&#xff1a;https://shanhaigo.cn/courseDetail/1805875642621952000 安装系统centos7 …

CASS7.0按方向和距离绘制图形

1、绘制工具 2、按方向和距离绘制 &#xff08;1&#xff09;切换方向 &#xff08;2&#xff09;距离输入

【算法:贪心】:贪心算法介绍+基础题(四个步骤);柠檬水找零(交换论证法)

&#x1f381;个人主页&#xff1a;我们的五年 &#x1f50d;系列专栏&#xff1a;C课程学习 &#x1f389;欢迎大家点赞&#x1f44d;评论&#x1f4dd;收藏⭐文章 前言&#xff1a; 暑假马上就要留校学习算法了&#xff0c;现在先学习一下基本的算法打打基础。本篇要讲的是…