PySpark Joins
22 interview problems on inner, left, anti and semi joins across DataFrames, from easy to hard.
Learn Joins
- join · 5 min read. Combine DataFrames on a key: inner, left, right and full joins, and the duplicate-key fan-out trap.
- left_semi / left_anti · 4 min read. Keep the rows that have a match, or the rows that do not, without duplicating anything.
- Join strategies · 8 min read. Broadcast hash, shuffle hash, sort-merge and nested loop joins: how Spark picks one, and how to steer it.
- Join hints and slow non-equi joins · 6 min read. Steer the join strategy with hints, rewrite a join that fell back to a nested loop, and check what Spark really ran.
- Broadcast joins · 6 min read. Ship a small table to every executor and skip the shuffle, and when broadcasting backfires.
- eqNullSafe (<=>) · 4 min read. Equality where null matches null: the fix for joins and comparisons that silently drop null keys.
- Order Lines with Product Details · Easy · Joins, Filtering & Selection
- Enrich a Stream of Orders with Customer Data · Easy · Streaming, Joins, Filtering & Selection
- Customers Without Orders · Medium · Joins, Filtering & Selection
- Employees and Their Departments · Medium · Joins, Filtering & Selection
- Year-over-Year Growth · Medium · Joins, Filtering & Selection
- Employees Earning More than Their Manager · Medium · Joins, Filtering & Selection
- Joining on Nullable Keys · Medium · Joins, Null Handling, Filtering & Selection
- Pick the Join Strategy · Medium · Spark Performance, Joins, Conditional Logic
- How Much Does Each Query Read? · Medium · Data Lake, Joins, Aggregations
- Rebuild a Table from Its Transaction Log · Medium · Lakehouse, Joins, Aggregations
- Files VACUUM Can Delete · Medium · Lakehouse, Joins, Aggregations
- Split Train and Test With No User in Both · Medium · Data Prep for AI, Joins, Aggregations
- Price Valid at Order Time (Range Join) · Hard · Joins, Null Handling, Filtering & Selection
- Reconcile Two Sources (Full Outer Join) · Hard · Joins, Null Handling, Conditional Logic, Filtering & Selection
- Fill Missing Dates (Calendar Spine) · Hard · Joins, Arrays, Aggregations, Dates, Null Handling, Filtering & Selection
- Customers Who Bought Every Product · Hard · Joins, Aggregations, Filtering & Selection
- Monthly Retention by Cohort · Hard · Joins, Aggregations, Dates, Null Handling, Filtering & Selection
- Find Hot Keys and Plan Salting · Hard · Spark Performance, Joins, Aggregations
- Apply a CDC Batch (MERGE Semantics) · Hard · Lakehouse, Window Functions, Joins
- What Changed Between Two Versions · Hard · Lakehouse, Joins, Strings
- Fit Conversations into a Context Window · Hard · Data Prep for AI, Window Functions, Joins
- Build Preference Pairs from Ratings · Hard · Data Prep for AI, Window Functions, Joins
Browse
Topics: Window Functions · Joins · Aggregations · Pivot, Unpivot & Rollup · Arrays · Null Handling · Conditional Logic · Dates · Filtering & Selection · Strings · Data Lake · Lakehouse · Streaming · Data Prep for AI · Spark Performance
Difficulty: Easy · Medium · Hard · Learn · All problems · dbt practice