定时的进行一个时间段内的数据处理
Spark Streaming also provides windowed computations, which allow you to apply transformations over a sliding window of data. The following figure illustrates this sliding window.

As shown in the figure, every time the window slides over a source DStream, the source RDDs that fall within the window are combined and operated upon to produce the RDDs of the windowed DStream. In this specific case, the operation is applied over the last 3 time units of data, and slides by 2 time units. This shows that any window operation needs to specify two parameters.

window length[窗口的长度] - The duration of the window (3 in the figure).
sliding interval[窗口的间隔] - The interval at which the window operation is performed (2 in the figure).
These two parameters must be multiples of the batch interval of the source DStream (1 in the figure).
这2个参数和我们的batch size有关系:倍数
每隔多久计算某个范围内的数据:每隔10秒(sliding interval)计算前10分钟(window length)的WC

// Reduce last 30 seconds of data, every 10 seconds
val windowedWordCounts = pairs.reduceByKeyAndWindow((a:Int,b:Int) => (a + b), Seconds(30), Seconds(10))

Window Operations(窗口函数的使用)相关推荐

  1. 【Clickhouse】Clickhouse 分析函数 window functions 窗口函数

    文章目录 1.概述 1.1.窗口函数: 1.2.标准SQL语法 1.3.分析函数分类: 2.Top N: 3.案例 1.概述 转载:Clickhouse 分析函数 window functions 窗 ...

  2. Spark Streaming之Window Operations操作和解析

    Spark Streaming之Window Operations 官网:http://spark.apache.org/docs/latest/streaming-programming-guide ...

  3. MariaDB Window Functions窗口函数分组取TOP N记录

    窗口函数在MariaDB10.2版本里实现,其简化了复杂SQL的撰写,提高了可读性. 在某些方面,窗口函数类似于聚集函数, 但它不像聚集函数那样每组只返回一个值,窗口函数可以为每组返回多个值. 作为一 ...

  4. spark sql中的窗口函数

    2019独角兽企业重金招聘Python工程师标准>>> databricks博客给出的窗口函数概述 Spark SQL supports three kinds of window ...

  5. mysql over rank_SQL学习笔记 - 窗口函数OVER

    Window Function 窗口函数 Perform calculations on an already generated result set ( a window).(在已生成的结果集上执 ...

  6. postgresql Window Functions

    Window Functions 窗口函数不会像非窗口聚合调用那样使行分组到单个输出行中.相反,这些行保留了它们单独的身份.不可以和GROUP BY. WHERE子句一起用.如果在执行窗口计算后需要过 ...

  7. Spark Streaming中的操作函数分析

    参考文章:http://blog.csdn.net/dabokele/article/details/52602412 根据Spark官方文档中的描述,在Spark Streaming应用中,一个DS ...

  8. 计算机常用英语单词对照

    第一部分.计算机算法常用术语中英对照 Data Structures 基本数据结构 Dictionaries 字典 Priority Queues 堆 Graph Data Structures 图 ...

  9. 计算机算法常用术语中英对照

    1 第一部分.计算机算法常用术语中英对照2 Data Structures 基本数据结构3 Dictionaries 字典4 Priority Queues 堆5 Graph Data Structu ...

最新文章

  1. 6位有符号补码阵列乘法器_C/C++学习日记:原码、反码和补码
  2. L2TPV3---以太网端口到端口手动配置
  3. python爬百度翻译-python爬取百度翻译的问题以及解决方案
  4. centos7自带python版本_CentOS7保留默认Python版本并安装更新Python2和Python3共存
  5. 二值图像的距离变换研究
  6. WIN10+Ubuntu16.4 双系统,遇到的坑
  7. Kubernetes CKA认证运维工程师笔记-Kubernetes存储
  8. 在linux上下载图片,在Linux上使用4k Stogram下载Instagram图片库 | MOS86
  9. 逃离北上广:你以为回到小城市就非常幸福了吗?
  10. Utility工具类:
  11. 2021-2027全球与中国5G独立组网非独立组网基础设施市场现状及未来发展趋势
  12. java解析word示例(支持docx、doc,wps格式)
  13. android 开机动画实现,Android App启动画面实现
  14. yapi 全局变量使用_需要接口管理的你了解一下?
  15. 生产者消费者问题——管程法
  16. Android P2P 通信方案探索
  17. [Unity2D入门教程]简单制作仿植物大战僵尸游戏之①搭建场景
  18. SpringMVC数据接收及传递
  19. Adobe XD|不论是安卓还是苹果用户都可在手机上预览Adobe XD预览稿
  20. 王道数据结构代码——线性表

热门文章

  1. Java与正则表达式
  2. MySQL 在高并发下的 订单撮合 系统使用 共享锁 与 排他锁 保证数据一致性
  3. 命令行下 mysql 不是内部或外部命令排查方法
  4. hibernate 多对一外键注解
  5. input file上传图片预览
  6. 极路由 1S 使用经验
  7. [转]Dynamic and static Rectangle in WPF
  8. 通过批处理文件启动Oracle服务
  9. mysql存储过程表迁移for_MySQL存储过程--通过游标遍历和异常处理迁移数据到历史表 (转)...
  10. OJ1025: 最大字符