Whenever you're ready, walk me through how you'd approach this.
How would you optimize a Spark job that processes large datasets?
Explain how you would diagnose the bottleneck before changing the implementation. Address input formats, partition sizing, filter and projection pushdown, join strategies, data skew, shuffle reduction, executor memory, serialization, caching, adaptive query execution, and output file layout. Treat this as a practical troubleshooting exercise: describe the Spark UI or metrics you would inspect, propose changes, and explain how you would validate performance, correctness, and cost.