Write a query to collapse consecutive unchanged rows in price_changes into price periods for each sku, in ascending effective_on order. Ignore exact duplicate rows; there is at most one price state per SKU per day.
A NULL price_usd is a withdrawal state: two consecutive NULLs are unchanged, while a transition between NULL and a recorded price starts a new period. A previous price returning after another state begins a new period too.
Return the period’s price and first date as valid_from. Set valid_to to the day before the next period starts; the latest period for each SKU has NULL valid_to. days is the inclusive period length, or NULL for an open period.
Ordering: Sort by sku, then valid_from in ascending order.