Q14Big Data Analytics
Question
4 marks
Distinguish between transformations and actions in Spark.
Answer
Transformations build a logical execution plan lazily, while actions trigger the actual execution of the plan.
Transformations (e.g., map(), filter(), join()) create a new RDD from an existing one but do not compute the result immediately. Spark simply records the lineage. Actions (e.g., count(), collect(), saveAsTextFile()) force the computation of all preceding transformations to return a value to the driver or write data to an external storage system.