Free cheat sheet
Databricks Spark Developer Associate
Two pages of the defaults, PySpark syntax, decision rules and traps the Databricks Certified Associate Developer for Apache Spark exam tests, for Spark 3.5, organised by the October 2025 exam guide's seven domains.
Aligned to the October 2025 exam guide · checked against the Databricks docs on 27 October 2026 · certlake.com/exam/spark-developer-associate/cheat-sheet
Exam at a glance
The exam
45 scored questions · 90 min · Python (PySpark) · no docs allowed · October 2025 guide. Written for Spark 3.5; 4.x marks a change in Spark 4.0.
Weights
DataFrame API 30 · Architecture 20 · Spark SQL 20 · Troubleshooting 10 · Streaming 10 · Spark Connect 5 · pandas API 5 (%).
Spark 4.0 changes
ANSI mode on by default (bad cast errors, not NULL; overflow errors, not wraps; use try_) · Mesos removed · pandas-on-Spark ops_ on, errors under ANSI · to_ removed.
1. Apache Spark Architecture and Components20% of the exam
Components
| Part | Does |
|---|---|
| Driver | Spark, plans, schedules tasks, gets results |
| Cluster manager | Allocates resources: standalone, YARN, Kubernetes |
| Executor | JVM per app on a worker: runs tasks, caches data |
| Core | One task at a time: 4 executors × 4 cores = 16 tasks |
Application → job per action → stages split at shuffles → task per partition per stage. A 1-partition DataFrame = 1 task.
Narrow vs wide
Narrow (same stage): select, filter, with, union. Wide (usually a shuffle, new stage): group, join, distinct, order, repartition. Transformations are lazy; actions run: count, collect, show, take, first, write, foreach.
Partitions
Shuffle partitions 200 · file read split 128 MB · task fails 4× → job fails. repartition(: full shuffle, up or down · coalesce(: no full shuffle, down only.
Caching
DataFrame cache( = persist( = MEMORY_ (3.5); RDD. = MEMORY_ (doesn't fit → recomputed). Lazy until an action. LRU eviction. GC cost grows with object count (Executors tab). Datasets: Scala/Java only.
2. Using Spark SQL20% of the exam
Save modes
| Mode | Existing data |
|---|---|
errorifexists (default) | Error |
append | Add files |
overwrite | Delete, then write |
ignore | Skip, no error |
Not atomic. partition + overwrite is static by default: all old partitions deleted. Option partition = dynamic replaces only written ones.
Sources
- Default format Parquet.
spark.thenread. format( "csv") .,option( "header", True) ..load( p) - SQL on files:
SELECT * FROM parquet.(also`/ path` orc,json,csv,text,delta). CSV this way: header read as data, columns_,c0 _as strings.c1 - JDBC:
partition+Column lower+Bound upper+Bound numread in parallel. Bounds set the stride only: no rows filtered.Partitions
Tables and views
| partitionBy | bucketBy (+ sortBy) | |
|---|---|---|
| Layout | Folder per value | N hash buckets |
| Suits | Low cardinality | High-cardinality join keys |
| With | save, save | save only |
Managed (no path): DROP deletes data. External (path/LOCATION): DROP keeps data. Temp view: one session. Global temp view: global_, whole application.
SQL to read
WHERE before grouping, HAVING after. Nulls first in ASC, last in DESC. COUNT( skips nulls. INSERT OVERWRITE replaces.
3. Developing DataFrame/DataSet API Applications30% of the exam
Columns and rows
with, with, drop, select(, to. F.. filter = where; combine with & | ~ and parentheses. F.. explode drops null/empty arrays; explode_ keeps them.
Inspect and collect
| Call | Gives |
|---|---|
collect( | All rows on the driver: OOM risk |
take(, head( | List of n rows |
limit( | A DataFrame (lazy) |
show( | Prints 20 rows, 20 chars |
to | Everything to the driver |
Row., print, order.
Clean and aggregate
na.any null ·drop( ) how="all"all null ·subset=[.·. . ] thresh=n(overrideshow) ·na..fill( {. . . }) dropkeeps one row per id.Duplicates( ["id"]) group.By( ). agg( F. sum, F. avg, F. count Distinct) approx_= HyperLogLog,count_ distinct rsd0.05.describe(;) summary(adds 25/50/75%.)
Dates
from_ → yyyy-MM-dd HH:mm:ss string (session time zone) · unix_ reverse · to_, date_ · year, month, dayofweek (1 = Sunday). MM month, mm minute.
Joins and unions
how: inner (default), left, right, full, left_, left_, cross. Keys as a list → one key column; as an expression → both. F. copies it to every executor. union = union: by position, keeps duplicates. union.
UDFs and shared variables
F.with no type returns StringType. Python UDFs are opaque to the optimizer: prefer built-ins, then pandas UDFs.udf( f) spark.for SQL.udf. register - Stateless UDF: per row. Running state across a stream:
apply(experimental; state store).In Pandas With State - Broadcast variable: read-only, cached per executor. Accumulator: tasks add, driver reads; exact only in actions, may double-count in transformations. Both need
Spark.Context
Windows
Window. · row_ 1,2,3 · rank gaps · dense_ none · lag/lead. With order, default frame = RANGE unbounded preceding → current row: ties get the same running total.
4. Troubleshooting and Tuning10% of the exam
AQE (on by default since 3.2)
Re-plans at shuffle boundaries: coalesces small partitions, switches sort-merge to broadcast join, splits skewed partitions (> 5× median and > 256 MB). Advisory partition size 64 MB.
Joins and skew
- Auto broadcast under 10 MB (
autounderBroadcast Join Threshold spark.);sql. -1disables. Hint requests it (not guaranteed); priority BROADCAST > MERGE > SHUFFLE_HASH. - Skew: one task ≫ median in the Stages tab. Fix: AQE skew join, broadcast, salt the key.
Plans and UI
explain( = physical only; explain( = all plans; modes simple, extended, codegen, cost, formatted. Exchange = shuffle. UI on port 4040; history server needs spark.. Executors tab: GC time, stderr/stdout logs (also per task on a stage's page).
5. Structured Streaming10% of the exam
Model
Unbounded table, micro-batches by default, incremental results. Exactly-once = replayable source + checkpoint (WAL) + idempotent sink. File source needs a schema. Socket and rate: testing only.
Output modes and sinks
| Mode | Writes | For |
|---|---|---|
append (default) | New rows once | No aggregation, or aggregation with watermark |
update | Changed rows | Aggregations, plain queries |
complete | Whole table | Aggregations only |
File sink: append, exactly-once. Kafka, foreach: at-least-once. foreach: any target, your idempotency.
Triggers
Default: next batch when the last ends · processing · available: all data, then stop · once: deprecated · continuous: experimental, at-least-once.
Windows and dedup
window( tumbling; add "5 minutes" slide → sliding. Watermark = max event time − delay; state behind it dropped. drop without watermark: state grows forever; with watermark include the event-time column; drop (3.5+) when retries change the time. No count(/show( on a stream.
6. Using Spark Connect to deploy applications5% of the exam
Spark Connect (3.4+)
Thin client sends unresolved logical plans (protobuf) over gRPC; results return as Arrow. builder., SPARK_. No Spark or RDDs (so no accumulators, sc.). Benefits: client isolation, independent upgrades, local IDE debugging.
Deploy modes
| Mode | Driver runs |
|---|---|
local[*] | One JVM, one machine |
| Client (default) | Submitting machine |
| Cluster | A worker in the cluster |
7. Using Pandas API on Apache Spark5% of the exam
Pandas API on Spark
import pyspark. · sdf. · psdf. · to_ collects to the driver. pandas syntax, distributed, for data bigger than one machine. Default index distributed-sequence; row order not guaranteed.
Pandas UDFs
@F. + type hints pd.. Arrow batches (10,000 rows), vectorized: much faster than row-at-a-time UDFs. Series → scalar = aggregate.
Know it, or just recognise it?
The free diagnostic shows which domains you'd lose marks on, in about 10 minutes and without signing up.
Take the free diagnosticStudy guide
The full study guide: every domain explained, with snippets and diagrams.
Open the study guideSpotted something out of date? Email support@certlake.com. CertLake is not affiliated with Databricks, Inc.