Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing

Rename Columns

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.

Constraints

  • Final names uid, etype, amt.
  • Order by uid.

Examples

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

intermediate

Rename Columns

Interview-style drill: Rename user_id/event_type/amount to uid/etype/amt.

Rename columns to `uid`, `etype`, `amt`. Order by `uid`. Assign `result`.