Built with Tutify.io

    AIStudyLabs

    RDD - Introduction

    RDD - Introduction

    Introduction

    RDD is a fundamental data structure of Spark and it is the primary data abstraction in Apache Spark and the Spark Core. RDDs are fault-tolerant, immutable distributed collections of objects, which means once you create an RDD you cannot change it. Each dataset in RDD is divided into logical partitions, which can be computed on different nodes of the cluster. 

    In other words, RDDs are a collection of objects similar to collections in Scala, with the difference being RDD is computed on several JVMs scattered across multiple physical servers also called nodes in a cluster while a Scala collection lives on a single JVM.  

    Additionally, RDDs provide data abstraction of partitioning and distribution of the data which is designed to run computations in parallel on several nodes, while doing transformations on RDD most of the time we don’t have to worry about parallelism as Spark by default provides it.

    <img height="339" width="547" src="https://yrltjyzsmzdylqvoonwf.supabase.co/storage/v1/object/public/lesson-images/100/181/rdd.png" />

    Characteristics of RDDs

    Fault Tolerance in RDDs

    Spark ensures fault tolerance through lineage tracking. If a partition is lost, RDD retains enough information (i.e., the lineage) to recompute the lost data from the original source.

    Lineage Graphs

    A lineage graph is a record of all transformations applied to RDDs. It allows Spark to reconstruct lost data easily.

    How Lineage Ensures Resilience

    When a node failure occurs, Spark leverages the lineage graph to rerun the missing or affected partitions, ensuring the job completes successfully without user intervention.

    Summary / Key Takeaways

    In this lesson on Understanding RDDs, you have learned:

    Apache Spark Tutorial with Scala Examples — Resilient Distributed Datasets (RDDs)

    Introduction to Apache Spark

    Setup Apache Spark Environment

    SparkSession & SparkContext

    Resilient Distributed Datasets (RDDs)

    Apache Spark Concepts

    Cache, Persistence and Shared Variables

    DataFrame Introduction

    DataFrame Narrow Transformation

    DataFrame Wider Transformation

    DataFrame Actions

    Spark SQL Functions

    Advanced DataFrame Features

    Using SQL Queries

    Spark Read & Write CSV Files

    Working with JSON Files

    Working with Parquet Files

    Spark Dataset

    What Next?

    Tutorial Not Found