1.spark核心RDD特点
2024-09-06 12:03:43
RDD(Resilient Distributed Dataset)
Spark源码:https://github.com/apache/spark
abstract class RDD[T: ClassTag](
@transient private var _sc: SparkContext,
@transient private var deps: Seq[Dependency[_]]
) extends Serializable with Logging
1.RDD是一个抽象类(不能直接使用,子类实现抽象方法后才能用)
2.带泛型的,可以支持多种类型:String、Person、User
RDD:Resilient Distributed Dataset 弹性 分布式 数据集
Represents an immutable,(不可变)
partitioned collection of elements (分区)
that can be operated on in parallel (并行计算)
Internally, each RDD is characterized by five main properties:
*
* - A list of partitions
* - A function for computing each split
* - A list of dependencies on other RDDs
rdd1=>rdd2=>rdd3
* - Optionally, a Partitioner for key-value RDDs (e.g. to say that the RDD is hash-partitioned)
* - Optionally, a list of preferred locations to compute each split on (e.g. block locations for
* an HDFS file) 数据在哪优先把作业调度到数据所在结点计算:移动数据不如移动计算
五大特性源码体现:
def compute(split: Partition, context: TaskContext): Iterator[T] 特性二
protected def getPartitions: Array[Partition] 特性一
protected def getDependencies: Seq[Dependency[_]] = deps 特性三
protected def getPreferredLocations(split: Partition): Seq[String] = Nil 特性五
val partitioner: Option[Partitioner] = None 特性四
最新文章
- GDB调试命令
- JavaScript执行环境
- [LeetCode] Max Sum of Rectangle No Larger Than K 最大矩阵和不超过K
- json_encode 中文乱码
- SQLServer2005删除log文件和清空日志的方案
- 需要一个策略文件,但在加载此媒体时未设置checkPolicyFile标志
- 22 java当中的数组
- windows下安装coreseek/sphinx
- HDU-----(4858)项目管理(模拟)
- javascript小数四舍五入
- Hunt the Wumpus第二个版本---多怪兽,多洞穴,洞穴间双向互通
- (转+原)VC编译错误:uafxcw.lib(afxmem.obj) : error LNK2005: ";void * __cdecl operator new(unsigned int)"; (??2@YAPAXI@Z) 已经在 LIBCMT.lib(new.obj) 中定义
- jquery multiselect控件
- c++自带倒置数组函数
- Luogu 3390 【模板】矩阵快速幂 (矩阵乘法,快速幂)
- webpack之深入浅出externals
- jQuery 核心函数 (十一)
- node.js代理设置
- jenkins系列之添加全局配置(一)
- left join 太神奇了