The reviews table contains product ratings, but some ratings are missing.
Return product_id, avg_rating with the average of the non-null ratings, rounded to 2 decimal places. If a product has no ratings, avg_rating should be null. Sort by product_id ascending.
These DataFrames are passed to solve(spark, dfs). Access one with dfs['name'].
reviews8 rows| review_id (int) | product_id (int) | rating (int) |
|---|---|---|
| 1 | 10 | 5 |
| 2 | 10 | 4 |
| 3 | 11 | 3 |
| 4 | 11 | null |
| 5 | 12 | 4 |
| 6 | 12 | 2 |
| 7 | 13 | null |
| 8 | 13 | null |
Column names and order must match. Sort order is specified in the question.