Spark SQL 项目:实现各区域热门商品前N统计

2023-11-20

一. 需求

1.1 需求简介
这里的热门商品是从点击量的维度来看的.

计算各个区域前三大热门商品,并备注上每个商品在主要城市中的分布比例,超过两个城市用其他显示。




1.2 思路分析
使用 sql 来完成. 碰到复杂的需求, 可以使用 udf 或 udaf

查询出来所有的点击记录, 并与 city_info 表连接, 得到每个城市所在的地区. 与 Product_info 表连接得到产品名称
按照地区和商品 id 分组, 统计出每个商品在每个地区的总点击次数
每个地区内按照点击次数降序排列
只取前三名. 并把结果保存在数据库中
城市备注需要自定义 UDAF 函数



二. 实际操作
1. 准备数据
  我们这次 Spark-sql 操作中所有的数据均来自 Hive.

  首先在 Hive 中创建表, 并导入数据.

  一共有 3 张表: 1 张用户行为表, 1 张城市表, 1 张产品表

1. 打开Hive




2. 创建三个表

 
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
CREATE TABLE `user_visit_action`(
  `date` string,
  `user_id` bigint,
  `session_id` string,
  `page_id` bigint,
  `action_time` string,
  `search_keyword` string,
  `click_category_id` bigint,
  `click_product_id` bigint,
  `order_category_ids` string,
  `order_product_ids` string,
  `pay_category_ids` string,
  `pay_product_ids` string,
  `city_id` bigint)
row format delimited fields terminated by '\t';
 
CREATE TABLE `product_info`(
  `product_id` bigint,
  `product_name` string,
  `extend_info` string)
row format delimited fields terminated by '\t';
 
CREATE TABLE `city_info`(
  `city_id` bigint,
  `city_name` string,
  `area` string)
row format delimited fields terminated by '\t';





3. 上传数据

 
1
2
3
load data local inpath '/opt/module/datas/user_visit_action.txt' into table spark0806.user_visit_action;
load data local inpath '/opt/module/datas/product_info.txt' into table spark0806.product_info;
load data local inpath '/opt/module/datas/city_info.txt' into table spark0806.city_info;





4. 测试是否上传成功

 
1
hive> select * from city_info;





2. 显示各区域热门商品 Top3

 
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// user_visit_action  product_info  city_info
 
1. 先把需要的字段查出来   t1
select
    ci.*,
    pi.product_name,
    click_product_id
from user_visit_action uva
join product_info pi on uva.click_product_id=pi.product_id
join city_info ci on uva.city_id=ci.city_id
 
2. 按照地区和商品名称聚合
select
    area,
    product_name,
    count(*)  count
from t1
group by area , product_name
 
3. 按照地区进行分组开窗 排序 开窗函数 t3 // (rank(1 2 2 4 5...) row_number(1 2 3 4...) dense_rank(1 2 2 3 4...))
select
    area,
    product_name,
    count,
    rank() over(partition by area order by count desc)
from  t2
 
 
4. 过滤出来名次小于等于3的
select
    area,
    product_name,
    count
from  t3
where rk <=3



2. 运行结果




3. 定义udaf函数 得到需求结果

 
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
package com.buwenbuhuo.spark.sql.project
 
import java.text.DecimalFormat
 
import org.apache.spark.sql.Row
import org.apache.spark.sql.expressions.{MutableAggregationBuffer, UserDefinedAggregateFunction}
import org.apache.spark.sql.types._
 
 
/**
 **
 *
 * @author 不温卜火
 *         *
 * @create 2020-08-06 13:24
 **
 *         MyCSDN :  [url=https://buwenbuhuo.blog.csdn.net/]https://buwenbuhuo.blog.csdn.net/[/url]
 *
 */
class CityRemarkUDAF extends UserDefinedAggregateFunction {
  // 输入数据的类型:  北京  String
  override def inputSchema: StructType = {
    StructType(Array(StructField("city", StringType)))
  }
 
  // 缓存的数据的类型 每个地区的每个商品 缓冲所有城市的点击量 北京->1000, 天津->5000  Map,  总的点击量  1000/?
  override def bufferSchema: StructType = {
    StructType(Array(StructField("map", MapType(StringType, LongType)), StructField("total", LongType)))
  }
 
  // 输出的数据类型  "北京21.2%,天津13.2%,其他65.6%"  String
  override def dataType: DataType = StringType
 
  // 相同的输入是否应用有相同的输出.
  override def deterministic: Boolean = true
 
  // 给存储数据初始化
  override def initialize(buffer: MutableAggregationBuffer): Unit = {
    //初始化map缓存
    buffer(0) = Map[String, Long]()
    // 初始化总的点击量
    buffer(1) = 0L
  }
 
  // 分区内合并 Map[城市名, 点击量]
  override def update(buffer: MutableAggregationBuffer, input: Row): Unit = {
    input match {
      case Row(cityName: String) =>
        // 1. 总的点击量 + 1
        buffer(1) = buffer.getLong(1) + 1L
        // 2. 给这个城市的点击量 +1 =>   找到缓冲区的map,取出来这个城市原来的点击 + 1 ,再复制过去
        val map: collection.Map[String, Long] = buffer.getMap[String, Long](0)
        buffer(0) = map + (cityName -> (map.getOrElse(cityName, 0L) + 1L))
      case _ =>
    }
  }
 
  // 分区间的合并
  override def merge(buffer1: MutableAggregationBuffer, buffer2: Row): Unit = {
    val map1 = buffer1.getAs[Map[String, Long]](0)
    val map2 = buffer2.getAs[Map[String, Long]](0)
 
    val total1: Long = buffer1.getLong(1)
    val total2: Long = buffer2.getLong(1)
 
    // 1. 总数的聚合
    buffer1(1) = total1 + total2
    // 2. map的聚合
    buffer1(0) = map1.foldLeft(map2) {
      case (map, (cityName, count)) =>
        map + (cityName -> (map.getOrElse(cityName, 0L) + count))
    }
 
  }
 
  // 最终的输出结果
  override def evaluate(buffer: Row): Any = {
    // "北京21.2%,天津13.2%,其他65.6%"
    val cityAndCount: collection.Map[String, Long] = buffer.getMap[String, Long](0)
    val total: Long = buffer.getLong(1)
 
    val cityCountTop2: List[(String, Long)] = cityAndCount.toList.sortBy(-_._2).take(2)
    var cityRemarks: List[CityRemark] = cityCountTop2.map {
      case (cityName, count) => CityRemark(cityName, count.toDouble / total)
    }
//    CityRemark("其他",1 - cityremarks.foldLeft(0D)(_+_.cityRatio))
    cityRemarks :+= CityRemark("其他",cityRemarks.foldLeft(1D)(_ - _.cityRatio))
    cityRemarks.mkString(",")
  }
}
 
case class CityRemark(cityName: String, cityRatio: Double) {
  val formatter = new DecimalFormat("0.00%")
 
  override def toString: String = s"$cityName:${formatter.format(cityRatio)}"
 
}



运行结果




4 .保存到Mysql

1. 源码

 
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
val props: Properties = new Properties()
props.put("user","root")
props.put("password","199712")
spark.sql(
  """
    |select
    |    area,
    |    product_name,
    |    count,
    |    remark
    |from t3
    |where rk<=3
    |""".stripMargin)
  .coalesce(1)
  .write
  .mode("overwrite")
  .jdbc("jdbc:mysql://hadoop002:3306/rdd?useUnicode=true&characterEncoding=utf8", "spark0806", props)



2.运行结果





三. 完整代码

1. udaf

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
package com.buwenbuhuo.spark.sql.project
 
import java.text.DecimalFormat
 
import org.apache.spark.sql.Row
import org.apache.spark.sql.expressions.{MutableAggregationBuffer, UserDefinedAggregateFunction}
import org.apache.spark.sql.types._
 
 
/**
 **
 *
 * @author 不温卜火
 *         *
 * @create 2020-08-06 13:24
 **
 *         MyCSDN :  [url=https://buwenbuhuo.blog.csdn.net/]https://buwenbuhuo.blog.csdn.net/[/url]
 *
 */
class CityRemarkUDAF extends UserDefinedAggregateFunction {
  // 输入数据的类型:  北京  String
  override def inputSchema: StructType = {
    StructType(Array(StructField("city", StringType)))
  }
 
  // 缓存的数据的类型 每个地区的每个商品 缓冲所有城市的点击量 北京->1000, 天津->5000  Map,  总的点击量  1000/?
  override def bufferSchema: StructType = {
    StructType(Array(StructField("map", MapType(StringType, LongType)), StructField("total", LongType)))
  }
 
  // 输出的数据类型  "北京21.2%,天津13.2%,其他65.6%"  String
  override def dataType: DataType = StringType
 
  // 相同的输入是否应用有相同的输出.
  override def deterministic: Boolean = true
 
  // 给存储数据初始化
  override def initialize(buffer: MutableAggregationBuffer): Unit = {
    //初始化map缓存
    buffer(0) = Map[String, Long]()
    // 初始化总的点击量
    buffer(1) = 0L
  }
 
  // 分区内合并 Map[城市名, 点击量]
  override def update(buffer: MutableAggregationBuffer, input: Row): Unit = {
    input match {
      case Row(cityName: String) =>
        // 1. 总的点击量 + 1
        buffer(1) = buffer.getLong(1) + 1L
        // 2. 给这个城市的点击量 +1 =>   找到缓冲区的map,取出来这个城市原来的点击 + 1 ,再复制过去
        val map: collection.Map[String, Long] = buffer.getMap[String, Long](0)
        buffer(0) = map + (cityName -> (map.getOrElse(cityName, 0L) + 1L))
      case _ =>
    }
  }
 
  // 分区间的合并
  override def merge(buffer1: MutableAggregationBuffer, buffer2: Row): Unit = {
    val map1 = buffer1.getAs[Map[String, Long]](0)
    val map2 = buffer2.getAs[Map[String, Long]](0)
 
    val total1: Long = buffer1.getLong(1)
    val total2: Long = buffer2.getLong(1)
 
    // 1. 总数的聚合
    buffer1(1) = total1 + total2
    // 2. map的聚合
    buffer1(0) = map1.foldLeft(map2) {
      case (map, (cityName, count)) =>
        map + (cityName -> (map.getOrElse(cityName, 0L) + count))
    }
 
  }
 
  // 最终的输出结果
  override def evaluate(buffer: Row): Any = {
    // "北京21.2%,天津13.2%,其他65.6%"
    val cityAndCount: collection.Map[String, Long] = buffer.getMap[String, Long](0)
    val total: Long = buffer.getLong(1)
 
    val cityCountTop2: List[(String, Long)] = cityAndCount.toList.sortBy(-_._2).take(2)
    var cityRemarks: List[CityRemark] = cityCountTop2.map {
      case (cityName, count) => CityRemark(cityName, count.toDouble / total)
    }
//    CityRemark("其他",1 - cityremarks.foldLeft(0D)(_+_.cityRatio))
    cityRemarks :+= CityRemark("其他",cityRemarks.foldLeft(1D)(_ - _.cityRatio))
    cityRemarks.mkString(",")
  }
}
 
case class CityRemark(cityName: String, cityRatio: Double) {
  val formatter = new DecimalFormat("0.00%")
 
  override def toString: String = s"$cityName:${formatter.format(cityRatio)}"
 
}



2. 主程序(具体实现)

 

 
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package com.buwenbuhuo.spark.sql.project
 
import java.util.Properties
 
import org.apache.spark.sql.SparkSession
 
/**
 **
 *
 * @author 不温卜火
 *         *
 * @create 2020-08-05 19:01
 **
 *         MyCSDN :  [url=https://buwenbuhuo.blog.csdn.net/]https://buwenbuhuo.blog.csdn.net/[/url]
 *
 */
object SqlApp {
  def main(args: Array[String]): Unit = {
    val spark: SparkSession = SparkSession
      .builder()
      .master("local")
      .appName("SqlApp")
      .enableHiveSupport()
      .getOrCreate()
    import spark.implicits._
    spark.udf.register("remark",new CityRemarkUDAF)
 
    // 去执行sql,从hive查询数据
    spark.sql("use spark0806")
    spark.sql(
      """
        |select
        |    ci.*,
        |    pi.product_name,
        |    uva.click_product_id
        |from user_visit_action uva
        |join product_info pi on uva.click_product_id=pi.product_id
        |join city_info ci on uva.city_id=ci.city_id
        |
        |""".stripMargin).createOrReplaceTempView("t1")
 
    spark.sql(
      """
        |select
        |    area,
        |    product_name,
        |    count(*) count,
        |    remark(city_name) remark
        |from t1
        |group by area, product_name
        |""".stripMargin).createOrReplaceTempView("t2")
 
    spark.sql(
      """
        |select
        |    area,
        |    product_name,
        |    count,
        |    remark,
        |    rank() over(partition by area order by count desc) rk
        |from t2
        |""".stripMargin).createOrReplaceTempView("t3")
 
    val props: Properties = new Properties()
    props.put("user","root")
    props.put("password","199712")
    spark.sql(
      """
        |select
        |    area,
        |    product_name,
        |    count,
        |    remark
        |from t3
        |where rk<=3
        |""".stripMargin)
      .coalesce(1)
      .write
      .mode("overwrite")
      .jdbc("jdbc:mysql://hadoop002:3306/rdd?useUnicode=true&characterEncoding=utf8", "spark0806", props)
 
 
    // 把结果写入到mysql中
 
    spark.close()
  }
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Spark SQL 项目:实现各区域热门商品前N统计 的相关文章

  • spark报Got an error when resolving hostNames. Falling back to /default-rack for all

    一 报错代码如下 21 06 01 20 13 36 INFO yarn SparkRackResolver Got an error when resolving hostNames Falling back to default rac
  • 基于Spark的电商用户行为实时分析可视化系统(Flask-SocketIO)

    基于Spark的电商用户行为实时分析可视化系统 Flask SocketIO 项目简介 该项目已上线蓝桥课程 有需要的可凭邀请码 UB5mdLbl 学习哦 有优惠 课程地址 https www lanqiao cn courses 2629
  • 数据质量评价体系参考

    数据质量人人有责 这不仅仅只是一句口号 更是数据工作者的生命线 数据质量的好坏直接决定着数据价值高低 数据质量管理是指在数据创建 加工 使用和迁移等过程中 通过开展数据质量定义 过程控制 监测 问题分析和整改 评估与考核等一系列管理活动 提
  • 【Spark NLP】第 7 章:分类和回归

    大家好 我是Sonhhxg 柒 希望你看完之后 能对你有所帮助 不足请指正 共同学习交流 个人主页 Sonhhxg 柒的博客 CSDN博客 欢迎各位 点赞 收藏 留言 系列专栏 机器学习 ML 自然语言处理 NLP 深度学习 DL fore
  • 使用Flink1.16.0的SQLGateway迁移Hive SQL任务

    使用Flink的SQL Gateway迁移Hive SQL任务 前言 我们有数万个离线任务 主要还是默认的DataPhin调度CDP集群的Hive On Tez这种低成本任务 当然也有PySpark 打Jar包的Spark和打Jar包的Fl
  • Flume之:二、企业开发案例

    Flume之 二 企业开发案例 文章目录 Flume之 二 企业开发案例 三 企业开发案例 1 监控端口数据官方案例 2 实时读取本地文件到HDFS案例 3 实时读取目录文件到HDFS案例 4 flume监控Kafka gt Spark知识
  • spark groupByKey和groupBy,groupByKey和reduceByKey的区别

    1 groupByKey Vs groupBy 用于对pairRDD按照key进行排序 author starxhong object Test def main args Array String Unit val sparkConf n
  • 企业网站建设方案书

    一 网站建设目标 1 1背景分析 现在网络的发展已呈现商业化 全民化 全球化的趋势 目前 几乎世界上所有的公司都在利用网络传递商业信息 进行商业活动 从宣传企业 发布广告 招聘雇员 传递商业文件乃至拓展市场 网上销售等 无所不能 如今网络已
  • 2020-10-24 大数据面试问题

    上周面试数据开发职位主要从公司的视角讲一下记录下面试流水 1 三面技术一轮hr 面到了cto 整体来看是这一周技术含量最高信息量最大的一个 1到4轮过了4个小时 技术上的问题主要问的对数据分层的理解 1 一面自我介绍 目前团队的规模多大 2
  • Databend 存储架构总览

    目的 通过本篇文章带大家理解一下 Databend 的存储结构 Databend 内置的 Table 引擎为 Fuse table engine 也是接下来要花重点篇幅要讲的 另外 Databend 还支持外置的 Hive table 及
  • Spark 任务调度机制

    1 Spark任务提交流程 Spark YARN Cluster模式下的任务提交流程 如下图所示 图YARN Cluster任务提交流程 下面的时序图清晰地说明了一个Spark应用程序从提交到运行的完整流程 图Spark任务提交时序图 提交
  • 【硬刚大数据之学习路线篇】2021年从零到大数据专家的学习指南(全面升级版)

    欢迎关注博客主页 https blog csdn net u013411339 本文由 王知无 原创 首发于 CSDN博客 本文首发CSDN论坛 未经过官方和本人允许 严禁转载 欢迎点赞 收藏 留言 欢迎留言交流 声明 本篇博客在我之前发表
  • spark-3.1.2兼容多版本hive

    2 3 9版本Hive的支持 直接在实例化SparkSession时 启用hive支持即可 例如 val spark SparkSession builder appName Spark Hive Example config spark
  • spark hadoop环境及运行

    hadoop配置 在Ubuntu20 04里安装Hadoop详细步骤 图文 亲测成功 ubuntu20 04安装hadoop 菜鸡的学习之路的博客 CSDN博客 启动hadoop root ubuntu usr local hadoop s
  • HiveSQL原理和优化详解

    Hive SQL 编译成MapReduce过程 编译 SQL 的任务是在上节中介绍的 COMPILER 编译器组件 中完成的 Hive将SQL转化为MapReduce任务 整个编译过程分为六个阶段 词法 语法解析 Antlr 定义 SQL
  • 数据挖掘知识浅析

    一 什么是数据挖掘 数据挖掘是指从大量数据中提取或 挖掘 知识 数据挖掘是一种 黄金挖掘 从沙子堆中挖掘出黄金 找出最有价值的黄金 这种有机的价值物提取的过程称为 黄金挖掘 通过某种手段或者经验丰富人士 从海量的数据中找出有用的 数据 掌握
  • 数仓面试总结

    2021年5月开始找工作 面试了若干个数仓的岗位 面的差不多也就2个 总结下大致的面试内容 一 字节视频面 上海的一个部门 视频面挂 小伙伴内推的 这个5月份面的 大概视频面试了一个小时 主要面试内容 1 问了mapreduce的具体执行过
  • 数据仓库与数据挖掘复习资料

    一 题型与考点 第一种 1 解释基本概念 中英互译 解释简单的含义 2 简答题 每个10分有两个一定要记住 考时间序列Time series 第六章 的基本概念含义 解释 作用 序列模式挖掘的作用 考聚类 第五章 重点考密度聚类的定义描述
  • Hive操作命令上手手册

    内容来自于 大数据Hive离线计算开发实战 Hive原理 Hive是一个基于Hadoop的数据仓库和分析系统 用于管理和查询大型数据集 以下是Hive的原理 数据仓库 Hive将结构化的数据文件映射成一张表 并提供类SQL查询功能 用户可以
  • Spark 中 BroadCast 导致的内存溢出(SparkFatalException)

    背景 本文基于 Spark 3 1 1 open jdk 1 8 0 352 目前在排查 Spark 任务的时候 遇到了一个很奇怪的问题 在此记录一下 现象描述 一个 Spark Application Driver端的内存为 5GB 一直

随机推荐

  • shell命令之cp复制拷贝

    1 复制文件到文件中 cp file1 file2 file1 file2 表示某一文件 在当前目录下 将file1 的文件内容复制到file2 文件中 如果第二个文件不存在 则先创建文件 然后再拷贝内容 如果存在则直接覆盖 没有警告 加
  • C++ 函数指针

    include
  • 基于SSM+JSP的宠物医院信息管理系统

    项目背景 21世纪的今天 随着社会的不断发展与进步 人们对于信息科学化的认识 已由低层次向高层次发展 由原来的感性认识向理性认识提高 管理工作的重要性已逐渐被人们所认识 科学化的管理 使信息存储达到准确 快速 完善 并能提高工作管理效率 促
  • bp利率最新消息是多少,bps利率是什么意思

    武汉房贷利率最新消息2022 3月26日起 武汉房贷利率将下调48BP 首套房贷款利率为5 2 二套房为5 4 其实武汉下调房贷利率也是在意料之内 此前的利率放在全国范围内比较 其实是比较高的 那利率降低后 每月能省多少钱呢 武汉房贷利率最
  • SSM框架和Spring Boot+Mybatis框架的性能比较?

    SSM框架和Spring Boot Mybatis框架的性能比较 没有一个绝对的答案 因为它们的性能受到很多因素的影响 例如项目的规模 复杂度 需求 技术栈 团队水平 测试环境 测试方法等 因此 我们不能简单地说哪个框架的性能更好 而是需要
  • qt 使用uic.exe 生成ui_xxxx.h文件的方法

    自己遇到这个问题 看了下别人的回答 总是有些不太清楚 就自己完善了下 1 制作好自己的xxxx ui文件 2 确定uic exe文件的地址 比如我的就是 D Anaconda3 pkgs qt 5 9 7 vc14h73c81de 0 Li
  • 雪糕的最大数量 排序+贪心

    雪糕的最大数量 雪糕的最大数量 题目描述 样例 数据范围 思路 代码 题目描述 夏日炎炎 小男孩 Tony 想买一些雪糕消消暑 商店中新到 n 支雪糕 用长度为 n 的数组 costs 表示雪糕的定价 其中 costs i 表示第 i 支雪
  • 于仕琪老师libfacedetection最新开源代码使用测试配置

    一 首先要感谢于老师的分享 二 此教程只是方便像我这样编程小白入门使用 若有不足之处 请原谅 网上对libfacedetection的介绍已经很多了 我在这里就不进行多余的解释 直接进入主题 下载地址 https github com Sh
  • Fsm2 Fsm2

    This is a Moore state machine with two states two inputs and one output Implement this state machine This exercise is th
  • 时序预测

    时序预测 MATLAB实现DBN深度置信网络时间序列预测 目录 时序预测 MATLAB实现DBN深度置信网络时间序列预测 预测效果 基本介绍 模型描述 程序设计 参考资料 预测效果 基本介绍 BP神经网络是1968年由Rumelhart和M
  • QMainwindow中添加的其他组件无法发送消息调用槽函数

    QMainwindow中添加的其他组件无法发送消息调用槽函数 问题所在 解决办法 问题所在 include mainwindow h include ui mainwindow h include QDebug include QMessa
  • [超实用]Java返回结果的工具类

    在做项目中 处理完各种业务数据后都需要返回值告诉前端最后的操作结果 但又不能直接返回一串错误代码信息 这个时候结果处理工具类就起了有比较好的作用 在此记录下 比较简单返回结果处理方法供大家参考学习 1 结果返回处理业务类 package r
  • python123.io---双一流高校及所在省份统计

    双一流高校及所在省份统计 类型 Python 组合数据类型 字典 d 中存储了我国 42 所双一流高校及所在省份的对应关系 请以这个列表为数据变量 完善 Python 代码 统计各省份学校的数量 d 北京大学
  • vue安装Base64转码

    第一步 项目文件路径下运行 npm install save js base64 或者 cnpm install save js base64 第二步 main js文件中引入 const Base64 require js base64
  • vue——vue-video-player插件实现rtmp直播流

    更新 flash已不可再使用 大家另寻出路吧 安装前首先需要注意几个点 vue video player插件 其实就是 video js 集成到 vue 中 所以千万不要再安装 video js 可能会出错 视频流我这个项目选择rtmp格式
  • 3559摄像头

    input aoni Webcam as devices platform soc 12310000 xhci 1 usb1 1 1 1 1 1 0 input input0 yuv转 的代码 https github com 198708
  • DC/DC闭环控制的丘克(Cuk)变换电路原理设计及实验仿真

    如果将降压 Buck 变换电路和升压 Boost 变换电路的拓扑结构进行对偶变换 即Boost变换电路和Buck变换电路串联在一起得到一种新的电路拓扑结构 丘克 CUK 变换电路 如图所示 Cuk变换电路的输入和输出均有电感 增加电感的值
  • matlab画圆并生成随机数

    A区域生成随机数 画圆 t 0 pi 100 2 pi x 10 cos t 30 3 y 10 sin t 89 8 plot x y r 生成随机数 a zeros 2 8 i 1 while i lt 8 temp1 rand 1 2
  • node中间件是什么意思?

    node中间件是什么意思 2020 09 11 16 11 17分类 常见问题 Node js答疑阅读 1757 评论 0 中间件是一种独立的系统软件或服务程序 分布式应用软件借助这种软件在不同的技术之间共享资源 中间件位于客户机 服务器的
  • Spark SQL 项目:实现各区域热门商品前N统计

    一 需求1 1 需求简介这里的热门商品是从点击量的维度来看的 计算各个区域前三大热门商品 并备注上每个商品在主要城市中的分布比例 超过两个城市用其他显示 1 2 思路分析使用 sql 来完成 碰到复杂的需求 可以使用 udf 或 udaf查