Sign in to run and submit your work
Reading is open to everyone. Running code and saving drafts need an account so your work is yours and comes back on your next visit.
or
CODE WORKSPACE
Return exactly partition_day, records_to_replay, and latest_arrival_at for source_events that are corrections or arrived after their event day.
Result columns · in this order
partition_dayrecords_to_replaylatest_arrival_atHow to approach it
Group qualified events by event-time partition and inspect the latest ingestion timestamp.
Sample input
| event_id | event_time | ingested_at | is_correction |
|---|---|---|---|
| 501 | 2026-03-02 08:00:00 | 2026-03-02 08:01:00 | 0 |
| 502 | 2026-03-02 10:00:00 | 2026-03-05 09:00:00 | 0 |
| 503 | 2026-03-03 11:00:00 | 2026-03-05 10:00:00 | 1 |
| 505 | 2026-03-04 14:00:00 | 2026-03-06 02:00:00 | 0 |
4 rows — all rows shown.
Expected output
| partition_day | records_to_replay | latest_arrival_at |
|---|---|---|
| 2026-03-02 | 1 | 2026-03-05 09:00:00 |
| 2026-03-03 | 1 | 2026-03-05 10:00:00 |
| 2026-03-04 | 1 | 2026-03-06 02:00:00 |
3 rows — all rows shown.
Constraints
Group by date(event_time). A record qualifies if is_correction = 1 or date(ingested_at) > date(event_time). Order by partition_day.
Expected skills
Backfill planning, late-arrival detection, and replay partition selection.
Submit for review to find out what your query gets right, what it gets wrong, and how it compares with the best working query for this exercise.
This scenario runs a full workspace — editor, canvas and results side by side. It needs a laptop or desktop to be usable. Open this page on a bigger screen to start building.