PySpark data engineering interview problem. Difficulty: intermediate. Pattern: Schema Drift. About 16 minutes. Part of the Pro drill bank.
Rename user_id/event_type/amount to uid/etype/amt. Treat this as a production helper: match the contracted return shape, including empty and duplicate inputs.
Rename columns to uid, etype, amt. Order by uid. Assign result.
Input: events Output: uid | etype | amt 1 | purchase | 10.0 2 | view | 0.0 3 | purchase | 20.0 Exact rename map.
Topics: lakebench, pyspark, withColumnRenamed.
More PySpark interview questions · All interview problems · Learn data engineering
Interview-style drill: Rename user_id/event_type/amount to uid/etype/amt.
Rename columns to `uid`, `etype`, `amt`. Order by `uid`. Assign `result`.