Optimization: Inspect Physical Plan & Broadcast Join

Medium
Optimization
AQE
Explain
Broadcast
Google
Amazon
Databricks

Optimization: Inspect Physical Plan & Broadcast Join

Senior Spark interviews always ask how you prove whether Catalyst chose a BroadcastHashJoin or fell back to SortMergeJoin.

  1. Filter dfs['orders'] to valid positive rows (amount > 0).
  2. Join to F.broadcast(dfs['regions']) on 'region_id'.
  3. Inspect the query plan using .explain() so BroadcastHashJoin is verified.
  4. Return order_id, region_name, amount sorted by order_id.
Browser Engine: Evaluates PySpark DataFrame & SQL logic locally in Pyodide WebAssembly.

Input data

0 DataFrames

These DataFrames are passed to solve(spark, dfs). Access one with dfs['name'].

Browser engine
Loading Python editor…
Click Run to try the sample cases, or Submit to check the hidden cases. First run caches the browser Python engine (~8–15s once); all code stays on your device.