Spark:The Definitive Guide--读书小结(五)

前言

大概花了一个月(2020-09~2020-10)左右的时间,看完了整本书。笔者毕业后,主要从事机器学习、数据挖掘方向的相关工作。由于Spark作为目前主流的分布式计算引擎,个人也一直在用Spark进行相关的数据分析与建模工作。通读全书,感觉比较适合入门级学习,主要介绍了Spark 2.0相关API及Spark生态。涵盖Spark SQL、Struct Streaming、GraphX、MLlib等内容。对初学者而言是一本不错的书籍。

数据、源码链接: https://github.com/databricks/Spark-The-Definitive-Guide

第Ⅰ部分 大数据与Spark概述

链接: https://blog.youkuaiyun.com/Java_Man_China/article/details/109321946

第Ⅱ部分 结构化API–DataFrame、SQL和Dataset

链接: https://blog.youkuaiyun.com/Java_Man_China/article/details/109321946

第Ⅲ部分 低级API

链接: https://blog.youkuaiyun.com/Java_Man_China/article/details/109378254

第Ⅳ部分 生产与应用

链接: https://blog.youkuaiyun.com/Java_Man_China/article/details/109400672

第Ⅴ部分 流处理

waterMark 之 update模式
延迟的数据在一定的时间阈值范围内任然可被处理,一旦超过waterMark,该记录将不再被处理。streaming的输出模式主要有update、append、complete,waterMark对complete模式下的输出没有任何影响。因此下面结合update和append两种模式来阐述waterMark:(图片来自Spark官网)
在这里插入图片描述
update模式,在trigger发生时,会将当前的数据进行统计,并输出到result table,等到下一次trigger时,若发生之前存在延迟数据且在指定阈值范围内(waterMark),则将更新后的数据输出(此时只输出发生变化了的统计数据),同时根据水印的值,endTime小于水印的窗口(某窗口:startTime - endTime)所包含的记录将彻底的从内存中删除,这将保证内存永远够用。

update模式下采用socket得到的案例:
第一次水印:in(0) --> out(10:53)
第二次水印:in(10:53) —>out(10:58)
第三次水印:in(10:58) —>out(10:58) [水印不可能倒退]
在这里插入图片描述
第三次输入后,过期窗口的数据才从内存中删除。因为此时in(10:58) >第一次输入结果中的红色框(区间为前闭后开)
在这里插入图片描述

waterMark 之 append模式
在这里插入图片描述
Append模式下,若指定了水位(waterMark),则在trigger发生时,不会立即将结果输出到result table,会考虑当前的(waterMark > max event time - threshold)是否成立,若成立,则计算结果并输出,若不成立,则等到下一次trigger时,再次进行比较,直到满足条件时,输出结果。(个人理解是,waterMark + append模式下只输出过期了的数据,因为这些数据永远不会再发生变化)

在这里插入图片描述

在这里插入图片描述

第Ⅵ部分 高级分析与机器学习

链接: https://editor.youkuaiyun.com/md/?articleId=109321946//未写待续

第Ⅶ部分 生态系统

链接: https://editor.youkuaiyun.com/md/?articleId=109321946//未写待续

Welcome to this first edition of Spark: The Definitive Guide! We are excited to bring you the most complete resource on Apache Spark today, focusing especially on the new generation of Spark APIs introduced in Spark 2.0. Apache Spark is currently one of the most popular systems for large-scale data processing, with APIs in multiple programming languages and a wealth of built-in and third-party libraries. Although the project has existed for multiple years—first as a research project started at UC Berkeley in 2009, then at the Apache Software Foundation since 2013—the open source community is continuing to build more powerful APIs and high-level libraries over Spark, so there is still a lot to write about the project. We decided to write this book for two reasons. First, we wanted to present the most comprehensive book on Apache Spark, covering all of the fundamental use cases with easy-to-run examples. Second, we especially wanted to explore the higher-level “structured” APIs that were finalized in Apache Spark 2.0—namely DataFrames, Datasets, Spark SQL, and Structured Streaming—which older books on Spark don’t always include. We hope this book gives you a solid foundation to write modern Apache Spark applications using all the available tools in the project. In this preface, we’ll tell you a little bit about our background, and explain who this book is for and how we have organized the material. We also want to thank the numerous people who helped edit and review this book, without whom it would not have been possible.
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值