Stateless vs Stateful

Concepts covered: paMicroBatchVsTrue

Every streaming query answers one question before any other: does producing correct output require remembering anything from previous batches? If no, the query is stateless. A filter, a select, a per-row transform, a parse: each row arrives, is processed on the spot, and is forgotten. Batch N needs nothing from batch N minus one. If yes, the query is stateful: a running count per region must carry the counts so far; a deduplication must remember which keys it has seen; a windowed aggregate holds partial sums for windows still open. That carried information is called state, and its existence changes the operational character of the stream more than any other property. Where does state physically live? In a component called the state store: per-partition storage on the executors, keyed by th

About This Interactive Section

This section is part of the Structured Streaming: Intermediate lesson on DataDriven, a free data engineering interview prep platform. Each section includes explanations, worked examples, and hands-on code challenges that execute in real time. SQL queries run against a live database. Python runs in a sandboxed Docker container. Data modeling problems validate against interactive schema canvases. All content is framed around what data engineering interviewers actually test at companies like Meta, Google, Amazon, Netflix, Stripe, and Databricks.

How DataDriven Lessons Work

DataDriven combines four interview rounds (SQL, Python, Data Modeling, Pipeline Architecture) with adaptive difficulty and spaced repetition. Easy problems get harder as you improve. Weak concepts resurface until you master them. Your readiness score tracks progress across every topic interviewers test. Every lesson section ends with problems you solve by writing and running real code, not by picking multiple-choice answers.