Join Google Maps Place Edits to the Version Active at Edit Time
Last updated: November 29, 2026
Quick Overview
Given a history of place versions with start times and a log of user edits, attach to each edit the place version that was live when the edit was made, and measure how many edits land within ten minutes of a version change.
0
0
0 solved
Given a history of place versions with start times and a log of user edits, attach to each edit the place version that was live when the edit was made, and measure how many edits land within ten minutes of a version change.
Maps user contributions conflict when someone edits a place right after another change went live. This onsite SQL question checks point-in-time (as-of) joins: building validity ranges with LEAD and joining on a half-open interval, rather than joining to the latest version and leaking future data.
What the Interviewer Expects
- Build valid_from and valid_to with LEAD per place
- Join edits on a half-open interval to avoid double matches at boundaries
- Keep edits that occurred before the first version with a LEFT JOIN
- Compute time since the version became active
- Discuss the alternative with ROW_NUMBER over all earlier versions and its cost
Key Topics to Cover
How to Approach This
- Clarify the schema and expected output format before writing queries.
- Use CTEs (WITH clauses) to break complex queries into readable steps.
- Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
- Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
- For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
- How would you do this join in pandas?
- Versions can be backdated by moderators. What breaks?
- How would you find edits that reverted the previous change?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice SQL ProblemsSample Answer
Clarify the Data
place_versions(place_id, version_id, valid_from): a new row each time a change is published. place_edits(edit_id, place_id, editor_id, edit_ts, field). A version is live from its valid_from unti...
Approach
Turn the version log into ranges with LEAD(valid_from) as valid_to, NULL for the current version. Join each edit to the version where valid_from <= edit_ts < valid_to. The half-open interval mea...