Read queries from a text file and give maximum queried user — in python and spark
Asked in the technical round 2 stage. The file is audit.txt, with columns userid, timestamp, tablename, and queries. Use the SQL representation below to return all users tied for the highest number of recorded queries.
userid, query_countuserid ascending| Column | Type | Description |
|---|---|---|
| useridPK | INT | Unique identifier for a user |
| Column | Type | Description |
|---|---|---|
| audit_idPK | INT | Unique identifier for an audit record |
| userid | INT | User who issued the query |
| timestamp | TIMESTAMPTZ | Time when the query was recorded |
| tablename | VARCHAR(100) | Table referenced by the query |
| queries | TEXT | Query text captured from audit.txt |