Brief
Establish a Spark job baseline and check that a change preserves the correct result.
Imani receives a much larger set of trips. Voss pushes the team to publish the first depot appearing in the results, but Mara requires a verifiable baseline. In the tiny copy, SHELL-02 appears twice at D7 and once at D8. Explain the calculation and prepare a measurement before the fictional meeting. The exercise has no timer.
Your mission
- Name the rows remaining after the SHELL-02 filter and the count at each depot.
- Name two transformations, one action, and the purpose of explain().
- Calculate both medians and the rounded speed ratio.
- Explain why D7 is a lead to confirm rather than proof.
How to check your work
- T1, T2, T3; D7=2 and D8=1.
- filter and groupBy are transformations; collect is an action; explain shows the plan.
- 6.1 s versus 4.9 s; about 1.24 times faster.
- Fictional result needing source checks and correct large-scale processing.
Course example
from statistics import median
baseline_seconds = [6.1, 6.0, 6.3]
candidate_seconds = [4.8, 5.0, 4.9]
baseline_rows = candidate_rows = 3
baseline_median = median(baseline_seconds)
candidate_median = median(candidate_seconds)
print("baseline_median", baseline_median)
print("candidate_median", candidate_median)
print("same_rows", baseline_rows == candidate_rows)
print("speedup", round(baseline_median / candidate_median, 2))