Home / data-analytics / Databricks Certified Associate Developer for Apache Spark / Cheat Sheet
Databricks Certified Associate Developer for Apache Spark

Spark Dev Assoc Cheat Sheet

Spark Dev Assoc Tests Reading PySpark Code Precisely — Not Databricks Platform Features

Built around Apache Spark itself (DataFrame API, Spark SQL, Structured Streaming, Spark Connect) in Python. Most items show code; one argument, default or missing action usually decides the answer, so trace every line.

Check Your Readiness →
Among the harder certs
Avg: Not published by Databricks
Pass: 750 / 1000
Most candidates understand Databricks Certified Associate Developer for Apache Spark concepts — and still fail. This exam tests how you apply knowledge under pressure.

Spark Dev Assoc Domain Map (8 Oct 2026 guide)

The guide does not state a Spark version; content follows the Spark 3.5 and 4.x Python DataFrame API. Unlike the Databricks engineer exams, platform services barely appear: questions ask what code returns, which line completes it, how many stages it creates, or which component does the work.

  1. 01
    DataFrame/Dataset API Applications (30%) — column and row manipulation, joins, unions, dates, UDFs, read modes, accumulators
  2. 02
    Spark Architecture and Components (20%) — driver, executors, jobs, stages and tasks, lazy evaluation, caching, partitions
  3. 03
    Using Spark SQL (20%) — save modes, JDBC parallel reads, partitionBy and bucketBy, SQL on files, temp views
  4. 04
    Troubleshooting and Tuning (10%) — skew, salting, AQE, spill, driver vs executor OOM, logs
  5. 05
    Structured Streaming (10%) — output modes, checkpoints, windows, watermarks, triggers, foreachBatch
  6. 06
    Spark Connect (5%) — sc:// remote sessions, no RDDs, client vs cluster vs local deploy modes
  7. 07
    Pandas API on Spark (5%) — pyspark.pandas conversions and pandas_udf type-hint forms

Wrong instinct vs correct approach

A streaming query runs a windowed count in append mode with no withWatermark call
✕ Wrong instinct

Leave it; append mode emits windows as data arrives

✓ Correct approach

Append mode with an aggregation needs a watermark, declared on the event-time column before groupBy, so Spark knows when a window is final and can drop old state. Without it Spark rejects the query.

A job fails during collect() on a large DataFrame and the error appears in the driver log
✕ Wrong instinct

Increase spark.executor.memory and rerun the job unchanged

✓ Correct approach

collect brings every row to the driver, so the driver ran out of memory. Keep work distributed, write results out or take a sample; spark.driver.maxResultSize caps returned data. Executor OOM instead points to large or skewed partitions.

Code calls spark.sparkContext.parallelize on a session built with SparkSession.builder.remote('sc://host:15002')
✕ Wrong instinct

Expect it to work exactly like a classic session

✓ Correct approach

Spark Connect sends unresolved logical plans over gRPC and supports only DataFrame and SQL APIs. SparkContext, RDDs, broadcast variables and accumulators need a classic session; the server, not the client, analyses and executes plans.

A pandas UDF must return the mean of a column for each group
✕ Wrong instinct

Declare it with pd.Series -> pd.Series type hints

✓ Correct approach

Series-to-Series UDFs must return output the same length as their input. A per-group aggregate needs Series-to-scalar hints used with groupBy().agg(), and the return type must still be given in the pandas_udf decorator.

Know these cold

  • ▸ Transformations are lazy; only actions like count, collect and write launch jobs
  • ▸ cache() and persist() store nothing until an action computes the partitions
  • ▸ MEMORY_ONLY recomputes evicted partitions; MEMORY_AND_DISK spills them to disk
  • ▸ spark.sql.shuffle.partitions is 200 by default; AQE coalesces small post-shuffle partitions
  • ▸ JDBC parallel reads need partitionColumn, lowerBound, upperBound and numPartitions; bounds never filter rows
  • ▸ Global temp views live in global_temp; query them as global_temp.view_name
  • ▸ left_semi and left_anti return only left columns; the default join type is inner
  • ▸ Read modes — ERMISSIVE is default, DROPMALFORMED skips bad rows, FAILFAST errors on the first
  • ▸ Complete mode requires an aggregation; checkpointLocation must be unique per streaming query
  • ▸ to_pandas collects to the driver; to_spark and pandas_api convert without collecting

Can you answer these without checking your notes?

In this scenario: "A streaming query runs a windowed count in append mode with no withWatermark call" — what should you do first?
Append mode with an aggregation needs a watermark, declared on the event-time column before groupBy, so Spark knows when a window is final and can drop old state. Without it Spark rejects the query.
In this scenario: "A job fails during collect() on a large DataFrame and the error appears in the driver log" — what should you do first?
collect brings every row to the driver, so the driver ran out of memory. Keep work distributed, write results out or take a sample; spark.driver.maxResultSize caps returned data. Executor OOM instead points to large or skewed partitions.
In this scenario: "Code calls spark.sparkContext.parallelize on a session built with SparkSession.builder.remote('sc://host:15002')" — what should you do first?
Spark Connect sends unresolved logical plans over gRPC and supports only DataFrame and SQL APIs. SparkContext, RDDs, broadcast variables and accumulators need a classic session; the server, not the client, analyses and executes plans.

Common Exam Mistakes — What candidates get wrong

Counting stages or jobs per transformation instead of per shuffle and action

Each action launches a job; wide transformations such as groupBy, join, distinct and orderBy add stage boundaries; narrow ones like filter, select and withColumn pipeline into one stage. Each stage then runs one task per partition.

Using coalesce to increase partitions or fix skew

coalesce merges partitions without a full shuffle, so coalesce(400) on 50 partitions still yields 50 and a hot key stays in one partition. repartition shuffles to any count; skew needs AQE skew join handling or salting both join sides.

Assuming a write to an existing path overwrites by default

The default save mode is errorifexists, so df.write.parquet(path) fails when data exists. append adds rows, overwrite replaces them, and ignore silently skips the write. bucketBy and sortBy only work with saveAsTable, never a path-based save.

Defining a Python UDF without a return type

udf(lambda x: x * 2) returns StringType by default, so numeric results become strings. Pass returnType explicitly, and prefer built-in functions or a pandas_udf: Python UDFs serialise row by row and are opaque to the Catalyst optimizer.

Writing month patterns as mm in date format strings

In Spark datetime patterns, mm is minutes and MM is months, so 'yyyy-mm-dd' puts minute values in the month slot. Also divide millisecond epochs by 1000 before from_unixtime, which returns a formatted string rather than a date type.

Resources to help you pass Databricks Apache Spark Developer Associate on your first attempt

Trace PySpark snippets under time pressure and see which defaults and edge cases still catch you.