Loading problem...
A commerce data platform stores product prices in a wide table (one store channel per column), but downstream services consume row-level records. Each export batch also carries an active store list that controls which channels should be emitted.
Table: products
Table: active_stores
Business rules:
Task: Return normalized row-level records for active and available prices.
Output requirements:
Supported submission environments:
products:
| product_id | store_north | store_south | store_east | store_west | store_online | store_outlet |
|------------|-------------|-------------|------------|------------|--------------|--------------|
| 1 | 120 | null | 100 | null | 95 | null |
| 2 | null | 80 | null | 70 | null | 60 |
active_stores:
| store |
|--------------|
| store_east |
| store_online |
| store_outlet |[
{"product_id":1,"store":"store_east","price":100},
{"product_id":1,"store":"store_online","price":95},
{"product_id":2,"store":"store_outlet","price":60}
]Only active stores are considered. Null store values are excluded.
products:
| product_id | store_north | store_south | store_east | store_west | store_online | store_outlet |
|------------|-------------|-------------|------------|------------|--------------|--------------|
| 10 | 15 | 20 | 25 | 30 | 35 | 40 |
active_stores:
| store |
|-------------|
| store_west |
| store_west |
| store_north |[
{"product_id":10,"store":"store_north","price":15},
{"product_id":10,"store":"store_west","price":30}
]Duplicate active store rows should not duplicate output rows.
products:
[]
active_stores:
| store |
|--------------|
| store_east |
| store_online |[]No product rows means no output rows.
Constraints