Start by clarifying the data schema and window semantics, then outline an end-to-end pipeline: interval-to-window expansion, aggregation, and validation. Emphasize partitioning and skew mitigation, and discuss handling of late/duplicate events with watermarks and deduplication.
Pro tip: Mention that you would first compute per-room utilization and then aggregate to office level to avoid double-counting overlapping meetings in the same room. Also, use a two-phase aggregation with a salt key to handle hot partitions.
Confirm the definition of 'rolling 15-minute window' (e.g., sliding windows every 15 minutes or tumbling windows) and the exact utilization formula. Identify key fields and potential data quality issues.
For each meeting, generate all overlapping 15-minute windows by iterating from floor(start/15) to floor(end/15). Emit (window_start, office_id, room_id) as key and a count of 1 as value, ensuring each meeting contributes to each window it overlaps.
Map: key = (window_start, office_id, room_id), value = 1. Reduce: sum values to get concurrent meetings per room per window. Then compute room utilization as concurrent_meetings / room_capacity; flag rooms exceeding 80%. Finally, aggregate to office level by summing concurrent meetings per office.
Partition by window_start and office_id to distribute load. Use salting for hot keys (e.g., popular offices) to avoid skew. Consider using a combiner to pre-aggregate before shuffle.
Use watermarks to handle late events and deduplicate by event ID or (user_id, start_time, room_id). Validate output by comparing with a batch job on a sample, checking invariants (e.g., sum of room meetings equals office meetings), and monitoring job metrics.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.