Each row in orders is a purchase. For every customer, keep only their earliest order. If two orders share the earliest day, keep the smaller order_id.
Return customer_id, order_id, order_day, amount, sorted by customer_id ascending.
These DataFrames are passed to solve(spark, dfs). Access one with dfs['name'].
orders7 rows| order_id (int) | customer_id (int) | order_day (int) | amount (double) |
|---|---|---|---|
| 100 | 1 | 3 | 30 |
| 101 | 1 | 1 | 20 |
| 102 | 2 | 2 | 50 |
| 103 | 2 | 2 | 15 |
| 104 | 3 | 5 | 70 |
| 105 | 4 | 4 | 10 |
| 106 | 4 | 1 | 25 |
Column names and order must match. Sort order is specified in the question.