Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing

Add Derived Column

PySpark data engineering interview problem. Difficulty: beginner. Pattern: Filtering. About 12 minutes. Free to practice.

Add full_name by joining first_name and last_name with a space. Treat this as a production helper: match the contracted return shape, including empty and duplicate inputs.

From df, add full_name = first_name + space + last_name using concat_ws. Keep all three columns. Order by first_name. Assign result.

Constraints

  • Use concat_ws, not a Python loop.
  • Order by first_name.

Examples

Input: first_name | last_name Output: first_name | last_name | full_name ada | lovelace | ada lovelace alan | turing | alan turing dennis | ritchie | dennis ritchie grace | hopper | grace hopper concat_ws inserts a single space between non-null parts.

Topics: lakebench, pyspark, withColumn, concat_ws.

More PySpark interview questions · All interview problems · Learn data engineering

beginner

Add Derived Column

Interview-style drill: Add full_name by joining first_name and last_name with a space.

From `df`, add `full_name` = first_name + space + last_name using `concat_ws`. Keep all three columns. Order by `first_name`. Assign `result`.