Loading problem...
A beverage analytics pipeline receives order rows where some drink names are missing due to upstream capture gaps. Analysts want a corrected stream where missing drink labels inherit the latest known value.
Table: CoffeeShop
Stream semantics:
Task: Return a corrected stream where every NULL drink has been forward-filled from the prior known drink.
Output requirements:
Supported submission environments:
CoffeeShop:
| id | drink |
|----|-------------------|
| 9 | Rum and Coke |
| 6 | null |
| 7 | null |
| 3 | St Germain Spritz |
| 1 | Orange Margarita |
| 2 | null |[
{"id":9,"drink":"Rum and Coke"},
{"id":6,"drink":"Rum and Coke"},
{"id":7,"drink":"Rum and Coke"},
{"id":3,"drink":"St Germain Spritz"},
{"id":1,"drink":"Orange Margarita"},
{"id":2,"drink":"Orange Margarita"}
]Rows with NULL drink inherit the most recent known drink in stream order.
CoffeeShop:
| id | drink |
|----|------------|
| 50 | Zebra Fizz |
| 10 | null |
| 70 | Apple Soda |
| 5 | null |
| 99 | null |
| 1 | Mango Tea |
| 2 | null |[
{"id":50,"drink":"Zebra Fizz"},
{"id":10,"drink":"Zebra Fizz"},
{"id":70,"drink":"Apple Soda"},
{"id":5,"drink":"Apple Soda"},
{"id":99,"drink":"Apple Soda"},
{"id":1,"drink":"Mango Tea"},
{"id":2,"drink":"Mango Tea"}
]Even if id values are non-monotonic, filling follows row sequence, not numeric id order.
CoffeeShop:
| id | drink |
|----|--------------|
| 1 | Iced Latte |
| 2 | null |
| 3 | null |
| 4 | null |
| 5 | null |[
{"id":1,"drink":"Iced Latte"},
{"id":2,"drink":"Iced Latte"},
{"id":3,"drink":"Iced Latte"},
{"id":4,"drink":"Iced Latte"},
{"id":5,"drink":"Iced Latte"}
]A single known value can propagate through a long null run.
Constraints