Given a live-tail stream of lines where "Q: " registers a query and "L: " is a log line, acknowledge each query with an incrementing ID and, for every log line, output the IDs of all queries whose words all appear in that log.
Asked in the coding round 2 stage. This was a 60-minute coding round, and upper/lower case handling is part of the problem.
The input table is stream_events(event_id, raw_line). Treat matching as case-insensitive and ignore punctuation when identifying words.
event_idevent_id, response_type, query_id, matching_query_idsquery_id; for log events, return all matching IDs in ascending order, or an empty array when none match| Column | Type | Description |
|---|---|---|
| event_idPK | INT | Unique position of the line in the live-tail stream |
| raw_line | TEXT | Raw stream line beginning with Q: or L: |