0% complete

Streaming and real-time data · Lesson 1 of 3

Structured Streaming concepts

Apply familiar DataFrame transformations to continuously arriving data.

Lesson

Structured Streaming processes an unbounded input as data arrives and incrementally updates results. The same DataFrame-style operations can often be used for batch and streaming, but streaming queries have state, checkpoint, output-mode, and trigger considerations. A checkpoint stores progress and state needed for fault-tolerant recovery and should be durable and isolated for the query. Choose a trigger based on latency and cost requirements, and understand the sink's behavior on restart. Exactly-once guarantees depend on the source, processing, and sink semantics working together; do not assume every external side effect is automatically exactly once. Practice task: explain why two independent queries should not casually share checkpoint state. Applying the pattern: Define the streaming source, transformations, trigger, checkpoint, and sink together, then validate restart behavior with a controlled test. Checks and failure modes: Deleting checkpoints without a replay plan can duplicate output or lose expected state. Before production, test both a representative input and a boundary case. Confirm the expected row grain, permissions, recovery behavior, and observable output for the task. Record the configuration needed to reproduce the run and compare its result with the agreed data contract. Practice task: Why does a streaming query need durable checkpoint storage?

Visual guide

Streaming query lifecycle

  1. Step 01 Read

    Consume new source data.

  2. Step 02 Process

    Update distributed query state.

  3. Step 03 Checkpoint

    Persist offsets and recovery state.

  4. Step 04 Write

    Commit output to a supported sink.

Key points

  • Define the streaming source, transformations, trigger, checkpoint, and sink together, then validate restart behavior with a controlled test.
  • Deleting checkpoints without a replay plan can duplicate output or lose expected state.
  • Re-run the included practice scenario after changing source data or transformation logic.

Check your understanding

Practice

Why does a streaming query need durable checkpoint storage?

Your learning progress

Finish this lesson