AWS Training
Modules Listen Certification

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

STL Quiz — 18 questions

Four options, one answer, no partial credit. Every figure is the one cited in the lesson named in the answer, verified against Apache Spark 4.3.0 documentation on 2026-11-22; where an answer says "observed", the lesson ran it. If a number has changed since, the lesson's source link is where to check.


1. A team's Scala jobs are built with scalaVersion := "2.12.18" against Spark 3.5. They want to move to Spark 4.3.0. What does the build have to do?

2. A match over a trait's subclasses has no default case. A new subclass is added in another file and a production record hits it. Why did this compile?

3. In a Scala pull request you see ds.collect().map(parse).groupBy(_.country). Which statement is correct?

4. Which statement about the typed Dataset API is true on Spark 4.3.0?

5. On Spark 4.3.0, the same filter is written as filter($"amount" > 498) and as filter(o => o.amount > 498) over a Parquet file. What did the lesson observe in the two plans?

6. case class Order(id: Long, amount: Double) is applied with .as[Order] to data where amount is sometimes NULL. What happens?

7. A job fails with Task not serializable, caused by NotSerializableException naming the pipeline class. The lambda is ds.map(x => x * markup) where markup is a field. What is the simplest fix the RDD guide itself recommends?

8. A row-count accumulator is incremented inside a map. The Dataset is then counted twice. The accumulator reads double the row count. Why?

9. A PySpark DataFrame aggregation and the same aggregation in Scala are both run on 4.3.0. What did the lesson observe about their physical plans?

10. On Spark 4.3.0 a function is declared with a bare @udf("int") and no Arrow configuration is set. How is it executed?

11. A filter uses a Python UDF and does not push down to Parquet. A teammate rewrites the UDF in Scala. What does the lesson's run show?

12. With every default on 4.3.0, a partition is treated as skewed by AQE when it is:

13. You call df.explain() before running a query and see SortMergeJoin. AQE is on. Which is correct?

14. A job that has run in production crashed overnight and nobody has the Spark UI. Which default made the investigation harder than it needed to be?

15. A daily job runs df.write.mode("overwrite").partitionBy("dt").parquet(path) with one day of data, against a path holding three days. With default configuration, what is at path afterwards?

16. A job sets spark.sql.shuffle.partitions in its SparkSession.builder. An operator passes a different value with --conf at submit time. Which value wins?

17. A job that ran for two years on Spark 3.5 fails on its first run on Spark 4 with ARITHMETIC_OVERFLOW. What is the most accurate description?

18. A stakeholder asks whether the team can use Spark 4.3's stateful Real-Time Mode on AWS next sprint. On 2026-11-22, what do the docs support saying?


Answers and explanations

1 — B. Lesson 1: "Spark requires Scala 2.13; support for Scala 2.12 was removed in Spark 4.0.0", and applications must use the Scala version Spark was compiled for. C is wrong — the Spark docs do not mention Scala 3 at all (flagged ⚠️). D is invented.

2 — B. Lesson 1 quotes the Scala tour: the compiler checks exhaustiveness "when the base type is sealed", and a miss "emits a warning". The lesson reproduced the scala.MatchError. The fix is sealed plus -Werror. A overstates it; C and D are invented.

3 — B. Lesson 1: after collect() you hold a local array; map and groupBy are Scala collection methods — eager, single JVM. The names match Spark's, which is exactly why reviewers miss it. No shuffle (C) and nothing lazy (D).

4 — B. Lessons 2 and 3 quote the SQL programming guide: "The Dataset API is available in Scala and Java. Python does not have the support for the Dataset API."

5 — B. Lesson 2, observed on 4.3.0. C is the folklore, and it is half wrong: the lesson saw no DeserializeToObject / SerializeFromObject nodes for a typed filter — they appear for map. The cost showed up as the empty PushedFilters and an object built per row.

6 — C. Lesson 2, observed: analysis passes, and the failure arrives at runtime inside a task. That is why it surfaces weeks later, on the first NULL. Declare the field Option[Double]. B describes only the untyped UDF overload, not encoders.

7 — C. Lesson 2 quotes the RDD guide: "the simplest way is to copy field into a local variable". B alone moved the failure one level down in the lesson's run. A is a common wrong turn — the lesson found no setting that changes the closure serializer.

8 — B. Lesson 2 quotes the guide: updates in actions are applied once; in transformations "each task's update may be applied more than once if tasks or job stages are re-executed". Observed 0, 100, 200 across two count() calls.

9 — C. Lesson 3, observed: diff of the two explain() outputs was empty. B would be true only if the Python code used a Python UDF.

10 — B. Lesson 3: since 4.2, spark.sql.execution.pythonUDF.arrow.enabled defaults to true, and the docs say such UDFs "still process data row-by-row with regular Python types, but use Arrow for more efficient data transfer". A was the answer before 4.2. C describes a pandas UDF.

11 — B. Lesson 3, observed with three filters: only the SQL function pushed [IsNotNull(id), GreaterThanOrEqual(id,900)]; the Python UDF and the Scala UDF both showed PushedFilters: []. Moving a UDF to the JVM removes the Python round trip, not the opacity.

12 — C. Lesson 4: skewedPartitionFactor 5.0 and skewedPartitionThresholdInBytes 256MB, and a partition must exceed both. The lesson's 185 MB hot partition met the first and not the second, so nothing was split. A is the advisory partition size.

13 — B. Lesson 4, observed: a pre-execution explain under AQE reports isFinalPlan=false.

14 — A. Lesson 4: spark.eventLog.enabled defaults to false, so without it there is nothing for the History Server to replay. B and C have the defaults backwards (true and false respectively). D is invented.

15 — B. Lesson 5: spark.sql.sources.partitionOverwriteMode defaults to STATIC; observed, the re-run left only the partition it wrote. A is dynamic mode. D is the default save mode, but the code explicitly sets overwrite.

16 — B. Lesson 5 quotes the configuration page and ran it: code 3, flag 7, defaults file 11 resolved to 3. This is why tunables belong at submit time, not in the builder.

17 — B. Lesson 6: "Since Spark 4.0, spark.sql.ansi.enabled is on by default." Observed with ANSI off: 2147483647 + 1 returns -2147483648. The error is the upgrade showing you a bug you already had.

18 — C. Lessons 5 and 6, from the AWS release pages. Stateful Real-Time Mode arrived in 4.3.0. D is the trap: the main EMR release page lists only the 5.x–7.x series, but the Spark 4 runtime is documented separately as emr-spark-8.x.

Scoring

Correct Reading
16–18 Solid on the technical half; spend the remaining time on the leadership, Design, and Debug sections of the interview file — for this posting they are most of the lines
12–15 Re-read the lessons for the questions you missed; the misses cluster by lesson, which tells you where
8–11 Do the lab before re-taking; Parts 1–3 reproduce the behaviour behind questions 5, 6, 11, 12, 15, and 17
< 8 Start from lesson 1, and type the examples into spark-shell instead of reading them