AWS Training
Modules Listen Certification

← Senior Spark Technical Lead (Scala, Python) — Role Review

Starts this lesson and continues through 0 more to the end of the course.

Staying current — the Spark 4 line and what to migrate

Why this matters

Every page below was fetched on 2026-11-22. If your picture of Spark is "3.5, and 4.0 just came out", you are four feature releases behind: the news page lists 4.3.0 (October 30, 2026), 4.2.1, 4.1.4, 4.0.5 and 3.5.10 as the newest of each line (news, verified 2026-11-22). A lead who is asked "should we move to Spark 4?" and answers with features has answered the wrong question. The right answer is a list of defaults that changed, the configs that put them back, and the order you would remove those configs.

What the posting is really asking. "Stay updated with the latest trends and advancements in Apache Spark, Scala, and Python technologies" is not a reading habit. It is the ability to say which release your platform runs, which one upstream ships, what breaks in between, and what you would do about it this quarter. Pair it with "ensure adherence to best practices in … deployment processes": an upgrade is a deployment, and it is the one a lead owns end to end.

The release map

Dates from the news page; headlines in the release notes' own wording.

Release Date Headline items, as the notes word them
4.0.0 May 23, 2025 "Drop Scala 2.12 and make Scala 2.13 the default", "Drop JDK 8/11 and make JDK 17 the default", "Use ANSI SQL mode by default", "Add VARIANT data type", "SQL Pipe syntax", "Support SQL user-defined functions", "Python Data Source API", "Python User-defined Table Functions", "Arbitrary State API v2", "State Data Source - Reader"
4.1.0 December 16, 2025 "Declarative Pipelines, a new component to define and run data pipelines", "SQL Scripting GA", "VARIANT type GA", "Real-time Mode in Structured Streaming (Scala stateless support)", "JDBC Driver for Spark Connect", "Python Arrow UDF", "Python Arrow UDTF", "Recursive CTE support"
4.2.0 July 14, 2026 "Geospatial types", "Change Data Capture — a SQL CHANGES clause", "Enable Arrow-optimized Python UDFs and Arrow-based PySpark IPC by default", "Add QUALIFY clause", "Metric views", "Build and run Spark on Java 25"
4.3.0 October 30, 2026 "Stateful Real-Time Mode", "SCD Type 2 in Auto CDC", "Faster queries on small data", "Spark Connect REST endpoints", "JSON_TABLE and VARIANT transformation functions", "SQL ASOF JOIN", "Nanosecond-precision timestamps … (preview)"

⚠️ The 4.1.0 notes live at spark-release-4.1.0.html (dots); the hyphenated URL returned HTTP 404 on 2026-11-22. Follow the link from the news page.

Cadence and support windows

The versioning policy (verified 2026-11-22) changed with 4.3, and this is the part most people have not caught up on:

⚠️ The policy page gives no end-of-life date per line. It states the window for 4.2.x and for 3.5.x; it does not state when 4.0.x or 4.1.x stop receiving fixes. Do not put an EOL date for those in a planning document — check the dev@ release threads.

⚠️ Policy and practice disagree. The policy says feature releases carry "No behavior or semantic changes (e.g. SQL semantics, execution behavior, configuration defaults)". The 4.3 migration guides nevertheless list changed defaults — spark.rdd.compress, spark.sql.execution.replaceHashWithSortAgg — and the 4.3.0 notes list "Drop Python 3.10 support". Read the migration guide for every feature release; do not rely on the policy sentence.

What a lead does with this: 4.3 is a six-month release. For a platform you intend to leave alone for a year, the documented long-window targets are 4.2.x (18 months) or the future 4.5 LTS. Bring that to stakeholders with the quotes above.

3.5 → 4.0: what breaks

All quotes are from the migration guides (SQL, Core, PySpark, Structured Streaming, verified 2026-11-22).

Change in 4.0 The guide's restore line
"spark.sql.ansi.enabled is on by default" "set spark.sql.ansi.enabled to false or SPARK_ANSI_SQL_MODE to false"
CREATE TABLE without USING/STORED AS uses spark.sql.sources.default, not Hive "set spark.sql.legacy.createHiveTableByDefault to true"
spark.sql.maxSinglePartitionBytes default: Long.MaxValue → 128m set it to 9223372036854775807
spark.sql.orc.compression.codec default: snappy → zstd set it to snappy
spark.sql.legacy.timeParserPolicy default: EXCEPTION → CORRECTED — (set the policy explicitly)
JDBC type mappings changed for Postgres, MySQL, Oracle, SQL Server, DB2 per-dialect, e.g. spark.sql.legacy.postgres.datetimeMapping.enabled
Servlet API "from javax to jakarta" none — recompile
"support for Apache Mesos as a resource manager was removed" none

Platform floor, from the 4.0.0 notes and the 4.3.0 docs overview: Scala 2.12 dropped, JDK 8/11 dropped; today "Spark runs on Java 17/21/25, Scala 2.13, Python 3.11+, and R 4.0+ (Deprecated)", and "When using the Scala API, it is necessary for applications to use the same version of Scala that Spark was compiled for." Every Scala jar and every _2.12 dependency must be rebuilt for _2.13, and no config restores that.

Python floor moved at every release (PySpark migration guide):

Release Python dropped pandas minimum PyArrow minimum
4.0 3.8 1.0.5 → 2.0.0 4.0.0 → 11.0.0
4.1 3.9 2.0.0 → 2.2.0 11.0.0 → 15.0.0
4.2 — — 15.0.0 → 18.0.0
4.3 3.10 — —

The 4.3.0 install page lists "Python 3.11 and above", pandas >=2.2.0,<3.0.0, pyarrow >=18.0.0. Also in 4.0, pandas API on Spark lost a long list of deprecated methods (DataFrame.append, iteritems, to_koalas, …).

ANSI mode, observed

Scratch environment: PySpark 4.3.0, Python 3.14.7, Scala 2.13.18, Java 17.0.18, local mode. Executed 2026-11-22; the output is what the machine printed.

def attempt(label, sql):
    try:
        print(f"{label}: {spark.sql(sql).collect()[0][0]!r}")
    except Exception as e:
        print(f"{label}: {type(e).__name__} condition={e.getCondition()} sqlstate={e.getSqlState()}")

qs = [("overflow", "SELECT 2147483647 + 1"), ("cast", "SELECT CAST('12x' AS INT)"),
      ("divide", "SELECT 10 / 0"), ("array", "SELECT array(1,2,3)[5]")]
for l, q in qs: attempt(l, q)                      # ANSI on — the default
spark.conf.set("spark.sql.ansi.enabled", "false")
for l, q in qs: attempt(l, q)                      # 3.5 behaviour
overflow: ArithmeticException condition=ARITHMETIC_OVERFLOW sqlstate=22003
cast: NumberFormatException condition=CAST_INVALID_INPUT sqlstate=22018
divide: ArithmeticException condition=DIVIDE_BY_ZERO sqlstate=22012
array: ArrayIndexOutOfBoundsException condition=INVALID_ARRAY_INDEX sqlstate=22003
# -- after spark.conf.set("spark.sql.ansi.enabled", "false") -- (this comment line is mine)
overflow: -2147483648
cast: None
divide: None
array: None

With ANSI back on, try_add(2147483647, 1), try_cast('12x' AS INT), try_divide(10, 0) and try_element_at(array(1,2,3), 5) each returned NULL. The same holds from Scala (spark-shell, same machine): $"s".cast("int") over "12x" threw SparkNumberFormatException CAST_INVALID_INPUT 22018; $"s".try_cast("int") returned [12], [null].

⚠️ Read the second half again. With ANSI off, an integer overflow wrapped to a negative number and a bad cast became NULL — silently. ANSI does not introduce failures; it surfaces corruption that was already being written. A job that "worked on 3.5 and fails on 4.0" has told you where it was wrong.

What a lead does with this: in review, treat a session-wide spark.sql.ansi.enabled=false in new code as a defect. The fix is a try_* function at the one expression where NULL on bad input is the intended rule, plus a count of the rows that took that path.

What 4.1, 4.2 and 4.3 added

Strictly from each release's notes and migration guides.

4.1.0. Spark Declarative Pipelines — "you define datasets and queries, and Spark handles the execution graph, dependency ordering, parallelism, checkpoints, and retries." Real-Time Mode, "Scala stateless support". SQL scripting "GA and enabled by default". VARIANT "GA with shredding". "New Arrow-native UDF and UDTF decorators", "Python Data Source filter pushdown", "Spark ML on Connect is GA for the Python client". Build: Scala 2.13.17, "Add Python 3.14 support in Spark Classic". Changed defaults: magic committer "for all S3 buckets by default", AQE for stateless streaming (spark.sql.adaptive.streaming.stateless.enabled), and BinaryType maps to Python bytes (spark.sql.execution.pyspark.binaryAsBytes).

4.2.0. The one that changes every PySpark job: spark.sql.execution.arrow.pyspark.enabled, spark.sql.execution.pythonUDF.arrow.enabled and spark.sql.execution.pythonUDTF.arrow.enabled all "now default to true"; set each to false to restore. A pandas UDF receiving a nullable integer column with nulls now gets Int64-family extension dtypes "instead of float64". Also: GEOMETRY and GEOGRAPHY types, the CHANGES clause and Auto CDC "SCD Type 1" in pipelines, QUALIFY, "Add Real-time Mode (RTM) trigger support to PySpark", DataStreamReader.name() so "sources can be added, removed, and reordered without breaking checkpoints", Java 25. For what Arrow-optimised UDFs are, see PS0 lesson 3.

4.3.0. Real-Time Mode goes stateful — "streaming aggregation, dropDuplicates, and transformWithState … with end-to-end latency on the order of 100 milliseconds" — and loses its @Experimental annotation. SCD Type 2 in Auto CDC. Opt-in: single-task execution (spark.sql.optimizer.singleTaskExecution.enabled), SQL ASOF JOIN (spark.sql.join.asofJoin.enabled, "off by default"), nanosecond timestamps (spark.sql.timestampNanosTypes.enabled). variant_set / variant_insert / variant_delete, JSON_TABLE. Changed defaults: spark.rdd.compress, spark.sql.execution.replaceHashWithSortAgg and spark.sql.execution.combineAdjacentAggregation are true. One rename fails silently: the AQE rule DynamicJoinSelection is now DemoteBroadcastHashJoin, and if you had it in spark.sql.adaptive.optimizer.excludedRules, "that name no longer matches any rule (unknown names are silently ignored)". Grep your configs for it.

Three of these, run on 4.3.0

spark.sql("""SELECT parse_json('{"user":{"id":7,"tags":["a","b"]},"amount":12.5}') AS v""") \
     .createOrReplaceTempView("ev")
spark.sql("""SELECT typeof(v) t, variant_get(v, '$.user.id', 'int') AS id,
                    v:user.tags[1]::string AS tag, schema_of_variant(v) s FROM ev""").show(truncate=False)
spark.sql("SELECT variant_set(v, '$.user.id', 8) AS v2 FROM ev").show(truncate=False)

Data rows only, borders and headers trimmed:

|variant|7  |b  |OBJECT<amount: DECIMAL(3,1), user: OBJECT<id: BIGINT, tags: ARRAY<STRING>>>|
|{"amount":12.5,"user":{"id":8,"tags":["a","b"]}}|

The VARIANT type is 4.0, the colon operator 4.1, variant_set 4.3 — three releases in one query. Also run, same session: a SQL script (BEGIN … DECLARE … WHILE … END) summing 1 to 4 returned 10; a pipe query (FROM t |> WHERE … |> AGGREGATE …), a QUALIFY query and a WITH RECURSIVE CTE all returned rows; and a plain @udf("int") planned as ArrowEvalPython with no configuration, confirming the 4.2 default.

Scala and Python currency

scala-lang.org/download/all (verified 2026-11-22): "Current 3.10.x release: 3.10.1" (November 11, 2026), "Current 3.9.x LTS release: 3.9.0", "Current 3.3.x LTS release: 3.3.9", "Current 2.13.x release: 2.13.18" (November 24, 2025), "Latest 2.12.x maintenance release: 2.12.21". Spark's docs name Scala 2.13 only, and the scratch 4.3.0 build reports 2.13.18. On a Spark team "Scala" still means 2.13.

Python: 3.11 and above per the docs. On this machine PySpark 4.3.0 ran every sample on Python 3.14.7 — an observation, not a support statement. The same environment has pandas 3.1.1, outside the documented <3.0.0; PySpark warned "PySpark does not yet fully support pandas >= 3.0.0" and the samples still ran. Pin pandas below 3 on a real cluster.

What you can run on AWS today

Service Newest version Spark Source (verified 2026-11-22)
AWS Glue 6.0 — "the default version for jobs created without specifying an AWS Glue version" 4.1.1, Python 3.13, Scala 2.13.17, Java 17 Glue versions
Amazon EMR 8.x — "AWS runtime for Apache Spark" emr-spark-8.2.0 — LTS, initial release November 18, 2026, standard support until November 17, 2029 4.1.3-amzn-0 emr-spark-8.2.0
Amazon EMR 7.x 7.14.0 — "latest release of 7.x series", initial release September 8, 2026 3.5.8-amzn-0 EMR 7.14.0

Upstream is 4.3.0. Both Glue 6.0 and the EMR 8.x runtime are on the 4.1 line — two feature releases behind — and the classic EMR 7.x labels are still on 3.5. So on AWS today you get ANSI-by-default, Declarative Pipelines and stateless Real-Time Mode, and you do not get the 4.2 Arrow defaults or 4.3's stateful Real-Time Mode.

⚠️ The EMR docs are easy to misread here. The release-components page lists only the 7.x, 6.x and 5.x series, so reading that page alone you would conclude "EMR has no Spark 4". The Spark 4 runtime is documented separately, with labels of the form emr-spark-x.y.z, and it heads the EMR Serverless release list above 7.14.0. Check both before you answer a version question. Lesson 5 covers deployment; DE4 lesson 1 covers Glue versus EMR.

What a lead does with this

Sources to watch, in order of signal.

  1. The migration guide for each component — the only place changed defaults are listed with their restore configs.
  2. The release notes, which link every item to a JIRA ticket.
  3. SPIPs. An SPIP "is a JIRA ticket labeled 'SPIP' proposing a major improvement or change to Spark"; the author emails dev@spark.apache.org, and the vote needs "at least 3 +1 votes from PMC members and no -1 votes" (improvement proposals). Declarative Pipelines and Real-Time Mode were SPIPs before they were release notes.
  4. dev@spark.apache.org, "for people who want to contribute code", where release windows are discussed; user@ is "for usage questions, help, and announcements" (community).
  5. The managed-service version pages above — they decide what you can use.

Running the upgrade.

  1. Read all four migration guides end to end for every release you cross. 3.5 → 4.3 is four sections per guide.
  2. Rebuild for the new floor first: Scala 2.13, JDK 17+, Python 3.11+, pandas/pyarrow minimums.
  3. Pin behaviour-restoring configs so the first run on the new version changes the engine and nothing else.
  4. Run the test suite on the new version (lesson 5).
  5. Shadow-run production inputs on old and new; diff outputs and compare physical plans.
  6. Remove the legacy configs one at a time, each its own change with its own diff. ANSI last — it finds the most.
  7. Record which legacy configs remain and why.

In an interview, answer "how do you stay current" with specifics: the release you run, the one upstream ships, one default that changed between them with its config key, and what you did about it. "I read blogs" names nothing.

Check yourself

  1. A job that ran on 3.5 fails on 4.0 with ARITHMETIC_OVERFLOW. What was it doing on 3.5?
  2. Under the current policy, how long is 4.3 maintained, and which 4.x release is the LTS?
  3. After moving 4.1 → 4.2, a pandas UDF's null handling changes. Which default moved?
  4. Your spark-defaults.conf excludes DynamicJoinSelection. What happens on 4.3?
  5. Why pin legacy configs before the first run instead of fixing failures as they appear?
Answers
  1. Writing a wrapped value. With spark.sql.ansi.enabled=false the scratch run returned -2147483648 for 2147483647 + 1. The failure is new; the wrong number is not.
  2. Six months — it is a feature release. The policy names 4.5.0 as the 4.x LTS with 18 months; 4.2.x keeps its previously committed 18 months.
  3. Arrow became the default (spark.sql.execution.arrow.pyspark.enabled and the two UDF/UDTF keys), and nullable integer columns with nulls arrive as Int64-family extension dtypes "instead of float64".
  4. Nothing visible. The rule was renamed DemoteBroadcastHashJoin and "unknown names are silently ignored", so the exclusion stops applying. The guide points to spark.sql.adaptive.convertSortMergeJoinToShuffledHashJoin.enabled.
  5. So a difference has one cause. With every default moving at once, a changed output could come from ANSI, a JDBC mapping, the time parser or the engine, and you cannot bisect.

Teaching this section

← PreviousCode review, testing, and deployment for SparkFinished →Cheat sheet, lab & quiz