PySpark data engineering interview problem. Difficulty: beginner. Pattern: Schema Drift. About 12 minutes. Free to practice.
Cast string user_id to int and string amount to double. Treat this as a production helper: match the contracted return shape, including empty and duplicate inputs.
From df, cast user_id to int and amount to double. Order by user_id. Assign result.
Input: string user_id/amount Output: user_id | amount 10 | 12.5 20 | 7.0 30 | 100.25 40 | 0.5 Casts make arithmetic and numeric filters safe.
Topics: lakebench, pyspark, cast.
More PySpark interview questions · All interview problems · Learn data engineering
Interview-style drill: Cast string user_id to int and string amount to double.
From `df`, cast `user_id` to int and `amount` to double. Order by `user_id`. Assign `result`.