Enrich Orders With User Names

Easy
Joins
TikTok

Enrich Orders With User Names

Inner-join orders with users on user_id. Return order_id, name, amount sorted by order_id ascending. Drop orders whose user_id is not in users.

Browser Engine: Evaluates PySpark DataFrame & SQL logic locally in Pyodide WebAssembly.

Input data

2 DataFrames

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

df.users5 rows
user_id (int)name (string)
1Aarav
2Priya
3Rohan
4Isha
5Kabir
df.orders8 rows
order_id (int)user_id (int)amount (double)
100330.18
1014250.46
102365.14
103678.18
1047111.78
1055282.98
1065128.6
1075208.1

Return these columns

order_id(int)
name(string)
amount(double)

Column names and order must match. Sort order is specified in the question.

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.