Built with Tutify.io

    AIStudyLabs

    RDD - Introduction

    RDD - Introduction

    Introduction

    RDD is a fundamental data structure of PySpark and it is the primary data abstraction in Apache PySpark and the PySpark 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 lists in Python, with the difference being RDD is computed on several processes scattered across multiple physical servers also called nodes in a cluster while a Python collection lives and processes in just one system.

    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 PySpark 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

    PySpark 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 PySpark to reconstruct lost data easily.

    How Lineage Ensures Resilience

    When a node failure occurs, PySpark 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:

    Introduction to PySpark for Data Engineering — Resilient Distributed Datasets (RDDs)

    Introduction to PySpark

    Setup PySpark 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

    PySpark SQL Functions

    Advanced DataFrame Features

    PySpark SQL

    Spark Read & Write CSV Files

    Working with JSON Files

    Working with Parquet Files

    What Next?

    Tutorial Not Found