1. Left table alias
orders o aliases the left, typically large, table as o for short references.
FROM orders oTyporithm · medium
Step 1 of 8 · intro card
Spark SQL
Join distributed tables on a key with JOIN ... ON; broadcast the smaller table with /*+ BROADCAST(c) */ to skip an expensive shuffle.
A join pairs rows from two distributed tables on a key, here orders to customers on customer_id = id.
By default Spark shuffles both sides across the network to colocate matching keys, which is costly for large tables.
When one side is small, a broadcast join ships that whole table to every executor — add a /*+ BROADCAST(c) */ hint to avoid the shuffle entirely.
JOIN ... ON pairs rows on a key.
Default joins shuffle both sides.
Broadcast a small table to skip the shuffle.
SELECT o.id, c.name FROM orders o JOIN customers c ON o.customer_id = c.idConnect each part of the code to the concept before you type.
orders o aliases the left, typically large, table as o for short references.
FROM orders oJOIN customers c brings in the second table, aliased c, to combine matching rows.
JOIN customers cON defines the equality key that pairs each order with its customer.
ON o.customer_id = c.idQualifying columns with the alias avoids ambiguity when both tables share a name.
SELECT o.id, c.nameRead the concept map and follow the code breakdown.
Type the implementation, repair mistakes and work through every recall exercise.
Use the final check without hints; revisit weak concepts in short practice sessions.