天天看點

寒假學習進度4

今天開始學習spark3大資料結構中的RDD

什麼是RDD:

RDD(Resilient Distributed Dataset)叫做彈性分布式資料集,是 Spark 中最基本的資料

處理模型。代碼中是一個抽象類,它代表一個彈性的、不可變、可分區、裡面的元素可并行

計算的集合。

RDD有5大核心屬性:

*-A list of partitions(分區清單用于執行任務時并行計算)

*一 A function for computing each split*(分區計算函數,每個分區的資料計算)

-A list of dependencies on other RDDs(RDD 之間的依賴關系)

*- 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)(首選位置,可以根據計算節點的狀态選擇不同的節點位置進行計算)

RDD的建立:

(1)從集合(記憶體)中建立 RDD

(2)從外部存儲(檔案)建立 RDD

RDD 并行度與分區:(資料分區後的資料配置設定問題篇幅過于長,詳情見尚矽谷spark教程p35-p39)