Pyspark question: Trips data: rider_id,client_id,start_time,end_time,vehicle_id,distance - return top 10 customers who has longest distance travelled
Asked in the technical_round_2 stage, as reported in the second EPAM onsite interview post.
Implement the equivalent algorithm as top_customers(trips). Each trip is a dictionary with integer rider_id, client_id, and vehicle_id, plus a nonnegative numeric distance. Return up to 10 [client_id, total_distance] pairs, ordered by total distance descending, then client ID ascending for ties.
def top_customers(trips):