Why Rdd's are Immutable

 

🤔Is  #Rdd's are Immutable in #Spark 🔥? What happens if they are #Mutable?
.

.
.
.

Is Rdd's in Spark are Immutable?
==========================
✏️Yes, Rdd's are Immutable

✏️Once we load #Rdd with data it cannot be changed.

✍️What's the need to make #RDD Immutable?
  ==========================

let's consider #Rdd are mutable and we write code :-
--------------------------------------------------------

rdd1= load data from Hdfs
rdd1= rdd1.map("--")
rdd1=rdd1.filter("---")

✏️Here we can see that we have mutated the  #rdd1 everytime .

✏️The consequence of mutating the same  #rdd1 everytime , is if #rdd1 lost we cannot regenerate it.

✏️If we lost #rdd1 then we generally go to parent rdd and check using lineage graph but here there is no parent.

✏️#rdd1 itself is the parent , and it has lost , now we cannot recover #rdd1.

✏️So that's the reason #Rdd's are made Immutable.

✏️Immutability and Lineage graph allows to regenerate the rdd during failure.

✍️Immutable nature of Rdd's make itself Resilient .

Comments

Post a Comment

Popular Posts