spark中产生shuffle的算子
Spark中产生shuffle的算子
|
作用 |
算子名 |
能否替换,由谁替换 |
|
去重 |
distinct() |
不能 |
|
聚合 |
reduceByKey() |
groupByKey |
|
groupBy() |
||
|
groupByKey() |
reduceByKey |
|
|
aggregateByKey() |
||
|
combineByKey() |
||
|
排序 |
sortByKey() |
|
|
sortBy() |
||
|
重分区 |
coalesce() |
|
|
repartition() |
||
|
集合或者表操作 |
Intersection() |
|
|
Substract() |
||
|
SubstractByKey() |
||
|
Join() |
||
|
LeftOutJoin() |
https://www.cnblogs.com/Alex-zqzy/p/9949117.html
去重
def distinct() def distinct(numPartitions: Int)
聚合
def reduceByKey(func: (V, V) => V, numPartitions: Int): RDD[(K, V)] def reduceByKey(partitioner: Partitioner, func: (V, V) => V): RDD[(K, V)] def groupBy[K](f: T => K, p: Partitioner):RDD[(K, Iterable[V])] def groupByKey(partitioner: Partitioner):RDD[(K, Iterable[V])] def aggregateByKey[U: ClassTag](zeroValue: U, partitioner: Partitioner): RDD[(K, U)] def aggregateByKey[U: ClassTag](zeroValue: U, numPartitions: Int): RDD[(K, U)] def combineByKey[C](createCombiner: V => C, mergeValue: (C, V) => C, mergeCombiners: (C, C) => C): RDD[(K, C)] def combineByKey[C](createCombiner: V => C, mergeValue: (C, V) => C, mergeCombiners: (C, C) => C, numPartitions: Int): RDD[(K, C)] def combineByKey[C](createCombiner: V => C, mergeValue: (C, V) => C, mergeCombiners: (C, C) => C, partitioner: Partitioner, mapSideCombine: Boolean = true, serializer: Serializer = null): RDD[(K, C)]
排序
def sortByKey(ascending: Boolean = true, numPartitions: Int = self.partitions.length): RDD[(K, V)] def sortBy[K](f: (T) => K, ascending: Boolean = true, numPartitions: Int = this.partitions.length)(implicit ord: Ordering[K], ctag: ClassTag[K]): RDD[T]
重分区
def coalesce(numPartitions: Int, shuffle: Boolean = false, partitionCoalescer: Option[PartitionCoalescer] = Option.empty) def repartition(numPartitions: Int)(implicit ord: Ordering[T] = null)
集合或者表操作
def intersection(other: RDD[T]): RDD[T] def intersection(other: RDD[T], partitioner: Partitioner)(implicit ord: Ordering[T] = null): RDD[T] def intersection(other: RDD[T], numPartitions: Int): RDD[T] def subtract(other: RDD[T], numPartitions: Int): RDD[T] def subtract(other: RDD[T], p: Partitioner)(implicit ord: Ordering[T] = null): RDD[T] def subtractByKey[W: ClassTag](other: RDD[(K, W)]): RDD[(K, V)] def subtractByKey[W: ClassTag](other: RDD[(K, W)], numPartitions: Int): RDD[(K, V)] def subtractByKey[W: ClassTag](other: RDD[(K, W)], p: Partitioner): RDD[(K, V)] def join[W](other: RDD[(K, W)], partitioner: Partitioner): RDD[(K, (V, W))] def join[W](other: RDD[(K, W)]): RDD[(K, (V, W))] def join[W](other: RDD[(K, W)], numPartitions: Int): RDD[(K, (V, W))] def leftOuterJoin[W](other: RDD[(K, W)]): RDD[(K, (V, Option[W]))]
spark中产生shuffle的算子的更多相关文章
- Spark中的各种action算子操作(java版)
在我看来,Spark编程中的action算子的作用就像一个触发器,用来触发之前的transformation算子.transformation操作具有懒加载的特性,你定义完操作之后并不会立即加载,只有 ...
- Spark会产生shuffle的算子
去重 def distinct() def distinct(numPartitions: Int) 聚合 def reduceByKey(func: (V, V) => V, numParti ...
- spark中map和mapPartitions算子的区别
区别: 1.map是对rdd中每一个元素进行操作 2.mapPartitions是对rdd中每个partition的迭代器进行操作 mapPartitions优点: 1.若是普通map,比如一个par ...
- [Spark性能调优] 第三章 : Spark 2.1.0 中 Sort-Based Shuffle 产生的内幕
本課主題 Sorted-Based Shuffle 的诞生和介绍 Shuffle 中六大令人费解的问题 Sorted-Based Shuffle 的排序和源码鉴赏 Shuffle 在运行时的内存管理 ...
- Spark 2.x 中 Sort-Based Shuffle 产生的内幕
本课主题 Sorted-Based Shuffle 的诞生和介绍 Shuffle 中六大令人费解的问题 Sorted-Based Shuffle 的排序和源码鉴赏 Shuffle 在运行时的内存管理 ...
- Spark中shuffle的触发和调度
Spark中的shuffle是在干嘛? Shuffle在Spark中即是把父RDD中的KV对按照Key重新分区,从而得到一个新的RDD.也就是说原本同属于父RDD同一个分区的数据需要进入到子RDD的不 ...
- spark性能调优(二) 彻底解密spark的Hash Shuffle
装载:http://www.cnblogs.com/jcchoiling/p/6431969.html 引言 Spark HashShuffle 是它以前的版本,现在1.6x 版本默应是 Sort-B ...
- spark中数据倾斜解决方案
数据倾斜导致的致命后果: 1 数据倾斜直接会导致一种情况:OOM. 2 运行速度慢,特别慢,非常慢,极端的慢,不可接受的慢. 搞定数据倾斜需要: 1.搞定shuffle 2.搞定业务场景 3 搞定 c ...
- spark教程(13)-shuffle介绍
shuffle 简介 shuffle 描述了数据从 map task 输出到 reduce task 输入的过程,shuffle 是连接 map 和 reduce 的桥梁: shuffle 性能的高低 ...
随机推荐
- Java使用Jacob转换Word为HTML
从今天开始,我也要养成记录开发中遇到的问题和解决方法的好习惯! 最近开发一个Android项目,需要用到查看Word和Pdf文档的功能,由于Android没有直接显示Word和PDF文档的组件,只有一 ...
- Keil BUG 导致读字库时,无法显示某些汉字解决办法
原因在于:KEIL C51 的一个汉字BUG,keil c51在编译的时候会将0xfd的字符(有些汉字含该字符的内码)过滤, 最佳解决方案:打补丁,用 晓奇工作室出的补丁 cckeilvxx.exe ...
- CF-796B
B. Find The Bone time limit per test 2 seconds memory limit per test 256 megabytes input standard in ...
- 总结open与fopen的区别
https://www.zybuluo.com/yiltoncent/note/87461 参考链接1 参考链接2 对于这两个名字很类似的函数,对于很多初学者来说,不容易搞清楚它们有什么不同,只知道按 ...
- monkey之monkeyServer
基本命令: adb shell monkey --port 1080 & adb forward tcp:1080 tcp:1080 telnet 127.0.0.1 1080 启动andro ...
- [Swift 开发] 使用闭包传值(typealias)
在Swift中使用闭包来实现两个界面的传值 例如:有A类和B类. B类 //声明闭包 typealias valueBlock = (Float)->() var returnPrice: va ...
- dumpe2fs: Bad magic number in super-block
今天使用tune2fs和dumpe2fs来查看文件系统信息,出现如下图所示错误提示: 解决方法: 1.原来tune2fs和dumpe2fs只能打开ext3/ext4等文件类型. dumpe2fs - ...
- Java EE规范下载
- log4j2中LevelRangeFilter的注意点
LevelRangeFilter的注意点 在log4j2中,LevelRangeFilter的minLevel,maxLevel的配置是和log4j 1.x相反的:minLevel需要配置的是高级别, ...
- 通过java调用Http接口上传图片到服务器
https://blog.csdn.net/jaedons/article/details/78563841 /** * 测试上传png图片 * */ public static void testU ...