Pair your devices with a code and playback position follows you: pause on this device, hit resume on the other. Position is saved to the site every minute and on pause.
Open this panel on your other device and enter the same code.
Every figure verified 2026-11-22 against the page cited in the matching lesson, on Apache Spark 4.3.0. "Observed" means it was run on 4.3.0 in local mode, not read from a doc. Re-verify before quoting; the ⚠️ items are flagged in the lessons.
| Spark 3.5.x | Spark 4.3.0 | |
|---|---|---|
| Scala | 2.12 / 2.13 | 2.13 only (2.12 dropped in 4.0.0) |
| Java | 8 / 11 / 17 | 17 / 21 / 25 (8 and 11 dropped in 4.0.0) |
| Python | 3.8+ | 3.11+ (3.8 dropped in 4.0, 3.9 in 4.1, 3.10 in 4.3) |
| pandas / PyArrow | — | pandas >=2.2.0,<3.0.0, PyArrow >=18.0.0 |
| ANSI mode | off | on (spark.sql.ansi.enabled, since 4.0) |
| Where | Newest | Spark | Scala |
|---|---|---|---|
| Open source | 4.3.0 (Oct 30, 2026) | 4.3.0 | 2.13 |
| EMR 8.x "AWS runtime for Apache Spark" | emr-spark-8.2.0 (LTS) |
4.1.3-amzn-0 | 2.13.17 |
| EMR 7.x | emr-7.14.0 |
3.5.8-amzn-0 | 2.12.18 |
| AWS Glue | 6.0 (default for new jobs) | 4.1.1 | 2.13.17 |
| AWS Glue | 5.1 | 3.5.6 | 2.12.18 |
%% appends the binary
suffix: "org.apache.spark" %% "spark-sql" % "4.3.0" resolves spark-sql_2.13.| See this | Say this |
|---|---|
var, mutable collection |
Scala docs: always val unless there's a reason. Mutable state plus closures is lesson 2's bug |
.get on an Option |
Throws NoSuchElementException when empty. Use map / getOrElse / pattern match |
null |
Option(javaCall) turns null into None. ⚠️ Some(null) is still a null (observed NPE) |
match on a non-sealed type, no default |
Exhaustiveness is checked only for sealed, and only as a warning → scala.MatchError in production. Seal it; build with -Werror |
return inside a lambda |
Non-local return is implemented by throwing; a catch Throwable swallows it (observed). Deprecated since Scala 3.2 |
ds.collect().map(...).groupBy(...) |
Same method names, but after collect() it is eager, local, single-JVM |
Code that only compiled in spark-shell |
The shell pre-imports spark.implicits._ (observed); a job needs the import for $"col" and .toDS() |
val evaluates once, def every call, lazy val once on first use. object = one instance, created
lazily. Try catches only non-fatal exceptions. Either: Left is failure, Right is success, right-biased.
DataFrame is a type alias of Dataset[Row]. Typed Dataset[T]: Scala and Java only — "Python does
not have the support for the Dataset API".Encoders.kryo[T] stores one binary column — you lose every column operation.| Typed-API behaviour on 4.3.0 | Observed |
|---|---|
filter($"amount" > 498) on Parquet |
PushedFilters: [IsNotNull(amount), GreaterThan(amount,498.0)] |
filter(o => o.amount > 498) |
PushedFilters: []; an object built per row. ⚠️ No DeserializeToObject node — that appears for map |
| Case-class field missing from data | Fails at .as[T]: UNRESOLVED_COLUMN.WITH_SUGGESTION |
Int field over a bigint column |
Fails at .as[T]: CANNOT_UP_CAST_DATATYPE |
| NULL in a primitive field | Fails in a task: NOT_NULL_ASSERT_VIOLATION. Use Option[T] |
groupByKey(...).mapGroups(...) |
No partial aggregation; shuffles all the data |
| Scala UDF in a filter | Still PushedFilters: [] |
Task not serializable: the lambda read a field, so it captured this. Read the first line of
the serialization stack — it names the class. Fixes, in order: copy the field to a local val; move
the helper to an object; @transient lazy val for a non-serializable member. extends Serializable
alone only moves the failure down a level (observed). Kryo does not cure it.
Accumulators: exactly-once only for updates inside actions; in transformations an update "may be
applied more than once" (observed 0 → 100 → 200 over two count() calls).
spark.serializer default: org.apache.spark.serializer.JavaSerializer.
Same engine, same plan. DataFrame and SQL code compiles to an identical physical plan in either
language (observed: empty diff). The language matters only where your code runs on the rows.
| Scala / Java | Python | |
|---|---|---|
Typed Dataset[T] |
Yes | No |
| UDF runs in | The executor JVM | A Python worker; Arrow transfer by default since 4.2 (spark.sql.execution.pythonUDF.arrow.enabled = true) |
| Vectorised UDF | — | pandas UDF; arrow_udf (4.1.0+) |
| Custom connector | Data Source V2 (Java interfaces) | Python Data Source API (4.0+), "lightweight" |
| Optimizer rules, parser | SparkSessionExtensions (no stability guarantee) |
⚠️ none found |
transformWithState |
Yes; runs in Real-Time Mode since 4.3.0 | Yes; not supported in Real-Time Mode |
| Ship dependencies | Assembly jar, Spark and Hadoop provided |
--py-files (.py, .zip, .egg — no wheels); conda-pack / venv-pack via --archives; PEX via --files |
CREATE FUNCTION … RETURN …) — the only shared
form that kept filter pushdown (observed). A JVM UDF is callable from PySpark with
spark.udf.registerJavaFunction.SparkContext, no df._jdf. spark.api.mode=connect; default port 15002.PartitionFilters, PushedFilters), join strategy, exchanges — from the SQL
tab, because a pre-run explain under AQE shows isFinalPlan=false.collect, repeated actions. Last, not first.| Key | 4.3.0 default |
|---|---|
spark.sql.shuffle.partitions |
200 |
spark.sql.adaptive.enabled |
true |
spark.sql.adaptive.advisoryPartitionSizeInBytes |
64 MB |
spark.sql.adaptive.coalescePartitions.parallelismFirst |
true — ignores the target size |
spark.sql.adaptive.skewJoin.enabled |
true |
…skewJoin.skewedPartitionFactor / …skewedPartitionThresholdInBytes |
5.0 / 256MB — both must be exceeded |
spark.sql.autoBroadcastJoinThreshold |
10 MB (-1 disables) |
spark.sql.files.maxPartitionBytes |
128 MB |
spark.executor.memory / spark.driver.memory |
1g / 1g |
spark.executor.memoryOverheadFactor (min overhead) |
0.10 (384m) |
spark.memory.fraction / storageFraction |
0.6 / 0.5 |
spark.driver.maxResultSize |
1g |
spark.dynamicAllocation.enabled / spark.speculation |
false / false |
spark.eventLog.enabled |
false — turn it on, or there is no evidence afterwards |
SortMergeJoin(skew=true). Look for the words skew=true / skewed.explain modes: simple, extended, codegen, cost, formatted.BROADCAST over MERGE over SHUFFLE_HASH over SHUFFLE_REPLICATE_NL.
REBALANCE is ignored without AQE./api/v1/applications/[app-id]/stages/[stage-id]/[attempt]/taskSummary; History Server on 18080.DynamicJoinSelection to DemoteBroadcastHashJoin; an old name in
spark.sql.adaptive.optimizer.excludedRules is silently ignored.Review in blast-radius order: silently wrong → kills the job → slow.
| Hazard | Fact |
|---|---|
| Overwriting a partitioned path | spark.sql.sources.partitionOverwriteMode default STATIC — deletes partitions you did not write (observed). Per-write option partitionOverwriteMode=dynamic takes precedence |
| Save modes | Default errorifexists. They "do not utilize any locking and are not atomic" |
Retry with append |
Duplicates (observed 3 → 6 rows) |
| Join key not unique | Fan-out: 3 rows summing 22 became 5 rows summing 37 (observed) |
| NULL keys | NOT IN with a NULL in the list returns no rows; <=> is the null-safe equal |
withColumn in a loop |
Doc: "can generate big plans … even StackOverflowException". 50 calls → 50 Project nodes; one withColumns → 1 (observed) |
collect / toPandas |
Only when the result is "expected to be small" |
Window with no partitionBy |
Logs "Moving all data to a single partition" |
| UDF with side effects or randomness | UDFs are deterministic by default and may run more or fewer times — asNondeterministic |
SparkConf in code > --conf flags > spark-defaults.conf (observed 3 / 7 / 11).
Deploy-time settings such as spark.driver.memory cannot take effect from code in client mode.--deploy-mode default client (driver in the spark-submit process); cluster mode on YARN runs
the driver in the application master.pyspark.testing.assertDataFrameEqual and assertSchemaEqual (⚠️ fail to import with
pandas 3). Scala: ScalaTest 3.2.20, AnyFunSuite, a local SparkSession.StartJobRun: jobDriver.sparkSubmit with entryPoint, entryPointArguments,
sparkSubmitParameters; a jar's --class goes in sparkSubmitParameters.--job-language scala or python (default python), --class, --extra-jars. Glue
compiles Scala on the server.| Release | Date | Remember |
|---|---|---|
| 4.0.0 | May 23, 2025 | ANSI on by default · Scala 2.13 / JDK 17 · VARIANT · Python Data Source API · Python UDTFs · SQL pipe syntax · transformWithState |
| 4.1.0 | Dec 16, 2025 | Declarative Pipelines · SQL scripting GA · VARIANT GA · Real-Time Mode (Scala, stateless) · recursive CTEs · arrow_udf |
| 4.2.0 | Jul 14, 2026 | Arrow on by default for Python UDFs / UDTFs · GEOMETRY / GEOGRAPHY · QUALIFY · Auto CDC (SCD 1) · Java 25 |
| 4.3.0 | Oct 30, 2026 | Stateful Real-Time Mode, no longer experimental · SCD Type 2 · JSON_TABLE · Python 3.10 dropped |
ARITHMETIC_OVERFLOW; bad cast → CAST_INVALID_INPUT; 10 / 0 →
DIVIDE_BY_ZERO. ANSI off: -2147483648, NULL, NULL. Narrow fix: try_add, try_cast,
try_divide. Restore old behaviour: spark.sql.ansi.enabled=false.snappy → zstd; CREATE TABLE without USING follows
spark.sql.sources.default; servlet API javax → jakarta; Mesos removed.