What do the two window calculations return for the city values?

The query first uses a window function to calculate grp for each customer. It then partitions the rows by that value and performs a second window calculation. Check which rows end up in each partition. What will the query return?

Predict the resultNULLMiddleAnalystData Engineer
Input data · iv_customers
idnamecity
1AliceBerlin
2BobParis
3CarolNULL
4DanBerlin
5EveParis

Query

WITH staged AS (
  SELECT id,
         city,
         COUNT(city) OVER (
           ORDER BY id
           ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
         ) AS grp
  FROM iv_customers
)
SELECT id,
       city,
       MAX(city) OVER (PARTITION BY grp) AS observed_city
FROM staged
ORDER BY id